Regarding the problem F of yesterday's contest

Revision en3, by Whitewiz, 2024-06-12 19:04:03

I used accumulate for calculating the sum of elements of the array(which got hacked) however simply calculating the sum via iteration gives the correct result.

Am i missing something or is there any problem with using this "accumulate" thing.

Accepted — (https://codeforces.me/contest/1985/submission/265437274) ,(https://codeforces.me/contest/1985/submission/265439252)

Hacked — (https://codeforces.me/contest/1985/submission/265303752)

update — this idea of using all the attacks at once (at 1st second) requires to calculate the sum of the array ,but this sum can overflow (long long is insufficient). Better idea is to use the ceil division in the check function like this :

tot += ((have + cool[i] — 1)/cool[i]) * attack[i]; Hacker of the above solution helped me figure this out. Thanks a lot sammyuri sir.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English Whitewiz 2024-06-12 19:04:03 412
en2 English Whitewiz 2024-06-12 08:18:05 64
en1 English Whitewiz 2024-06-12 08:06:19 446 Initial revision (published)