Comments

In Problem B , we can just check: ((x&y) == (y&z) && (x&y) == (z&x)) ? "YES" :"NO"

Problem C, Solution 2:

Instead of trying 2 max degree nodes, we can choose the node having maximum depth amount all nodes having the max degree count. This is always work as the size of one connected component will be very much larger than other. And it leaves us a choice to choose 2nd node with more degrees.

worsh case total # of operations your code doing: O(m*m*4logm) which will lead to TLE. m=5000.

Another approach for Problem D: https://mirror.codeforces.com/contest/2025/submission/294067890

Hints:

--> when we hit a 0, we either increase strength or intelligence
        both strength and intelligence can be solved independenty and similarly
--> let say if we can pass a strength check of value sC then we can pass all strength check of values <=sC
--> let say current strength is sC, and we increase it by 1, sC = sC +1
--> then all the strength checks witth value sC +1 can be passed on the right.
     */
On ajxu2Java Pitfalls, 3 years ago
0

As you mentioned in the solution, all of the problems you mentioned with JJava can be bypassed effortlessly. Don't motivate people to leave Java. C++ also has issues like initializing randomly for primitive data type arrays. Java uses default values for them (0 for int[] and false for boolean[]).

Also, Java does not provide Segmentation fault, which I like about Java.

On ajxu2Java Pitfalls, 3 years ago
0

For 5, you can use Dequeue also. It has the same complexity as of ArrayList.

My simple greedy approach for G using degree and dfs: https://mirror.codeforces.com/contest/1833/submission/206667701

The value of k can be -1, so initializing answer with -1 is wrong.

Dont use decimal calculations here, it has precision error. A simple approach is to find the largest k smaller than b and smallest k larger than b and check for the condition (b-k)^2 <4ac.

I am getting WA in TC 4, I don't know why? Can somebody help me? Solution:https://mirror.codeforces.com/contest/1810/submission/200348409

Div2-D had a very weak pretest. I got a WA in actual testing. It was :

1
2
10 100
10 100

Which cost me +ve delta.

How come the tutorial solution for problem F gives TLE ? https://mirror.codeforces.com/contest/1790/submission/194017127

Can somebody elaborate more on why this is happening? I mean at-most, we are calculating 2n states, why TLE then?

If the tut of Problem D1 is not clear. Have a look here : 
observe the inequality a[j] ^ i < a[i] ^ j.
notice that a[i] < 200 so, we can observe that : 
        1. by doing a[j] ^ i , we can reduce i by atmost 256
        2. by doing a[i] ^ j, we can increase j by atmost 256
Hence and after reducing i to i' and increasing j to j', we need to check if j' > i'.
So to find the max length ending at index i, we have to look only 512 indexes left to it.

Can somebody help me out with Problem D : Link

My approach is ans = max( min(2 * mn , min(a[i],a[i+1]))) , where mn is the minimum value of a.

Well theoretically it should not pass as the # of operations: O(5000*5000*13) = 3.25 * 10^8. And we can process 10^8 operations in 1 sec.

I did Problem C in O(n^2 logn) using binary search, got TLE. But the editorial says it will pass. How is this possible? My solution link : https://mirror.codeforces.com/contest/1678/submission/156353215

In the editorial of D, para 3, it is written, "It's easy to see that we should choose a character from the leftmost such block since that block is the earliest to be deleted (and if we want to make the same action later, we might be unable to do it).".

My doubt is why is it optimal to delete from left only? Why does it matter which block we delete?

Got a WA on TC2 for Problem C, not sure why. https://mirror.codeforces.com/contest/1608/submission/138834566

Can somebody tell me what is going wrong in my code or provide any counter case. Thanks

Problem C was a mess

(1ll << cnt0) * (ll)cnt1 =( 2^(cnt0) ) * cnt1, where cnt0 = # of 0's and cnt = # of 1's in the array a.

I am getting TLE for Problem E but I think my solution is O(nk), k = sqrt(n). Not sure why. could anybody please help me with this. Solution link : https://mirror.codeforces.com/contest/1582/submission/133125904.

Although I am looping for j=1 to k and then calling memo(), but according to me, the total dp state calculation time is O(nk) only.

You haven't applied modular operation. See my solution : https://mirror.codeforces.com/contest/628/submission/119295777

Auto comment: topic has been updated by ND_ (previous revision, new revision, compare).

Auto comment: topic has been updated by ND_ (previous revision, new revision, compare).

Auto comment: topic has been updated by ND_ (previous revision, new revision, compare).

On flash_7Digit DP, 5 years ago
0

Is any editorial available for these problems? If yes please paste the link here. Sorry for Spamming.

On icecuberCSES DP section editorial, 5 years ago
0

Yes got AC. Thanx. But why my code gave TLE even changing after vector to vi

On icecuberCSES DP section editorial, 5 years ago
0
On icecuberCSES DP section editorial, 5 years ago
0

Coin Change 2 give TLE with O(n*target) time complexity

solution link: https://cses.fi/paste/c0e3ad19fd184ec3227a11/

Easy and Detailed solution for Problem D : https://mirror.codeforces.com/gym/328681/submission/116502457