Question about variation of Codeforces Global Round 9 C problem

Revision en1, by Kneee, 2022-10-10 10:28:24

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?

Tags data structures, constructive algorithms, greedy

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Kneee 2022-10-10 10:28:24 634 Initial revision (published)