All editorial codes contain solutions wrapped in classes. We'll only paste the class solely as plaintext in the solution code section (along with the AC submission link). You might want to see the code template here.
#include <bits/stdc++.h>
using namespace std;
namespace solution {
bool hasMultipleTests = true;
void preprocess() {
// something
}
void input(int testcase) {
// something
}
void solve(int testcase) {
// something
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
solution::preprocess();
int t = 1;
if (solution::hasMultipleTests) cin >> t;
for (int testcase=1; testcase<=t; testcase++) {
solution::input(testcase);
solution::solve(testcase);
}
return 0;
}
import sys
input = sys.stdin.readline
class Solution:
hasMultipleTests = True
@classmethod
def preprocess(cls):
pass
@classmethod
def input(cls, testcase):
pass
@classmethod
def solve(cls, testcase):
pass
# end Solution
if __name__ == '__main__':
Solution.preprocess()
t = int(input()) if Solution.hasMultipleTests else 1
for testcase in range(1, t+1):
Solution.input(testcase)
Solution.solve(testcase)
Also, solution codes will be posted after system testing, to ensure all codes used here guarantee AC.
[problem:2032A]
Author: thanhchauns2
Development: thanhchauns2, Sagita_Phoenix
Editorialist: AkiLotus
Imagine every cell in the board has a pawn, except the one with the half-rook. For each set of $$$3$$$ directions chosen, how many pawns can you take at maximum?
Refer to hint #1. Do you find any characteristic traits distinguishing those pawns that have been taken and those that haven't?
[tutorial:2032A]
Submission link: TBD
// TBD
Submission link: TBD
# TBD
[problem:2032B]
Author: Kuroni
Development: AkiLotus
Editorialist: AkiLotus
There is always exactly one solution for $$$n = 1$$$. For $$$n \ge 3$$$, for which $$$k$$$ should there be no solution at all?
Try to find a solution with $$$m = 3$$$; i.e., the partition contains $$$3$$$ subarrays. Which numbers should be guaranteed to exist in each subarray?
Since $$$n$$$ is odd, if you know two subarray sizes are odd, clearly the last one would also be odd. Is there a way to fix desired sizes for two out of three subarrays?
Without loss of generality, assume $$$k - 1 \le n - k$$$. Try to fix the sizes of two first subarrays.
[tutorial:2032B]
Submission link: TBD
// TBD
Submission link: TBD
# TBD
[problem:2032C]
Author: AkiLotus
Development: AkiLotus
Editorialist: AkiLotus
Without loss of generality, you can rewrite the triangle inequality into a much more compacted form if the side lengths are properly ordered.
Given four integers $$$a \le b \le c \le d$$$, if $$$(a, b, d)$$$ are side lengths of a non-degenerate triangle, so does $$$(a, b, c)$$$.
Given four integers $$$a \le b \le c \le d$$$, if $$$(a, b, d)$$$ are side lengths of a non-degenerate triangle, so does $$$(a, c, d)$$$.
Given four integers $$$a \le b \le c \le d$$$, if $$$(a, b, d)$$$ are side lengths of a non-degenerate triangle, so does $$$(b, c, d)$$$.
To make a sorted array $$$[b_1, b_2, \ldots, b_m] \space (m \ge 3)$$$ satisfy the problem, we must ensure that $$$b_1 + b_2 > b_m$$$.
Fix the result array to have two minimas and one maxima at respectively $$$a_x$$$, $$$a_y$$$ and $$$a_z$$$. How many operations are required to do so?
Is there a fast and optimal way to try all possible $$$(a_x, a_y, a_z)$$$ triplets?
[tutorial:2032C]
Submission link: TBD
// TBD
Submission link: TBD
# TBD
[problem:2032D]
Author: AkiLotus
Development: AkiLotus
Editorialist: AkiLotus
There are many specific constraints on the system tree.
First, notice that $$$1 \le x \le y \le n-1$$$ if and only if $$$p_x \le p_y$$$. Draw a few trees with this constraint and start pointing your finger on the nodes from $$$0$$$ to $$$n-1$$$. Notice the pattern your finger is making.
Incorporate hint #1 with the fact that the "tentacles" of the Genokraken are just paths. Try to draw more detailed conclusion about that pattern.
Is there a way to know how many tentacles there are?
What use could we make of the fact that node $$$1$$$ has exactly two adjacent nodes?
The query limit is very small. Is there a way to query that (at least partially of) the information obtained in each query should determine a node?
For each "tentacle", can we know when its path has ended? How many queries should it take?
[tutorial:2032D]
Submission link: TBD
// TBD
Submission link: TBD
# TBD
[problem:2032E]
Author: thanhchauns2
Development: thanhchauns2, Sagita_Phoenix
Editorialist: AkiLotus
TBD
[tutorial:2032E]
Submission link: TBD
// TBD
Submission link: TBD
# TBD
[problem:2032F]
Author: MofK
Development: MofK, AkiLotus
Editorialist: MofK, AkiLotus
TBD
[tutorial:2032F]
Submission link: TBD
// TBD
Submission link: TBD
# TBD