Can anyone explain solution for Permutation Game?

Revision en1, by ganesh_6, 2021-12-12 18:28:41

I am solving the problem https://codeforces.me/problemset/problem/1033/C. I could not get the editorial and found the comment https://codeforces.me/blog/entry/62287?#comment-462858 useful. I have implemented the solution as per the comment, but it is giving WA

WA
AC

My doubt is that why can't we do like WA and why should we loop using elements instead of indexes?

Please explain why the earlier approach is giving WA and not later.

Tags dp, help, c++, java

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English ganesh_6 2021-12-12 18:28:41 3850 Initial revision (published)