Can someone explain me what exaclty went wrong ?

Правка en2, от kartikea_gupta, 2020-08-10 17:28:24

I submitted this solution to Problem A of Round #663. I know the problem was really easy and even my logic was correct. What actually caused problems was including the following two line in my void solve() function.

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

I added the two lines for fast input/output through cin/cout but mistakenly added them to void solve(). However, after removing these two lines the code worked fine and got accepted.
Link to first solution.
Link to second solution.

Can someone please explain what exactly went wrong and why?
Thanks in advance!!
UPD: Not here for contributions. Plz just answer it if you know the answer.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский kartikea_gupta 2020-08-10 17:28:24 80
en1 Английский kartikea_gupta 2020-08-10 17:10:57 848 Initial revision (published)