Ferrarixxx's blog

By Ferrarixxx, history, 6 months ago,

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.com/contest/1324/problem/E

My code Link : https://codeforces.com/contest/1324/submission/80940535

Editorial Link : https://codeforces.com/blog/entry/74714

Please give it a try.
 » 6 months ago, # |   +3 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 is j <= i, with i < n.For a shorter example of this case, try this: 3 24 20 20 20 14 10