Please read the new rule regarding the restriction on the use of AI tools. ×

skc3766's blog

By skc3766, history, 3 years ago, In English

my solution is giving the wrong solution on test case 3. I don't know why?

Can someone help find the fault in the logic ?

https://codeforces.me/contest/1534/submission/126403032

regards.

  • Vote: I like it
  • -3
  • Vote: I do not like it

»
3 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Your code is failing on test case :

n = 6

1 4 2 3 6 5

4 2 1 6 5 3

Expected output : 4

Your output : 2

Your logic is little wrong, your code is just checking for cases when groups like ((1,2),(2,1)) are present but fail when multiple groups of type ((1,3,2),(3,2,1)) exists in the grid.

Check out my submission , you will find out your mistake in your code by own.

119374707