We will hold AtCoder Regular Contest 213 (Div. 1).
- Contest URL: https://atcoder.jp/contests/arc213
- Start Time: http://www.timeanddate.com/worldclock/fixedtime.html?iso=20260125T2100&p1=248
- Duration: 150 minutes
- Number of Tasks: 4
- Writer: leaf1415, vwxyz0, Nyaan, potato167
- Tester: maspy, Nyaan
- Rated range: 1600 ~ 2999
The point values will be 600-800-900-1100.
We are looking forward to your participation!









Auto comment: topic has been updated by atcoder_official (previous revision, new revision, compare).
Problem B was so much fun to solve. I initially underestimated it. Problem C looks like an amalgamation of LCA, HLD, Flows and what not! Couldn't manage time to solve it.
Great contest :))
Can you share your idea about B? I was implementing a lot of classification discussion(about 4KB) only to get AC25 WA28
Super giant classification discussion is a solution for B. I wrote 6KB for B.
So, the disclaimer is I am very poor at explaining. I can even confuse you more. And thus, I would seriously recommend referring the editorial as the hints, explanation and alternative solution can ease your task. Still if you want to get a gist of my solution, here you go!
So, I hope you know about Hypercube graphs and MIS. Assume graph breaks into 2 parts: A and B with no edges b/w them then, the MIS = MIS(A) + MIS(B). I used DAC for this.
So, consider two nos. u and v which differ by only 1 bit (adjacent nodes in Hypercube graphs). Now, let's have 2 parts: with u in one and v in another. Now, for u and v to be connected, they must differ only at one bit, and all other bits must be same in the suffix.
Consider L XOR R and consider its MSB, with M = 1LL << MSB. Now, we have 2 parts which are the one we talked above. One with numbers with MSB set and one without. Now, the suffix range in the left part is [L Mod M, M — 1] and that in right part is [0, R Mod M].
I will consider 2 cases now: these ranges overlap or not. If they overlap, I can return max(even, odd) for this range. (This is the mistake I was doing early; I was just considering this case). And if they are disconnected, recursively solve them for [L, M — 1] and [M, R]. The answer would be sum of both (as we've discussed above).
And; I assume you would have definitely managed counting of parities in range [0, X] in O(log X) time.
Use Digit DP.
The obvious lower bound is ceil(half), achievable if we take all elements with the same parity of popcount.
Since we're looking for a max. independent set in a bipartite graph (again because parity of popcount), its size is total number of elements — size of maximum matching. Matching $$$2k$$$ with $$$2k+1$$$ gives at most 2 unmatched elements, which are possibly $$$L$$$ and $$$R$$$. That gives us an upper bound that's very close to the previous lower bound. Specifically:
How to find an augmenting path? Well, if the first bit where $$$(L-1)/2 = l$$$ and $$$R/2 = r$$$ differ is $$$b$$$, then we have paths from
l = prefix + 0 + ...toprefix + 0 + 11...1and fromr = prefix + 1 + ...toprefix + 1 + 00...0. These are ranges. Do they overlap and if they do, is it in a way that allows connecting them to make an augmenting path? The answer is: iff $$$r-l \gt 2^b$$$. If that's false, we also get a construction: all elements in the left range with the same parity of popcount as $$$L$$$ and same for the right range.It requires some effort to figure out due to all the casework but most of that effort is noticing obvious bounds and obvious constructions.
Can you share solution for 2nd problem ?
What the fuck is
2_1.txt?OK, I understand. It is $$$[L,R]=[0,17]$$$, a corner case for me.
Can't be more painful :((
Here is my solution to B for q = 0 (it can be easily extended to q = 1).
Say we are trying to solve the range $$$[l, r]$$$. While the highest bit of $$$l$$$ equals the highest bit of $$$r$$$, remove the highest bit from both. This does not change the answer.
Let $$$x$$$ be the greatest power of $$$2$$$ less than or equal to $$$r$$$. Then if $$$r - x \lt l$$$ we will recursively solve $$$[l, x)$$$ and $$$[x, r]$$$ and return the sum. Only the left interval can keep splitting so the number of intervals is bounded by $$$O( \log R )$$$
Otherwise, we can count the number of the numbers in $$$[l, r]$$$ with even popcount and odd popcount and return the max.
Finished implementing $$$q = 1$$$ right after the contest ended :(
I have this solution except you don't actually need to solve two new ranges recursively, first split is enough.