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

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

Hey guys

if anyone wanted a video editorial for today div2 problem C I made one and posted onto youtube

Video

Thank you!

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

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can you explain a bit more about the (mex+1 < number of elements) in the array?
Thanks

  • »
    »
    19 месяцев назад, # ^ |
    Rev. 2   Проголосовать: нравится +10 Проголосовать: не нравится

    Hey! so you can keep a list of what numbers you need to increase the mex and if you have just one more you need, you can change a number into the number you need and you are done right? for example 0 1 2 3 4 5 100 => you want MEX 6, you have 0-5 so all you need is 6, so change the 100 to 6

    but that relies on you having something to change. for example 0 1 2 3 4 5 => you want MEX 6. You have 0-5 so all you need is 6, but you can't change anything else to get a 6 because that means you lose one of the 1-5.

    So, you have to check whether you have sufficient number of elements to get your mex+1. If you have < k elements in an array, you can't have MEX of k. So, you need to check if the number of elements is > mex+1, otherwise you can't achieve mex + 1.

    Hope this helps!