Codeforces Round 1105 (Div. 1, Div. 2) Editorial
Difference between en24 and en25, changed 0 character(s)
Thanks everybody for participating in the round!↵
↵
### [Div2A. Another Popcount Problem](https://codeforces.me/contest/2240/problem/A)↵
↵
Author: [user:wangmarui,2026-06-27] Preparation: [user:wangmarui,2026-06-27]↵
↵
<spoiler summary="Hint 1">↵
Consider each binary bit independently.↵
</spoiler>↵
↵
<spoiler summary="Hint 2">↵
Think about a greedy approach.↵
</spoiler>↵
↵
<spoiler summary="Solution">↵
[tutorial:2240A]↵
</spoiler>↵
↵
### [Div2B. AI Finds Nothing Here](https://codeforces.me/contest/2240/problem/B)↵
↵
Author: [user:Gold14526,2026-06-27] Preparation: [user:Gold14526,2026-06-27]↵
↵
<spoiler summary="Hint 1">↵
Try some special cases, such as $r=c=2$, $n=r$, or $m=c$, etc.↵
</spoiler>↵
↵
↵
<spoiler summary="Solution">↵
[tutorial:2240B]↵
</spoiler>↵
↵
### [Div1A. Nim Game Is XOR Game](https://codeforces.me/contest/2239/problem/A)↵
↵
Author: [user:Gold14526,2026-06-27] Preparation: [user:Gold14526,2026-06-27]↵
↵
<spoiler summary="Hint 1">↵
Try working through some cases by hand. You may notice that whenever there is more than one non-zero number, the first player wins. Then think about why this is true.↵
</spoiler>↵
↵
<spoiler summary="Solution">↵
[tutorial:2239A]↵
</spoiler>↵
↵
### [Div1B. Decidophobia](https://codeforces.me/contest/2239/problem/B)↵
↵
Author: [user:Gold14526,2026-06-27] Preparation: [user:Gold14526,2026-06-27]↵
↵
<spoiler summary="Hint 1">↵
How does everyone’s contribution change when you give a gift to someone?↵
</spoiler>↵
↵
<spoiler summary="Solution">↵
[tutorial:2239B]↵
</spoiler>↵
↵
### [Div1C. Revival](https://codeforces.me/contest/2239/problem/C)↵
↵
Author: [user:Gold14526,2026-06-27] Preparation: [user:Gold14526,2026-06-27]↵
↵
<spoiler summary="Hint 1">↵
Consider determining all the numbers from back to front.↵
</spoiler>↵
↵
<spoiler summary="Hint 2">↵
When you determine a number, subtract $1$ from all previous values that are greater than this number. This way, all $p$ values decrease by one, while all $s$ values remain unchanged. Now you only need to solve the problem of determining the last number.↵
</spoiler>↵
↵
<spoiler summary="Solution">↵
[tutorial:2239C]↵
</spoiler>↵
↵
### [Div1D. Hunting the Beast](https://codeforces.me/contest/2239/problem/D)↵
↵
Author: [user:Milkcat2009,2026-06-27] Preparation: [user:Milkcat2009,2026-06-27]↵
↵
<spoiler summary="Hint 1">↵
By symmetry, all vertices are equivalent. Therefore, we only need to calculate the number of graphs in which a specific set is successful, and then multiply by $\binom{n}{m}$.↵
</spoiler>↵
↵
<spoiler summary="Hint 2">↵
Let the nodes in the set be key nodes and the remaining nodes be non-key nodes. Consider the condition for the set to be successful and use the Principle of Inclusion-Exclusion to handle these conditions.↵
</spoiler>↵
↵
<spoiler summary="Hint 3">↵
You might need to calculate the following: $n$ vertices form a set of disjoint cycles without self-loops. If there are $k$ cycles, the contribution is $(-1)^k$. Find the sum of contributions over all possible configurations.↵
↵
The answer is $1-n$, which you can try to prove.↵
</spoiler>↵
↵
<spoiler summary="Hint 4">↵
Use the Binomial Theorem to simplify the sum.↵
</spoiler>↵
↵
<spoiler summary="Solution">↵
[tutorial:2239D]↵
</spoiler>↵
↵
### [Div1E. The end of this world,](https://codeforces.me/contest/2239/problem/E)↵
↵
Author: [user:Gold14526,2026-06-27] Preparation: [user:Gold14526,2026-06-27]↵
↵
↵
<spoiler summary="Hint 1">↵
Notice that the problem can be transformed as follows: the $i$-th edge appears during the time interval $[\mathrm{low}_i, w_i]$. For each vertex, compute the maximum value of the departure time plus the weight of the destination vertex.↵
</spoiler>↵
↵
<spoiler summary="Hint 2">↵
Consider doing the transitions from back to front.↵
</spoiler>↵
↵
<spoiler summary="Hint 3">↵
We only need to support the following operations:↵
↵
- Add and delete edges;↵
- Query the maximum value in a connected component;↵
- Take the max of all weights in a connected component with a given number.↵
</spoiler>↵
↵
<spoiler summary="Hint 4">↵
Consider modifying the dynamic graph connectivity approach.↵
</spoiler>↵
↵
<spoiler summary="Solution">↵
[tutorial:2239E]↵
</spoiler>↵
↵
### [Div1F. Colorful Works](https://codeforces.me/contest/2239/problem/F)↵
↵
Author: [user:Milkcat2009,2026-06-27] Preparation: [user:Milkcat2009,2026-06-27]↵
↵
<spoiler summary="Hint 1">↵
Consider the case where $l_i=0$.↵
</spoiler>↵
↵
<spoiler summary="Hint 2">↵
Just Consider the most straightforward DP approach, and then try to find some patterns.↵
</spoiler>↵
↵
<spoiler summary="Hint 3">↵
Try transforming the modulo $2$ counting DP into a game and solve it.↵
</spoiler>↵
↵
<spoiler summary="Hint 4">↵
You should already know the answer for $l_i=0$; try using the Principle of Inclusion-Exclusion to count.↵
</spoiler>↵
↵
<spoiler summary="Hint 5">↵
Enumerate which element is strictly greater than half of the total sum.↵
</spoiler>↵
↵
<spoiler summary="Hint 6">↵
You should already know the $O(nm/w)$ algorithm. Consider that, under modulo $2$, we have $(1+x^k)^2=1+x^{2k}$.↵
</spoiler>↵
↵
<spoiler summary="Solution">↵
[tutorial:2239F]↵
</spoiler>↵
↵

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en30 English Milkcat2009 2026-06-28 06:21:18 38465 Add codes.
en29 English cadmiumky 2026-06-27 22:37:08 71
en28 English cadmiumky 2026-06-27 22:36:09 553
en27 English cadmiumky 2026-06-27 22:35:27 18 Tiny change: 'lution">\n</spoile' -> 'lution">\n[tutorial:2240B]\n</spoile'
en26 English cadmiumky 2026-06-27 22:35:07 18 Tiny change: 'lution">\n[tutorial:2240B]\n</spoile' -> 'lution">\n</spoile'
en25 English Milkcat2009 2026-06-27 20:06:56 0 (published)
en24 English Milkcat2009 2026-06-27 18:41:39 47
en23 English Milkcat2009 2026-06-27 16:10:45 81
en22 English Milkcat2009 2026-06-27 16:08:40 19
en21 English Gold14526 2026-06-27 16:06:04 12
en20 English Gold14526 2026-06-27 16:05:26 1170
en19 English Gold14526 2026-06-27 15:54:54 326
en18 English Gold14526 2026-06-27 15:48:12 108
en17 English Milkcat2009 2026-06-27 15:42:03 3 Tiny change: 'answer for $l_i​=0$; try u' -> 'answer for $l_i=0$; try u'
en16 English Milkcat2009 2026-06-27 15:40:55 206
en15 English Milkcat2009 2026-06-27 08:25:11 332
en14 English Milkcat2009 2026-06-27 08:22:56 317
en13 English Milkcat2009 2026-06-27 08:22:27 985
en12 English Milkcat2009 2026-06-27 08:16:21 218
en11 English Milkcat2009 2026-06-27 08:12:39 1015
en10 English Milkcat2009 2026-06-27 07:57:07 158
en9 English Milkcat2009 2026-06-27 07:56:24 151
en8 English Milkcat2009 2026-06-27 07:56:08 21
en7 English Milkcat2009 2026-06-27 07:55:47 37
en6 English Milkcat2009 2026-06-27 07:53:52 781
en5 English Milkcat2009 2026-06-27 07:51:41 80
en4 English Milkcat2009 2026-06-27 07:50:28 791
en3 English Milkcat2009 2026-06-27 07:48:19 135
en2 English Milkcat2009 2026-06-27 07:44:39 17 Tiny change: '1' -> '[tutorial:2239A]'
en1 English Milkcat2009 2026-06-27 07:43:16 2 Initial revision (saved to drafts)