Solutions for the 23rd CJLU ACM Team Contest

Jun 19, 2026

590 words

3 min read

Algorithm Solutions

Overview

This post is the English companion page for my Chinese write-up of the 23rd China Jiliang University ACM Team Contest.

The original Chinese version contains the full A-N solution notes, including problem summaries, constraints, main ideas, correctness arguments, complexity analysis, and reference code. This English version keeps a compact contest overview and a problem-by-problem index for readers who browse the English site.

Contest Summary

The contest contains 14 problems, labeled A through N. The problem set covers simulation, elementary number theory, constructive algorithms, tree DP, rerooting DP, shortest paths, disjoint set union, dynamic programming, and combinatorial game theory.

The Codeforces ratings below are subjective training estimates, not official difficulty ratings.

Difficulty And Tags

ProblemTitleDifficultyCF EstimateTags
ACoin ClassificationMedium-Hard1900Interactive, classification, decision strategy
BAgent Execution Plan TreeHard2100Tree DP, rerooting DP, combinatorics, modular inverse
CWhy Birds Can FlyEasy900Number theory, gcd, prime factors, enumeration
DGTNH?Medium1600Shortest path, Dijkstra, virtual nodes
EMatrix ConstructionHard2300Construction, xor permutation, complete mapping
FWhy Does Life SleepEasy800Simulation, adjacent differences, boundary checks
GACMBTI StringHard2200Construction, subsequences, state compression, search
HWith This Flame, Cut Through EverythingVery Hard2400Combinatorial games, permutation counting, math
IAll Past Lives Are EmptyEasy800Divisibility, basic I/O
JAfter The Snow MeltsMedium1700Offline processing, DSU, grid connectivity
KTaibo Believes In LanGod’s Beacon Of HopeMedium-Hard1900Dynamic programming, state optimization, decision process
LTen Million First MeetingsSimple1200Prefix sums, constructive checking, non-negative arrays
MThen, Toward TomorrowSimple1000Construction, permutations, inverse operations, lexicographic order
NDice Of FateEasy800Simulation, dice state maintenance

Solution Index

A. Coin Classification

The key is to maintain groups of coins already known to be equal. Pairwise comparisons split representatives into low-side candidates and high-side candidates, then each side can be separated with one representative because each side contains at most two possible classes.

B. Agent Execution Plan Tree

Root the tree and count valid topological orders with subtree sizes and multinomial coefficients. A rerooting step transfers the answer from one root to its neighbors by updating the corresponding subtree contribution.

C. Why Birds Can Fly

The task can be reduced to checking candidate numbers against gcd and prime-factor constraints. Enumerating candidates in increasing order gives the smallest valid answer.

D. GTNH?

Same-color jumps can be compressed by adding virtual color nodes. After that, the problem becomes a shortest-path problem on the expanded graph and can be solved with Dijkstra.

E. Matrix Construction

The construction relies on xor permutations and complete mappings. The main difficulty is arranging values so that every row and column satisfies the required xor property.

F. Why Does Life Sleep

Scan the important time points and adjacent differences. The answer follows from direct simulation and careful boundary handling.

G. ACMBTI String

The goal is to control which subsequence patterns appear. A state-compressed search or constructive enumeration can track the 16 possible patterns and build a valid string.

H. With This Flame, Cut Through Everything

First analyze the winning condition of the game, then count the permutations that preserve optimal play. The counting part is the main mathematical difficulty.

I. All Past Lives Are Empty

This is a straightforward divisibility problem: output the quotient a / b under the promised condition.

J. After The Snow Melts

Process water levels offline in reverse. Instead of removing cells as the water rises, add cells back and maintain connected components with DSU.

K. Taibo Believes In LanGod’s Beacon Of Hope

The constraints allow dynamic programming over optimized states. The transition models the best decision under the card and status effects.

L. Ten Million First Meetings

Use prefix sums and constructive conditions to decide whether the array can be rearranged to satisfy all constraints.

M. Then, Toward Tomorrow

Handle cases separately and construct the permutation directly. The inverse-operation view helps keep the final result lexicographically controlled.

N. Dice Of Fate

Maintain the six faces of the dice and update them after every operation. The solution is a direct state simulation.

Note

For the complete explanations and reference code, see the Chinese version of this post.

Solutions for the 23rd CJLU ACM Team Contest
Published on
Jun 19, 2026

Enter keywords to start searching