### skpro19's blog

By skpro19, 5 years ago,

I have understood the sqrt decomposition + SOS DP approach to the problem. This is an accepted solution to the problem. However, on changing the size of the array Q_MAX to 'N_MAX + 100', I am getting WA. Why is that?

What am I missing?

• 0

By skpro19, history, 5 years ago,

I observed a weird thing today in the Visual Studio IDE while solving the second question of Hourrank 25. This the the code.

On my local machine, the value of pre[0][0], automatically becomes 1 randomly anywhere inside the while loop. However, the weird thing is, if I initialise the value of fact[0] to 0, then everything becomes normal again. This is weird because the computation of fact has nothing to do with the value of pre[0][0].

I feel silly asking this, but what am I missing? The code which is giving wrong answer on the local machine , gives the correct answer on Ideone, and also fetches full marks after submission.

Thanks. Peace.

• 0

By skpro19, history, 5 years ago,

Let's discuss the hackerearth december circuits here.

The link to the competition is this.

• +2

By skpro19, history, 5 years ago,

This problem was the 6th problem in the last Educational Round. It requires the use of bitmask dp. I read through the editorial, but I can't understand, how the dp states are being defined. It would be really nice, if someone could help me with that.

Div 2F

Peace.

• +5

By skpro19, 5 years ago,

This was the fourth question in the November Lunchtime. I am not able to understand it, even after reading the editorial. Can someone please explain it in a bit more detail?

I can not udnerstand anything in the official editorial.

I can't understand the dp states in the unofficial editorial, and also how to use the treap data structure being discussed in the editorial.

• +3

By skpro19, history, 5 years ago,

Why am I getting WA in this code?

I am dividing 'x' by all the prime numbers. To find the prime numbers, I am using the sieve. I know, it can be done without using the sieve, but when I am using the sieve, I am getting WA. Can someone please help ?

Div 2E: Counting Arrays

My code

It would be really kind if someone could point out the bug.

• 0

By skpro19, history, 5 years ago,

Can someone give hints for the third and the fourth problems for the Codechef October Lunctime.

Codechef October Lunchtime

Problem 3

Problem 4

• -20

By skpro19, history, 5 years ago,

This is the problem link. This is my submission. It is getting TLE. I read another guy's recursive approach. It got full points. I don't understand, why this code is getting accepted, but mine is not.

Any help would be really appreciated.

Peace.

• -8

By skpro19, history, 5 years ago,

The problem is this.

After going through the tutorial, and through the discussions, and reading a lot of submitted solutions, I am not exactly able to grasp the concept behind this problem.

I am pretty sure, there's some underlying topic, which I am unaware of.

Can someone please suggest some underlying concepts to better understand this problem? It would be really kind.

Thanks.

• 0

By skpro19, history, 5 years ago,

This is the problem .

According to the accepted solution of other coders, the following test case gives a "Yes". But, shouldn't it give a "No" ?

6 1 2 1 1 1 1 1 1 6

Any help would be really appreciated.

• -10

By skpro19, history, 5 years ago,

The question is 459C.

I have understood the logic behind it. But, in order to generate the possible permutations, I am using DFS.

It gives a WA on test 7, saying that my code prints ":". But, I am not printing ":" anywhere in my code.

Any help would be really appreciated.

• 0

By skpro19, history, 5 years ago,

The problem is this.

The editorial says this:-

We need some observation: There exists an optimal solution such that: in any pile, the box on the higher position will have a smaller strength.

Let k be the minimal number of piles, then there exists an optimal solution such that: The height of all piles is n/k or n/k+1 (if n%k=0, then all of them have the height n/k).

We can prove them by exchange argument: from an optimal solution, swap the boxes in it to make above property holds, and we can ensure it will remain valid while swapping. Then for a given k, we can check whether there exist a solution: the i-th (indexed from 0) smallest strength needs to be at least i/k. So we can do binary search (or just enumerate, since n is only 100) on k.

Doubt:

Why does the ith index need to be atleast i /k ?

• -5

By skpro19, history, 5 years ago,

I am getting a WA on this problem. Can someone suggest, what is wrong with my logic?

My submission: http://codeforces.com/contest/85/submission/30241748

• -8

By skpro19, history, 5 years ago,

I am getting a TLE on this problem using DFS. This is my submission. Can someone suggest some optimizations?

• 0

By skpro19, history, 5 years ago,

I am getting a WA on test 9 on this DIV 1A.

Is there a problem with my 'poss' function or the very dfs function itself?

This is my submission.

• -14

By skpro19, history, 5 years ago,

The question is this.

The solution is something like this:

dp[1] = 1, dp[2] =3 ;

for(int i =3; i <= n ; i++) dp[i] = dp[i — 1] + dp[ i- 2] + 2;

How did one come with the formulation dp[i] = dp[ i — 1 ] + dp[i — 2] + 2 ?

Any help would be really appreciated.

Peace!

• 0

By skpro19, history, 5 years ago,

Is anyone able to see the test cases on the submitted solutions?

Can someone from Codeforces comment on how long will we have to face this problem?

I thought this was a temporary glitch :-(

• +21

By skpro19, history, 5 years ago,

The question is this-> 757C

I am unable to understand anything in the editorial, as well as the given code. Can someone please help?

• -20

By skpro19, history, 5 years ago,

If we assume that the length of the string is n, then my solution has a complexity of O(n * n) ;

Why is it not getting TLE instead?

• -7

By skpro19, history, 5 years ago,

I am solving this DIV 2C. This is my submission which got accepted.

My question is this:

Why isn't updating the parent of a node, an O(n) operation ?

• -8

By skpro19, history, 5 years ago,

I am solving the problem DIV 1A. My submission is getting a TLE error. I went through the successful submissions as well, but I don't see any other logic. Any help would be appreciated.

• 0

By skpro19, history, 6 years ago,

I have doing competitive programming for 2 years.I solved all the DIV 2B problems, and then, I have been solving the DIV 2C problems topicwise. Unfortunately, I have stuck between the 1300- 1500 level for the two years. I am feeling very discouraged. Can you guys please suggest me what am I doing wrong? How should I practice?

• +1

By skpro19, history, 6 years ago,

I am getting "Accepted" when I am using C++ lower_bound function -> Submission

I am getting wrong answer using the binary search -> Submission

• +1

By skpro19, history, 6 years ago,

I am getting a WA on testCase 6.

Question — Div 2C

My Submission

Can someone please tell me what's wrong with the code?

• -6

By skpro19, history, 6 years ago,

In this problem Div 2C, how can the difference between the maximum visited and the minimum visted be more than 1 ?

• -12