fazer02's blog

By fazer02, history, 23 months ago, In English

So I was giving Codeforces Round #790 Div 4. I solved B (not efficiently) however my code gave wrong ans. After the contest was over I looked for the test case and ran in my personal ide. It worked fine there. It was also running on onliegdb.com

Link to my solution: https://codeforces.com/contest/1676/submission/156648104

I want to know why isn't my code running as intended? Thanks for any help!

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

| Write comment?
»
23 months ago, # |
  Vote: I like it +5 Vote: I do not like it

You exit the function without reading the values when n is 1, so every test afterwards is reading the wrong data.