Hey guys
if anyone wanted a video editorial for today div2 problem C I made one and posted onto youtube
Thank you!
# | User | Rating |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 156 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Name |
---|
Can you explain a bit more about the (mex+1 < number of elements) in the array?
Thanks
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!