Блог пользователя Whitewiz

Автор Whitewiz, история, 2 недели назад, По-английски

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.com/contest/1985/submission/265437274) ,(https://codeforces.com/contest/1985/submission/265439252)

Hacked — (https://codeforces.com/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.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

Автор Whitewiz, история, 2 месяца назад, По-английски

link to the problem -- https://www.spoj.com/problems/STPAR/

my solution -- https://pastebin.com/JCvFy7zr

I am not able to detect my mistake in the code. Any kind of help will be highly appreciated. Thanks

Полный текст и комментарии »

  • Проголосовать: нравится
  • -1
  • Проголосовать: не нравится