Комментарии
На Little_Sheep_YawnCodeforces Round 1057 (Div. 2) Editorial, 6 месяцев назад
0

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

На chromate00Codeforces Round 1000 (Div. 2) — Editorial, 13 месяцев назад
0

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.

На awooEducational Codeforces Round 170 Editorial, 17 месяцев назад
0

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

На awooEducational Codeforces Round 170 Editorial, 17 месяцев назад
0

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.
     */
На ajxu2Java Pitfalls, 3 года назад
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.

На ajxu2Java Pitfalls, 3 года назад
0

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

На VladosiyaCodeforces Round #874 (Div. 3) Разбор, 3 года назад
0

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

0

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

+3

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.

На VladosiyaCodeforces Round #847 (Div. 3), 3 года назад
0

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?

На TeaTimeCodeforces Round #815 (Div. 2) Editorial, 4 года назад
+4
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.
На VladithurCodeforces Round #813 (Div. 2) Editorial, 4 года назад
0

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.

На tokitsukazeCodeforces Round #789 Editorial, 4 года назад
0

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.

На tokitsukazeCodeforces Round #789 Editorial, 4 года назад
0

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

На BledDestРазбор Educational Codeforces Round 96, 4 года назад
0

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

На JeevanJyotCodeforces Round #754 (Div. 2), 4 года назад
-9

Problem C was a mess

На AlFlenCodeforces Round #750 (Div.2) Editorial, 4 года назад
0

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

На AlFlenCodeforces Round #750 (Div.2) Editorial, 4 года назад
0

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.

0

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

На ND_Digit DP Practice Problems for Beginner's, 5 лет назад
0

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

На ND_Digit DP Practice Problems for Beginner's, 5 лет назад
0

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

На ND_Digit DP Practice Problems for Beginner's, 5 лет назад
0

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

На flash_7Digit DP, 5 лет назад
0

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

На icecuberCSES DP section editorial, 5 лет назад
0

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

На icecuberCSES DP section editorial, 5 лет назад
0
На icecuberCSES DP section editorial, 5 лет назад
0

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

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

На RadewooshCodeforces Round #304 (Div.2) editorial, 5 лет назад
0

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