[C++ STL] Accumulate Not Working?

Правка en1, от Mridul323, 2020-11-02 23:24:25

Hello Codeforces,

Today I was trying to solve 1443C - The Delivery Dilemma from recent contest. In one of my solutions I used accumulate to find sum of all the elements in a vector but my solution failed on test case 4 then I tried general way of finding sum of all the elements and surprisingly this got accepted. To be honest I just couldn't figure out what was wrong in my previous solution. I tried searching internet but I could not find any drawback of accumulate so far.

Submission with Accumulate : 97508205 Submission without Accumulate : 97501239

I am really confused what could go wrong. Somebody please let me know if there is some mistake in my former submission and in which cases we should not use accumulate. Thanks in advance :)

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Mridul323 2020-11-02 23:28:28 14
en1 Английский Mridul323 2020-11-02 23:24:25 808 Initial revision (published)