Блог пользователя Kneee

Автор Kneee, история, 21 месяц назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • +10
  • Проголосовать: не нравится

Автор Kneee, история, 2 года назад, По-английски

Question

in this 1375C - Уничтожение элементов 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?

Полный текст и комментарии »

  • Проголосовать: нравится
  • -11
  • Проголосовать: не нравится