mac_n_cheese_pog's blog

By mac_n_cheese_pog, history, 3 years ago, In English

can someone help me with this problem https://mirror.codeforces.com/contest/218/problem/A my solution is this https://pastebin.com/r0ppiqGh idk what is wrong with it because ive been debugging for 45 mins

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

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

I am not sure about what you are trying to do inside the double nested loops, but the problem has a simple O(n) solution with a single loop and without sorting the array.

Note that the array size is 2*n+1, not n.

Check the following solution if interested.

123568084