Unclear doubt in codeforces round 816 div 2 problem B

Revision en1, by aryamansinghk, 2022-08-20 20:59:02

Problem link https://mirror.codeforces.com/contest/1715/problem/B I solved the same problem using same logic. Once I directly tried to print the answers https://mirror.codeforces.com/contest/1715/submission/169136862 but got wrong answer on pretest 2. While on other approach I stored them in an array and did the same https://mirror.codeforces.com/contest/1715/submission/169162093 and got the solution accepted. Why this happened?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English aryamansinghk 2022-08-21 06:50:49 114
en2 English aryamansinghk 2022-08-20 20:59:37 4
en1 English aryamansinghk 2022-08-20 20:59:02 466 Initial revision (published)