Hi Guys,
I hope u are doing well
Actually
I cant understand why my code gives WA on 47 testcase
Even when my code is almost similar to the editorialist's code,
The testcase :
29 425 46 81
405 237 24 45 165 328 134 309 7 236 348 204 368 396 298 343 180 186 395 246 44 53 303 404 271 344 269 292 12
Actual answer : 2
Mycode's output : 1
Problem E Div 3 : https://codeforces.me/contest/1324/problem/E
My code Link : https://codeforces.me/contest/1324/submission/80940535
Editorial Link : https://codeforces.me/blog/entry/74714
Please give it a try.
Thanks in Advance.
If the optimal answer requires you to sleep the full time for the last time you can sleep, your code won't calculate it.
You can see in the editorial's code as well that their inner loop is
j <= n
, but yours isj <= i
, withi < n
.For a shorter example of this case, try this: