Interesting thing on Codeforces Round 932 (Div. 2)B

Правка en3, от Negationist, 2024-09-25 09:01:31

In the editorial, they use prefix sums to find the MEXs, but we can actually calculate the final MEX of the subsegments directly. This is based on the fact that if an element is in the array, there MUST be a subsegment that does NOT have it as the MEX. Thus, the final MEX(for all subsegments) must be just the MEX of the original array. With this knowledge we can simply find the first subsegment with that MEX as the MEX. From there, we look for one more subsegment with this as the MEX, if found, we are done. If not, we know it must be impossible. Please note this is my first real blog, let me know if I did something wrong.

Code: https://codeforces.me/contest/1935/submission/282863993

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский Negationist 2024-09-25 09:01:31 1403
en2 Английский Negationist 2024-09-25 09:00:31 35
en1 Английский Negationist 2024-09-25 08:59:33 2083 Initial revision (published)