2026 ICPC Asia Seoul Regional Preliminary Solution Sketches
Disclaimer: This is an unofficial analysis of some possible ways to solve the problems of the 2026 ICPC Asia Seoul Regional Preliminary. They are not intended to give complete solutions, but rather to outline some approaches that can be used to solve the problems. If you find an error, please send me an email about it.
K. Square
My solution: 145 bytes.
Let be the vector of one side of the square. The other side can be , so its area is .
Hence, the answer is YES if and only if is a sum of two squares. This can be checked in .
G. Korean Characters
My solution: 404 bytes.
Scan the string from right to left. If the last letter is a vowel, the last Korean character must have length ; otherwise, it must have length .
Check whether the corresponding letters form a valid consonant-vowel(-consonant) pattern, remove them, and repeat. If this is ever impossible, print -ERROR-.
This runs in .
H. Marathon
My solution: 322 bytes.
Binary search the answer .
For a section to have section risk at most , building requires security personnel. Thus, for a fixed , we only need to check whether some length- subarray has
Check this with a sliding window in , for a total of .
A. Citation Index
My solution: 393 bytes.
Cap every citation count at . Maintain the current h-index , the number of papers with at least citations, and the frequency of every capped citation count.
Since citation counts only increase, the h-index never decreases, and one update can increase it by at most one. After each update, is feasible exactly when there are at least papers with more than citations.
This gives time.
B. Coloring
My solution: 450 bytes.
Let , , , be the extrema among all endpoints. Up to swapping the two colors, an optimal pair of squares can be pushed to one of the two pairs of opposite corners of this bounding box without increasing their side lengths.
Fix the lower-left and upper-right corners. For each segment, try the two assignments of its endpoints to the two squares; each assignment gives the maximum of four distances to the corresponding sides of the bounding box. Take the better assignment independently for every segment, then take the maximum over all segments.
Reflect the -coordinates and repeat to handle the other diagonal pair of corners. The smaller of the two answers is optimal.
C. Convex Hull
My solution: 549 bytes.
Compute all-pairs shortest-path distances with Floyd--Warshall.
Maintain the current hull and a queue of vertices newly added to it. For a newly added vertex , for every vertex already in the hull and every vertex outside it, add if
Whenever a new vertex is added, process it in the same way. This computes the closure in time.
J. Secret Agent
My solution: 490 bytes.
Since no interval contains another and all endpoints are distinct, sorting the agents by starting point also sorts them by ending point.
For agent , let be the maximum capability sum of a valid relay ending at such that the penultimate agent, if it exists, ends no later than .
Suppose is immediately before in the relay. They must overlap, so
Every earlier agent must not overlap , so the best previous state is
This transition contributes to state of . Take prefix maxima over and add .
This gives an dynamic program.
D. Cross Roller
My solution: 1,227 bytes.
Any row or column containing a zero can never be selected by an operation.
Consider the operations in reverse. The last operation must correspond to a non-banned row and a non-banned column that are both monochromatic with the same nonzero color. Remove such a row and column and keep them as fixed anchors.
Afterwards, any remaining monochromatic row can be removed using the fixed column, and any remaining monochromatic column can be removed using the fixed row. Maintain color frequencies while removing rows and columns, and reverse the recorded operations at the end.
If a nonzero cell remains, the target pattern is impossible. The algorithm runs in time.
F. Interactive String Matching
My solution: 448 bytes.
Simulate KMP, using queries whenever a text character has to be compared with a pattern character.
The only additional difficulty is constructing the prefix function of , since direct comparisons between two characters of are unavailable. Whenever has to be compared with , use a position of that has already been proved equal to , and query that position against .
Construct the prefix function lazily only as far as needed by the current KMP state. The usual KMP amortization shows that the total number of queries is at most .
I. Pumpkin Friends
My solution: 908 bytes.
Process the deletions in reverse, so that pumpkins are added one by one. Each addition merges the alive segments on its left and right, and the increase in the joy score is exactly the number of valid intervals containing the newly added pumpkin.
Let be the prefix-sum array. Since all joy values are positive, for each endpoint we can precompute the range of opposite endpoints whose interval sum lies in .
When two segments are merged, iterate over the smaller side and count compatible endpoints on the larger side using these precomputed ranges. By the small-to-large argument, each position is scanned only times.
Thus all answers can be computed in time.
E. Eating Candies
My solution: 444 bytes.
Associate an integer value with every substring. Let be the maximum value reachable by a Bay move and the minimum value reachable by a Rei move, using and if the corresponding player has no move.
The value of the current substring is
These values can be computed by interval DP, since every move deletes either the leftmost or the rightmost candy.
The value of the whole game is the sum of the values of all skewers. If the sum is positive, Bay wins; if it is negative, Rei wins; if it is zero, the player who moves first loses.
The total running time is .