|
0
beautifully written code nmnsharma007 |
|
On
MikeMirzayanov →
2019-2020 ICPC, NERC, Southern and Volga Russian Regional Contest (Online Mirror, ICPC Rules, Teams Preferred), 6 years ago
0
If you set rem = (arr[i] +rem)%c, there are chances that you will have soldiers of three different heights in a single row and you don't want that to happen. So, it is mandatory to check whether (rem+ arr[i]) >=c. If (rem+arr[i]) < c and you still carry on with making the row, then this row will have soldiers of height (i-1 i.e. rem) && (i) && (i+1) which are three different heights. |
|
0
Just do yourself for n = 2, 3, 4 ,5 ,6 and try to make white the winner. At the same time consider the fact that black is not dumb. |
|
0
I also got the same error during the contest but now I understand. Well, let's say our solution consists of two parts, 1 and 2. I am not going to explain the second part assuming you already know it. But in the first part, u must be choosing a minimum c1 among all possible c1 and then doing part 2 of the solution but we are doing a mistake here. Actually, part 1 of the solution has n possibilities. Choosing minimum c1 is just one of the possibilities. A second possibility, for example, can be choosing a minimum c2 and then doing part 2 of the solution. Similarily choosing a minimum c3 among all possible c3 can be the third possibility and so on. So there are n possibilities. |
|
+3
can you please explain the brute force approach?skittles1412 |
|
0
Thank You! Found my mistake! |
|
0
In Div2D(Unmerge), to find subset-sum I used the algorithm with TC:- O(N*M) & SC:- O(N*M), I got TLE in the contest. After the contest, I got to know about an algorithm that uses Linear space to find subset-sum but the TC of that algorithm is same as O(N*M), but it got accepted. Can anyone explain why I am getting TLE in the first approach? First Approach:- https://mirror.codeforces.com/contest/1382/submission/87597226 Second Approach:- https://mirror.codeforces.com/contest/1382/submission/87612296 |
|
0
Great Code!!! |