I dream of being a grandmaster and practice almost every day. I record what I think in my Google sheet and It can help me summarize some knowledge points. Now I want to share the problems I solve every day in the future here to practice my English writing skills.
My plan is to solve 3 problems every day and the score is between $$$[2000, 2200]$$$.
The first problem is D. Cyclic MEX. The key points are that: 1. We can easily calculate the prefix MEX from 0 to n — 1, so we can get the answer when the shift number is 0. 2. Now we need to think when we move the first number to the end, how the prefix MEX changes, I notice that if the first number is $$$x$$$, if the prefix MEX is bigger than $$$x$$$, it will change to $$$x$$$, and the last MEX will become n. So It looks like an interval assignment. We can use a Segment tree to solve it and we can use binary search in Segment tree to find the first index that its MEX is not smaller than $$$x$$$.
Solutuon: https://codeforces.net/contest/1905/submission/290262287
The second problem is E. Geo Game The key points are that: 1. When I play the sample, I notice the parity will depend on the parity of $$$x$$$ and $$$y$$$. So we can just use (0, 0), (0, 1), (1, 0), (1, 1) to represent all data.