Kneee's blog

By Kneee, history, 14 months ago, In English

Hi everyone,

Can anyone explain why this code gets Wrong Answer on Test Case 2, Although the same code just deletes the map (didn't use it), it gets Accepted

If you submitted the same code that got wrong with c++20, it will give AC but c++17 gives the wrong answer

Code with map c++17: 195842451 Wrong Answer on Test Case 2

Code with map c++20: 195842466 Accepted

Code without map c++17: 195842512 Accepted

 Thanks

Full text and comments »

  • Vote: I like it
  • +10
  • Vote: I do not like it

By Kneee, history, 19 months ago, In English

Question

in this 1375C - Element Extermination problem, if he gave me an array, not Permutation, the answer will change or it will be the same thing.

My submission: 175308852

My Idea

My observation is the answer doesn't rely on any element except the first and last one in the array. so, I asked something "If there are multiple numbers of $$$A_1$$$ or $$$A_n$$$, Will something happen?"

My answer is "I don't think so", as if I can erase $$$A_i$$$ $$$(1 \le i \le n)$$$ so I can erase all duplicates of $$$A_i$$$.

Can you ensure that this is correct? or proof it?

Full text and comments »

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