Educational Codeforces Round #105 Dogeforces - Disjoint set + Construction
Solution: Sort the salary. We build a dynamic disjoint set. In the beginning, there only be n lower-level employees. And the father of these employees is empty.…
Solution: Sort the salary. We build a dynamic disjoint set. In the beginning, there only be n lower-level employees. And the father of these employees is empty.…
Solution: Classic binary search problem. We only consider the positive part. The negative part can be similar.…
Solution: First of all, if $k$ is not an even number, there must be no answer. Define $map[i][j][d]$ (where $0 \leq d <4$) represents the side length of $(i,j)$ in four directions.…
Solution: First of all, Base on ci−ci−1≤ci+1−ci and pi−pi−1≥pi+1−pi we can roughly found that:…
A. Sum of 2050 Solution: Obviously $n$ must be divisible by 2050. Then every decimal digit of $\frac n {2050}$ should be composed of the corresponding...…
Solution: First of all, "The product of every subarray is equal to its LCM" means "All these numbers are mutually prime". "All these numbers are mutually prime" means "In all these numbers, the prime factors of any two numbers are different".…
Solution Define $sum=\sum_{i=1}^n a_i$. If $sum$ is a odd number, then of course no need remove anything.…
Solution: If the XOR sum of all numbers is 0. Then it must can make it. Because if and only if a[1]⊕a[2]⊕...⊕a[n−1]=a[n], the XOR sum is 0. So we can make the array as: (a[n],a[n]).…