NGPC 2022 Analysis
NGPC 2022 Analysis
Judge Notes
Statistics
10 problems.
104 teams.
C. Strong Passwords
Solution
G. Alligator Sky
Solution
(
⌊n/k⌋ · 2 if k divides n
Result =
⌊n/k⌋ · 2 + 1 otherwise
Solution (contd)
Solution (1/2)
Then traverse this path for k cells and put the end cell!
Solution (2/2)
nm
This works as 2 ≤ k ≤ 2 and in the contsruction, more than half
cells are free.
The traversal can be done via a BFS or just a while loop with
some if else.
Solution
Solution (contd.)
Solution
J. Wizard Duel
Solution
Solution (contd.)
Pi
For each info Pj = yx , we add two directed edges:
x
i to j with weight y
y
j to i with weight x
Solution (contd.)
D. Interesting Parenthesis
Solution
Solution (contd.)
Solution (contd.)
Complexity: O(N 2 ).
H. Plantik
Solution
Let us relabel the shooters (from 6th to 11th, then 1st to 5th) as
1st to 11th.
Solution (contd.)
Xi = Ai · (1 − Fi )
If both players score or miss, the shootout continues.
Yi = Ai · Fi + (1 − Ai ) · (1 − Fi )
Solution (contd.)
fi = Xi + Yi · fi+1
And additionally
Solution (contd.)
A. Half Measures
Solution
Solution (contd.)
Solution
Solution (contd.)
Solution (contd.)
n
⌊ x ⌋
X m n (c · x)!
dp(n, m, x) = dp(n − c · x, m − c, x − 1)
c c · x (x!)c
c=0
This may look like O(n4 ). But the number of total transition
is limited by O(nlgn). To proof this, fix n and m. For those
fixed n and m, the total transition will be
⌊ n1 ⌋ + ⌊ n2 ⌋ + ... + ⌊ nn ⌋. This is shaped by sum of harmonic
series which is nlogn.
Hence, total complexity will O(n3 logn).
Contributors