problem_id
stringlengths
1
66
category
stringclasses
2 values
statement
stringlengths
0
20.2k
config
stringlengths
20
380
0
algorithmic
# Pack the Polyominoes (Reflections Allowed) ## Problem You are given a set of n polyominoes placed on a unit square grid. Each polyomino consists of between 1 and 10 unit cells, connected edge-to-edge (4-connectivity). Your task is to place all polyominoes—allowing **rotations, reflections, and translations**—into an...
type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 2s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 70
1
algorithmic
Problem F: Treasure Packing A dragon has terrorized the region for decades, breathing fire and stealing treasures. A hero has decided to steal back the treasures and return them to the community. However, they drastically underestimated the size of the dragon's hoard, bringing only a single 25 liter bag, only strong e...
type: default # The time limit is now 1 second. time: 1s memory: 1024m # A custom checker is required for the special scoring. checker: chk.cc subtasks: - score: 100 n_cases: 3
10
algorithmic
Problem: Tree distance Time limit: 2 second Memory limit: 512 MB This is an interactive problem. Little Cyan Fish has a weighted tree of n verticies generated in the following way: - First, generate a random labeled tree: uniformly randomly select from all nn−2 possible labeled trees. - Then, independently assign r...
# Set the problem type to interactive type: interactive # Specify the interactor source file interactor: interactor.cc # Time and memory limits still apply to the contestant's solution time: 2s memory: 512m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3 # Looks for 1.in, 2.in, ... ...
101
algorithmic
Problem Name: Circuit Description: You are given a circuit board consisting of N component slots and R external switches. Each slot contains either an AND gate (&) or an OR gate (|). The actual type of each slot is hidden. Your task is to determine the true type of every slot by interacting with the judge. Specif...
# Set the problem type to interactive type: interactive # Specify the interactor source file interactor: interactor.cpp # Time and memory limits still apply to the contestant's solution time: 5s memory: 1024m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3 # Looks for 1.in, 2.in, .....
104
algorithmic
Time Limit: 2 s Memory Limit: 256 MB This is an interactive problem. There are n students, having roll numbers 1 to n. Mr. 1048576 knows that exactly 1 student is absent today. In order to determine who is absent, he can ask some queries to the class. In each query, he provide two integers l and r (1≤l≤r≤n) and all stu...
type: interactive time: 2s memory: 256m # A custom checker is required for the special scoring. checker: interactor.cc subtasks: - score: 100 n_cases: 3
106
algorithmic
Hidden Bipartite Graph This is an I/O interactive problem. I/O interaction refers to interactive problems, where the program communicates with a special judge during execution instead of producing all output at once. In these problems, the program sends queries (output) to the judge and must immediately read responses...
# Set the problem type to interactive type: interactive # Specify the interactor source file interactor: interactor.cpp # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3 # Looks for 1.in, 2.in, .....
107
algorithmic
F. Guess Divisors Count time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input output: standard output This is an I/O interactive problem. I/O interaction refers to interactive problems, where the program communicates with a special judge during execution instead of producing all ou...
# Set the problem type to interactive type: interactive # Specify the interactor source file interactor: interactor.cpp # Time and memory limits still apply to the contestant's solution time: 2s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3 # Looks for 1.in, 2.in, ......
108
algorithmic
time limit per test: 1 second memory limit per test: 256 megabytes This is an interactive problem. Zookeeper has set up a special lock for the rabbit enclosure. The lock consists of n concentric rings numbered from 0 to n−1. The innermost ring is ring 0 and the outermost ring is ring n−1. All rings are split equally in...
type: interactive time: 1s memory: 256m # A custom checker is required for the special scoring. checker: interactor.cc subtasks: - score: 100 n_cases: 3
109
algorithmic
Time Limit: 1 second Memory Limit: 128 MB Description A knight moves on an N×N chessboard and must try to visit every square exactly once (no revisiting). Given the board size and the starting square, output the longest possible path. Note that this problem doesn't require a full complete path. It only asks you to fin...
type: default time: 1s memory: 128m checker: chk.cc subtasks: - score: 100 n_cases: 3 # auto-picks 1.in…10.in and (logically) 1.out…10.out, # but your JudgeEngine first tries "X.ans" before "X.out".
11
algorithmic
# Palindrome Path **Input file:** standard input **Output file:** standard output **Time limit:** 1 second **Memory limit:** 256 megabytes ## Problem Description Given an \( n \times m \) grid maze, each cell \((i,j)\) is either blank or blocked. George starts at cell \((sr,sc)\) and needs to visit all blank...
type: default time: 2s memory: 512m checker: chk.cc cheker_type: testlib subtasks: - score: 100 n_cases: 3
110
algorithmic
TIME LIMIT: 1 minute MEMORY LIMIT: 814 MB Description Create and print an 8 × 14 table (grid) whose cells contain only digits 0–9. We say a number can be “read” from the grid if it can be formed as follows: - Start at any cell in the grid. - Move to an adjacent cell each step, where adjacency includes up, down, left,...
type: default time: 1s memory: 128m checker: chk.cc subtasks: - score: 100 n_cases: 3 # auto-picks 1.in…10.in and (logically) 1.out…10.out, # but your JudgeEngine first tries "X.ans" before "X.out".
111
algorithmic
Problem: Distinct Pairwise XOR Set Time Limit: 1 second Memory Limit: 512 MB Description Given an integer n, find a subset S ⊆ {1, 2, ..., n} such that: 1) For all pairs (a, b) with a, b ∈ S and a < b, the values (a XOR b) are all distinct (i.e., no two different unordered pairs produce the same XOR). 2) |S| ≥ floor(...
type: default time: 1s memory: 128m checker: chk.cc subtasks: - score: 100 n_cases: 3 # auto-picks 1.in…10.in and (logically) 1.out…10.out, # but your JudgeEngine first tries "X.ans" before "X.out".
112
algorithmic
SphereSpread You are given an integer n. You need to place n points in 3D space such that all points lie within or on a unit sphere centered at the origin (i.e., the distance from each point to the origin is at most 1). Your goal is to maximize the minimum pairwise distance between any two points. In other words, yo...
type: default time: 2s memory: 512m checker: chk.cc subtasks: - score: 100 n_cases: 3
113
algorithmic
Problem There are $N$ balls numbered from $1$ to $N$, and three baskets numbered from $1$ to $3$. Initially, all $N$ balls are in basket $1$. Balls can be moved from one basket to another according to the following rules: When the balls in a basket are arranged in numerical order, the ball in the middle is called the...
type: default time: 1s memory: 512m subtasks: - score: 100 n_cases: 3 checker: chk.cc checker_type: testlib filename: std.cc
117
algorithmic
Line The territory of country P is a square with side length 2 * 10^12. The origin is placed at the center of the square, and a Cartesian coordinate system is established so that the sides of the square are parallel to the axes. Thus, the territory of country P is the region [-10^12, 10^12] × [-10^12, 10^12]. The...
# Set the problem type to interactive type: interactive # Specify the interactor source file interactor: interactor.cpp # Time and memory limits still apply to the contestant's solution time: 1s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3 # Looks for 1.in, 2.in, ......
119
algorithmic
Operators - You are given n operators op₁, op₂, …, opₙ. For an input sequence of n+1 integers a₀, a₁, …, aₙ, you need to compute the following value: (((…(a₀ op₁ a₁) op₂ a₂) op₃ a₃)… opₙ aₙ) mod (10⁹ + 7). - For any 0 ≤ i ≤ n, we have 0 ≤ aᵢ < 10⁹ + 7. - For any 1 ≤ i ≤ n, opᵢ ∈ {+, ×}; that is, each ope...
# Set the problem type to interactive type: interactive # Specify the interactor source file interactor: interactor.cpp # Time and memory limits still apply to the contestant's solution time: 1s memory: 512m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3 # Looks for 1.in, 2.in, ......
120
algorithmic
“Da Bai” (Interactive) There is an undirected simple graph with 100 vertices. In each query, you can ask the interactor by choosing three distinct vertices a, b, c. The interactor will tell you how many edges exist among the three vertices {a, b, c}, i.e., the number of edges in the induced sub-graph on {a, b, c}. ...
# Set the problem type to interactive type: interactive # Specify the interactor source file interactor: interactor.cpp # Time and memory limits still apply to the contestant's solution time: 1s memory: 512m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3 # Looks for 1.in, 2.in, ......
121
algorithmic
DNA Matching Time Limit: 2 s Memory Limit: 512 MB A string s is called a “DNA sequence” if and only if s consists only of the characters A, C, G, T. You are given m strings s1, s2, ..., sm, each of length n, and each of them consists only of the characters A, C, G, T, ?. For a DNA sequence t of length n, we call t ...
# Set the problem type to interactive type: default # Specify the interactor source file interactor: chk.cc # Time and memory limits still apply to the contestant's solution time: 2s memory: 512m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3 # Looks for 1.in, 2.in, ... 5.in
122
algorithmic
This is an interactive problem. The RiOI Team has recently developed a text editor named RiOI Editor. The editor works with exactly one integer parameter W — the width of each line. It is known that 1≤W≤10^5 . As you cannot understand the RiOI Language, from your point of view, words differ from each other only by t...
type: interactive time: 3s memory: 512m subtasks: - score: 100 n_cases: 3 interactor: interactor.cc checker_type: testlib
123
algorithmic
Time limit per test: 1 second Memory limit per test: 256 megabytes Goal ----- There is a hidden integer x with 1 ≤ x ≤ n that you must determine. What you can do ---------------- 1) Ask membership questions (up to 53 total): - Choose any non-empty set S ⊆ {1, 2, …, n}. - Ask whether x ∈ S. - The judge replie...
# Set the problem type to interactive type: interactive # Specify the interactor source file interactor: interactor.cc # Time and memory limits still apply to the contestant's solution time: 4s memory: 1024m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3 # Looks for 1.in, 2.in, ......
124
algorithmic
AveragePermutation This is an interactive problem. There is a hidden permutation p of n, where n is even. You want to discover this permutation using queries. Each query consists of asking about k specific positions a1, a2, ..., ak. The query is answered with 1 if the average of the elements at these positions is an ...
type: interactive interactor: interactor.cc time: 4s memory: 256m subtasks: - score: 100 n_cases: 3
125
algorithmic
Time Limit: 1 second Memory Limit: 256 MB Overview This is an INTERACTIVE PROBLEM. There are N kinds of minerals. For each kind there are exactly 2 slices, for a total of 2N slices numbered 1..2N. The judge fixes a hidden pairing: for each kind, the two slices of that kind form one pair. Your task is to determine all ...
# Set the problem type to interactive type: interactive # Specify the interactor source file interactor: interactor.cc # Time and memory limits still apply to the contestant's solution time: 20s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3 # Looks for 1.in, 2.in, ......
127
algorithmic
Time Limit: 1 second Memory Limit: 256 mb Interactive Problem YOU MUST USE INTERACTIVE FORMAT FOR THIS PROBLEM. You are standing in front of a row of n boxes, labeled 0 through n−1 from left to right. Each box contains a prize that cannot be seen until the box is opened. There are v ≥ 2 different prize types, number...
# Set the problem type to interactive type: interactive # Specify the interactor source file interactor: interactor.cc # Time and memory limits still apply to the contestant's solution time: 8s # Giving buffer for grading time memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_case...
13
algorithmic
Time limit: 2 seconds Memory limit: 1024 megabytes This is an interactive problem. A mischievous robot is navigating an infinitely large 2D grid. However, its movement is confined to the first quadrant, meaning its coordinates (x, y) must always satisfy x > 0 and y > 0. Initially, the robot is located at grid coordinat...
type: interactive time: 2s memory: 1024m # A custom checker is required for the special scoring. checker: interactor.cc subtasks: - score: 100 n_cases: 3
132
algorithmic
time limit per test: 0.25 second memory limit per test: 512 megabytes This is an interactive problem. You have 𝑅 vacuum cleaner robots left over from your trade with your fellow contestants. You want to use these robots to locate the two chairmen. You can instruct each robot to scout several of 1000 positions where th...
type: interactive time: 0.25s memory: 512m # A custom checker is required for the special scoring. checker: interactor.cc subtasks: - score: 100 n_cases: 3
133
algorithmic
Time limit:20 second Memory limit:1024 megabytes One day, Little Z selected n points on a piece of paper and connected them pairwise with a pencil to form n*(n-1)/2 line segments. Due to the thinness of the pencil, it can be assumed that the width of these line segments is 0. Looking at these line segments, Little Z fe...
type: default time: 20s memory: 1024m # A custom checker is required for the special scoring. checker: chk.cc subtasks: - score: 100 n_cases: 3
134
algorithmic
Guess Number This is an interactive problem. Vasya has thought of two secret integers a and b, both in the range [1, n]. Your task is to determine these two numbers by asking queries. Each query consists of two integers x and y (both in the range [1, n]). The interactor will respond with one of the following: - 0: ...
type: interactive interactor: interactor.cc time: 2s memory: 512m subtasks: - score: 100 n_cases: 3
135
algorithmic
Problem Type: INTERACTIVE(STANDARD SOLUTIONS WILL NOT WORK) There are many legends concerning the Leaning Tower of Toruń. The wall of the tower is a circle with N ≥ 3 evenly spaced doors (in other words, the doors are the vertices of a regular N-gon). The doors are numbered from 0 to N−1, but in a random order. Please...
# Set the problem type to interactive type: interactive # Specify the interactor source file interactor: interactor.cc # Time and memory limits still apply to the contestant's solution time: 2s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3 # Looks for 1.in, 2.in, ... ...
137
algorithmic
Title: Kangaroos Goal You must print a grid (“map”) on which a simple multi-agent movement game is played. The judge will run 500 random control sequences on your map. Your map is accepted if at least 125 of those sequences fail to gather all agents into a single cell. World - The world is an n-by-m grid (1 ≤ n, m ≤ ...
type: default # The time limit is now 1 second. time: 1s memory: 512m # A custom checker is required for the special scoring. checker: chk.cc subtasks: - score: 100 n_cases: 1
138
algorithmic
### Problem C. Fabulous Fungus Frenzy As the Traveler in the game Genshin Impact, you are exploring Sumeru. You are invited to the Nilotpala Cup Beast Tamers Tournament. To win, you must pass the Coruscating Potential challenge to cultivate Fungi. During this challenge, you must use Floral Jellies to form blends for ...
type: default time: 5s memory: 1024m subtasks: - score: 100 n_cases: 3 checker: chk.cpp checker_type: testlib
14
algorithmic
Problem Statement There are n vertices forming a simple cycle. It is guaranteed that the graph satisfies the following property: - There exists a permutation p of length n such that for every i (1 ≤ i < n), the vertices p_i and p_{i+1} are adjacent in the graph, and also p_n and p_1 are adjacent. At the beginning of...
# Set the problem type to interactive type: interactive # Specify the interactor source file interactor: interactor.cpp # Time and memory limits still apply to the contestant's solution time: 5s memory: 1024m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3 # Looks for 1.in, 2.in, .....
140
algorithmic
Mineral Deposits (interactive) You handle signal processing for an extra-terrestrial mining company. Your vessel is approaching an asteroid. Preliminary scans show the presence of k mineral deposits on the asteroid, but their precise locations are unknown. The surface of the asteroid is modeled as a grid of integer c...
# Set the problem type to interactive type: interactive # Specify the interactor source file interactor: interactor.cc # Time and memory limits still apply to the contestant's solution time: 1s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3 # Looks for 1.in, 2.in, ... ...
141
algorithmic
Bakery Survey This is an interactive problem. Your city has n bakeries (where n is a power of 2), and bakery i specializes in one type of cake a_i. You want to determine d — the number of distinct cake types available in the city. You don't know the values of a_1, ..., a_n. However, your friend can help you by tast...
type: interactive interactor: interactor.cc time: 4s memory: 512m subtasks: - score: 100 n_cases: 3
142
algorithmic
Ball Game You are given n+1 poles numbered from 1 to n+1. Initially, poles 1 through n each contain m balls stacked vertically, while pole n+1 is empty. There are n*m balls in total, with n different colors, where each color appears exactly m times. Your task is to rearrange the balls so that all balls of the same co...
type: default time: 4s memory: 512m checker: chk.cc subtasks: - score: 100 n_cases: 3
143
algorithmic
Problem: Texas Hold’em Training (Terminal I/O Interactive) Time limit: 10 seconds Memory limit: 512 MB Overview You will write a program that plays a large number of very simplified heads-up Texas Hold’em hands against a fixed opponent policy. The judge runs the game and reveals exactly the information you are allowe...
# Set the problem type to interactive type: interactive # Specify the interactor source file interactor: interactor.cc # Time and memory limits still apply to the contestant's solution time: 100s memory: 512m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3 # Looks for 1.in, 2.in, .....
144
algorithmic
Find Median This is an interactive problem. There is a hidden permutation p of length n, where n is even. You are allowed to make queries by choosing a subsequence of indices with even length k (where 4 ≤ k ≤ n). For a chosen subsequence, the interactor will return the two median values. For a subsequence of even len...
type: interactive interactor: interactor.cc time: 4s memory: 512m subtasks: - score: 100 n_cases: 3
145
algorithmic
# Meituan Cup Warm-up Problem — Number Loop This year's Meituan Cup warm-up problem is a **Number Loop**. When designing this problem, Suanxie first selected the following template, ensuring that the puzzle must contain the two patterns **MT** and **PKU**. The next step is to replace all `?` in the template with dig...
type: default time: 3s memory: 1024m checker: checker.cpp cheker_type: testlib subtasks: - score: 100 n_cases: 2
147
algorithmic
Problem Statement -------- AtCoder has decided to place web advertisements of $n$ companies on the top page. The space for placing advertisements is a square of size 10000 x 10000. The space for each company must be an axis-parallel rectangle with positive area, and the coordinates of the vertices must be integer value...
type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
148
algorithmic
Problem Statement -------- There is a floor consisting of $50\times 50$ squares. The floor is covered with rectangular tiles without any gaps. Each tile has a size of either $1\times 1$, $1\times 2$, or $2\times 1$ squares. Let $(0, 0)$ denote the top-left square, and $(i, j)$ denote the square at the $i$-th row from t...
type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
149
algorithmic
Story -------- AtCoder is developing a route navigation application that utilizes shortest path algorithms. The service area is represented as a road network of 30x30 vertices connected in a grid. When a user specifies the vertex of the current location and the vertex of the destination, the app will output the shortes...
 type: interactive interactor: interactor.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
15
algorithmic
Problem Statement You are given a sequence p of length n, which is a permutation of the numbers 1, 2, ..., n. Your goal is to make the permutation lexicographically as small as possible by performing a specific operation at most 4n times, and then minimize the number of operations needed to reach that. More specific...
type: default # The time limit is now 1 second. time: 1s memory: 512m # A custom checker is required for the special scoring. checker: chk.cc subtasks: - score: 100 n_cases: 3
150
algorithmic
Story -------- Human genetic information is recorded in DNA with a double helix structure and is represented by a very long string consisting of four characters, `A`, `G`, `C`, and `T`. Recently, alien cells were found in a meteorite. As a result of research, it was found that the genetic information of this alien is r...
type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
151
algorithmic
Story -------- To solve the shortage of police officers, the Takahashi City Police Department has decided to introduce automated patrols with unmanned patrol cars. The unmanned patrol car is equipped with a high-resolution omnidirectional camera on the roof, which can see the entire road at once in a straight line from...
type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
152
algorithmic
Problem Statement -------- AtCoder Inc. operates a food delivery service, AtCoder Foods, that leisurely delivers food that tastes good even if it gets cold. This service receives a large number of delivery orders in advance, and processes multiple deliveries simultaneously to improve efficiency. The current service are...
type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
153
algorithmic
Story -------- AtCoder, a big tech company, has many offices. In order to securely share super-secret information of problem statements for future contests, we decided to set up private lines using quantum cryptography between the offices. There are several candidates for office pairs that can be connected by private l...
 type: interactive interactor: interactor.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
154
algorithmic
Story -------- AtCoder's CEO, Takahashi, loves animals and has a number of pets running free in the AtCoder office. AtCoder's employees have trouble with the pets interrupting their work, so they have decided to place partitions in the office to create a space where pets cannot come in. Please create as large a space a...
type: interactive interactor: interactor.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
155
algorithmic
Story -------- A map like in the figure below is given. Takahashi's home is located in the square with the red circle, and AtCoder's office is located in the square with the blue circle. He memorizes his commuting route to the office as a string of characters such as DRDR, which means Down, Right, Down, and Right. Beca...
type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
156
algorithmic
Story -------- Takahashi, who loves loop lines, is playing with a toy train. As shown in the figure below, this toy consists of square tiles containing railroad lines. By rotating the tiles, he can connect lines and play with toy trains running on the lines. Because Takahashi has two toy trains, please create two large...
type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
157
algorithmic
Story -------- Takahashi loves puzzles and is playing with the following famous sliding puzzle. > There are $N^2-1$ tiles on an $N \times N$ board. > There is a single empty square, and you can slide an adjacent tile in any of the four directions into the empty square. > Some picture is divided into each tile. By repea...
type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
158
algorithmic
Story -------- To celebrate the 10th anniversary of AtCoder Inc., we plan to hold an anniversary party with users invited. At the party, CEO Takahashi will cut a giant cake with a knife in straight lines and distribute pieces to the attendees. There are many strawberries on the cake, and he wants to distribute a piece ...
type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
159
algorithmic
Problem Statement -------- RectJoin is the following single-player game played with square grid paper and pencil. ![example](./images/example.gif) Let $(0, 0)$ be the coordinates of the lower left corner of the grid paper, with the $x$-axis to the right and the $y$-axis to the top. The coordinates of the upper right...
 type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
16
algorithmic
Problem: Identify Chord This is an interactive problem. Grammy has an undirected cyclic graph of n (4 ≤ n ≤ 10^9) vertices numbered from 1 to n. An undirected cyclic graph is a graph of n vertices and n undirected edges that form one cycle. Specifically, there is a bidirectional edge between vertex i and vertex ((i m...
# Set the problem type to interactive type: interactive # Specify the interactor source file interactor: interactor.cpp # Time and memory limits still apply to the contestant's solution time: 5s memory: 1024m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3 # Looks for 1.in, 2.in, .....
160
algorithmic
Story -------- AtCoder's CEO Takahashi prepares for Halloween tomorrow. At AtCoder's Halloween party, Takahashi will dress up in disguise and receive a piece of candy from 100 employees in turn by saying, "trick or treat!" He prepares a square box that can contain $10\times 10$ pieces of candy in a grid pattern, and ea...
 type: interactive interactor: interactor.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
161
algorithmic
Story -------- AtCoder regularly broadcasts its official live broadcast "A-Da-Coder" on the Internet to provide the latest news and to interact with users. To reach a wider audience, CEO Takahashi decided to build a TV network to broadcast the live stream to all residents of AA City. The TV network of AA city is repre...
 type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
162
algorithmic
Problem Statement -------- There are $N(N+1)/2$ balls arranged in an $N$-tiered pyramid as shown in the figure below. Let $(0, 0)$ be the coordinates of the ball at the top of the pyramid, and let $(x,y)$ be the coordinates of the $y (0\leq y\leq x)$-th ball from the left in the $x (0\leq x-1)$-th tier from the top. ...
type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
163
algorithmic
Story -------- Mr. Takahashi, the mayor of Takahashi City, decided to draw a map of Takahashi City on the floor of the city hall lobby using colored square tiles. Takahashi City is divided into several wards, and in this map, each ward should be represented as a set of connected tiles of the same color. He commissioned...
type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
164
algorithmic
Story -------- AtCoder has $n$ cardboard boxes in a warehouse, which are divided into $m$ vertical stacks. Each box is labeled with a unique number from $1,\cdots,n$, and CEO Takahashi wants to carry them out of the warehouse one by one in ascending order of their numbers. In order to carry out a box, he needs to move ...
type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
165
algorithmic
Story -------- In Japan, a traditional calligraphy contest known as 'Kakizome Taikai' is held during the New Year. AtCoder's Kakizome Taikai is an event in which, instead of writing with a brush, each employee types on a keyboard with a special key layout and outputs his/her favorite string on a PC screen for presentat...
type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
166
algorithmic
Story -------- AtCoder frequently hosts onsite contests and has decided to build its own contest venue. The planned construction site is in a mountain area, and the ground must first be leveled. Leveling will involve using a dump truck, which incurs costs for loading, unloading, and transporting soil. Determine the met...
type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
167
algorithmic
Story -------- Takahashi is a skilled purse seine fisher. His fishing boat is equipped with state-of-the-art sonar, allowing him to accurately determine the positions of fish within the fishing area. Additionally, the boat is capable of high-speed movement, enabling him to assume that fish remain stationary while he se...
type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
168
algorithmic
Story -------- At the AtCoder office, preparations are underway for a slightly belated Christmas party. CEO Takahashi has decided to go cut down rooted trees to use as the Christmas trees. Each vertex in a rooted tree has a **beauty value**, and the party venue looks more attractive if beautiful vertices are located ...
type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
169
algorithmic
Story -------- Today, on February 2nd, the traditional Japanese event **Setsubun** is being celebrated in Japan. Setsubun is a ritual to ward off evil spirits and invite good fortune at the turning of the seasons. People chant "Oni wa soto!" ("Demons out!") while throwing roasted soybeans to drive away evil spirits (on...
type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
17
algorithmic
Permutation (Interactive Problem) Time limit: 10s Memory limit: 1024MB You are given an unknown permutation of length n. Your task is to determine the position of number n in this permutation. Interaction Protocol -------------------- To help you find the position of n, you may ask queries of the following form: ? ...
# Set the problem type to interactive type: interactive # Specify the interactor source file interactor: interactor.cpp # Time and memory limits still apply to the contestant's solution time: 10s memory: 1024m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3 # Looks for 1.in, 2.in, ....
170
algorithmic
Story -------- A company is currently aiming to create a comfortable working environment. It has decided to clean the office every week starting this April, when new employees join the company. However, assigning cleaning duties is not easy. There are various constraints, for example, the duty should not be concentrate...
type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
171
algorithmic
Problem Statement -------- There is a skating rink consisting of $N \times N$ squares. Let $(0, 0)$ be the coordinates of the top-left square, and $(i, j)$ be the coordinates of the square located $i$ squares down and $j$ squares to the right from there. All squares outside the $N \times N$ area are covered with blocks...
 type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
174
algorithmic
# Graph 3-Coloring ## Problem You are given an undirected graph with n vertices and m edges. Your task is to assign each vertex one of three colors. The objective is to minimize the number of conflicting edges. An edge is conflicting if its two endpoints have the same color. ## Input Format - Line 1: two integers ...
type: default time: 1s memory: 1024m subtasks: - score: 100 n_cases: 3 checker: chk.cc checker_type: testlib filename: std.cc
175
algorithmic
# 3-SAT ## Problem You are given a Boolean formula in CNF form, where each clause contains exactly three literals. Your task is to assign truth values to variables to satisfy as many clauses as possible. ## Input Format - Line 1: two integers n and m (1 ≤ n ≤ 3000, 0 ≤ m ≤ 2000000) - Next m lines: three integers ...
type: default time: 1s memory: 1024m subtasks: - score: 100 n_cases: 3 checker: chk.cc checker_type: testlib filename: std.cc
176
algorithmic
# 3-SAT ## Problem You are given a Boolean formula in CNF form, where each clause contains exactly three literals. Your task is to assign truth values to variables to satisfy as many clauses as possible. ## Input Format - Line 1: two integers n and m (1 ≤ n ≤ 1000, 0 ≤ m ≤ 10000) - Next m lines: three integers a ...
type: default time: 1s memory: 1024m subtasks: - score: 100 n_cases: 3 checker: chk.cc checker_type: testlib filename: std.cc
177
algorithmic
# Graph 3-Coloring ## Problem You are given an undirected graph with n vertices and m edges. Your task is to assign each vertex one of three colors. The objective is to minimize the number of conflicting edges. An edge is conflicting if its two endpoints have the same color. ## Input Format - Line 1: two integers ...
type: default time: 1s memory: 1024m subtasks: - score: 100 n_cases: 3 checker: chk.cc checker_type: testlib filename: std.cc
178
algorithmic
# 3-SAT ## Problem You are given a Boolean formula in CNF form, where each clause contains exactly three literals. Your task is to assign truth values to variables to satisfy as many clauses as possible. ## Input Format - Line 1: two integers n and m (1 ≤ n ≤ 50, 0 ≤ m ≤ 1000) - Next m lines: three integers a b c...
type: default time: 1s memory: 1024m subtasks: - score: 100 n_cases: 3 checker: chk.cc checker_type: testlib filename: std.cc
179
algorithmic
# Subset Sum ## Problem You are given a multiset of non-negative integers. Your task is to choose a subset whose sum is as close as possible to a given target value W. This is the classic Subset Sum problem, evaluated with a soft scoring rule. ## Input Format - Line 1: two integers n and W (1 ≤ n ≤ 2100) - Line ...
type: default time: 1s memory: 1024m subtasks: - score: 100 n_cases: 3 checker: chk.cc checker_type: testlib filename: std.cc
180
algorithmic
# Graph Isomorphism ## Problem You are given two undirected graphs with the same number of vertices. Your task is to find a permutation of vertices of the second graph that makes it as isomorphic as possible to the first graph. This is the Graph Isomorphism problem, evaluated with a soft scoring rule. ## Input Form...
type: default time: 1s memory: 1024m subtasks: - score: 100 n_cases: 3 checker: chk.cc checker_type: testlib filename: std.cc
181
algorithmic
# Binary Quadratic Assignment Problem ## Problem You are given two n×n binary matrices: a distance matrix D and a flow matrix F (both containing only 0s and 1s). Your task is to assign n facilities to n locations (a permutation) to minimize the total cost. This is a binary version of the Quadratic Assignment Problem...
type: default time: 1s memory: 1024m subtasks: - score: 100 n_cases: 3 checker: chk.cc checker_type: testlib filename: std.cc
182
algorithmic
# Vertex Cover Challenge ## Context You are given an undirected graph G = (V, E) with |V| = N vertices and |E| = M edges. You must select a subset of vertices S ⊆ V to form a Vertex Cover. A subset S is a valid vertex cover if and only if: for every edge {u, v} ∈ E, at least one of its endpoints is in S. (i.e., ...
type: default time: 2s memory: 512m subtasks: - score: 100 n_cases: 3 checker: checker.cc checker_type: testlib
183
algorithmic
# Maximum Independent Set Challenge ## Context You are given an undirected graph G = (V, E) with |V| = N vertices and |E| = M edges. You must select a subset of vertices S ⊆ V to form an **Independent Set**. A subset S is a valid independent set if and only if: for every pair of distinct vertices u, v ∈ S, there i...
type: default time: 2s memory: 512m subtasks: - score: 100 n_cases: 3 checker: checker.cc checker_type: testlib
184
algorithmic
# Maximum Independent Set Challenge ## Context You are given an undirected graph G = (V, E) with |V| = N vertices and |E| = M edges. You must select a subset of vertices S ⊆ V to form an **Independent Set**. A subset S is a valid independent set if and only if: for every pair of distinct vertices u, v ∈ S, there i...
type: default time: 2s memory: 512m subtasks: - score: 100 n_cases: 3 checker: checker.cc checker_type: testlib
185
algorithmic
# Maximum Clique Challenge ## Context You are given an undirected graph G = (V, E) with |V| = N vertices and |E| = M edges. You must select a subset of vertices S ⊆ V to form a **Clique**. A subset S is a valid clique if and only if: for **every** pair of distinct vertices u, v ∈ S, there **IS** an edge between th...
type: default time: 2s memory: 512m subtasks: - score: 100 n_cases: 3 checker: checker.cc checker_type: testlib
186
algorithmic
# Graph Coloring Challenge ## Context You are given an undirected graph G = (V, E) with |V| = N vertices. Each vertex must be assigned a positive integer color. A coloring is valid if and only if: for every edge {u, v} ∈ E, color[u] ≠ color[v]. This is a heuristic optimization problem. You are NOT required to fin...
type: default time: 2s memory: 512m subtasks: - score: 100 n_cases: 3 checker: checker.cc checker_type: testlib
187
algorithmic
# Clique Cover Challenge ## Context You are given an undirected graph G = (V, E) with |V| = N vertices. Each vertex must be assigned a positive integer clique ID. Your output represents a clique cover in the form of a vertex partition: all vertices with the same ID must form a clique. A solution is valid if and onl...
type: default time: 2s memory: 512m subtasks: - score: 100 n_cases: 3 checker: checker.cc checker_type: testlib
188
algorithmic
# LCS Challenge (Approximation) ## Context You are given two large strings, S1 and S2, consisting of uppercase English letters and/or digits. Let |S1| = N and |S2| = M. You must construct a string Z that is a **common subsequence** of both S1 and S2. A string Z is a valid subsequence of S if Z can be obtained from ...
type: default time: 2s memory: 512m subtasks: - score: 100 n_cases: 3 checker: checker.cc checker_type: testlib
189
algorithmic
# Edit Distance Challenge (Approximation) ## Context You are given two large strings, S1 and S2, consisting of uppercase English letters and/or digits. Let |S1| = N and |S2| = M. Your task is to transform S1 into S2 with the **minimum number of operations**. This is the standard **Levenshtein Distance** problem. ...
type: default time: 3s memory: 512m subtasks: - score: 100 n_cases: 3 checker: checker.cc checker_type: testlib
192
algorithmic
# Max-Cut ## Problem You are given an undirected graph with n vertices and m edges. Your task is to partition the vertices into two sets to maximize the number of edges crossing the partition. An edge is a cut edge if its two endpoints are in different sets. ## Input Format - Line 1: two integers n and m (1 ≤ n ≤ ...
type: default time: 1s memory: 1024m subtasks: - score: 100 n_cases: 3 checker: chk.cc checker_type: testlib filename: std.cc
193
algorithmic
# Max-2-SAT ## Problem You are given a Boolean formula in CNF form, where each clause contains exactly two literals. Your task is to assign truth values to variables to satisfy as many clauses as possible. ## Input Format - Line 1: two integers n and m (1 ≤ n ≤ 1000, 0 ≤ m ≤ 40000) - Next m lines: two integers a ...
type: default time: 1s memory: 1024m subtasks: - score: 100 n_cases: 3 checker: chk.cc checker_type: testlib filename: std.cc
2
algorithmic
Permutation This is an interactive problem. There is a hidden permutation of n. Recall that a permutation of n is a sequence where each integer from 1 to n (both inclusive) appears exactly once. Piggy wants to unravel the permutation with some queries. Each query must consist of a sequence (not necessarily a permuta...
# Set the problem type to interactive type: interactive # Specify the interactor source file interactor: interactor.cc # Time and memory limits still apply to the contestant's solution time: 1s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3 # Looks for 1.in, 2.in, ... ...
203
algorithmic
Chameleon This is an interactive problem. There are 2N chameleons in the JOI Zoo, numbered from 1 to 2N. Among them, N chameleons are gender X, and N are gender Y. Every chameleon has its own "original color." The original colors satisfy the following properties: - The original colors of chameleons of the same gender...
# Set the problem type to interactive type: interactive # Specify the interactor source file interactor: interactor.cc # Time and memory limits still apply to the contestant's solution time: 1s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3 # Looks for 1.in, 2.in, ... ...
205
algorithmic
Sequence Transformation Problem Description: You are given two valid parenthesis sequences s1 and s2, both of length 2n. Your goal is to transform s1 into s2 using the minimum number of operations. Available Operations: - Op 1: Transform p(((A)B)C)q into p((A)B)(C)q - Op 2: Transform p((A)(B)C)q into p((A)B)(C)q - Op...
# Set the problem type to standard type: default # Specify the checker source file checker: chk.cc # Time and memory limits time: 2s memory: 256m # The subtasks section subtasks: - score: 100 n_cases: 3 # Looks for 1.in/1.ans, 2.in/2.ans, ... 10.in/10.ans in testdata/
207
algorithmic
Efficient Sorting Description You are given a permutation S of N distinct integers from 0 to N-1. Your task is to sort the permutation into increasing order (i.e., S[i] = i for all 0 <= i < N) while playing a game against a character named Jerry. The game proceeds in a sequence of rounds. You must decide in advance ...
 type: default checker: chk.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
209
algorithmic
Hidden Weights Description This is an interactive problem. You are given a positive integer h. Let n = 2^h - 1. There is a perfect binary tree G with n nodes, numbered 1 to n. The root of the tree is node 1. For any node u (2 <= u <= n), its parent is floor(u / 2). The interactor maintains two hidden arrays: 1. A ...
type: interactive interactor: interactor.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 512m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
210
algorithmic
# Military Exercise: Fighter Scheduling and Base Strikes (Blue Side) You are the **blue side** in a simplified military exercise on a 2D grid. The map is an \(n \times m\) grid (0-indexed coordinates): - `#` : red base (enemy) - `*` : blue base (friendly) - `.` : neutral cell Both sides have bases. Blue controls a ...
type: default checker: chk.cc checker_type: testlib # Time and memory limits apply to the contestant's solution program. time: 5s memory: 512m subtasks: - score: 100 n_cases: 3
211
algorithmic
Communication Robots ## Problem Description In a task area, there are several robots distributed that must maintain a connected network through wireless communication to complete tasks collaboratively. Wireless communication has the following characteristics: (1) Establishing communication links consumes energy. (...
# Set the problem type to default (submit answer problems use default type) type: default # Specify the checker source file checker: chk.cc # Time and memory limits (for submit answer problems, these may not be strictly enforced) time: 10s memory: 512m # The subtasks section subtasks: - score: 100 n_cases: 4 ...
212
algorithmic
I wanna cross the grid Problem Description: Suddenly, the save point landed in a huge grid. Only by passing through all required areas can the next save point appear... You are given a grid with n rows and m columns, where rows and columns are numbered starting from 1. Define a pair (x, y) to represent the cell at ro...
# Set the problem type to default (submit answer problems use default type) type: default # Specify the checker source file checker: chk.cc # Time and memory limits (for submit answer problems, these may not be strictly enforced) time: 30s memory: 512m # The subtasks section subtasks: - score: 100 n_cases: 4 ...
213
algorithmic
Sequence Shift (moqueve) Problem Description: You need to sort a permutation of $1\sim n$ on a strange computer. You can choose a number $x$, and then each time you can cyclically shift a segment of length $x$ to the left or right (the leftmost/rightmost element moves to the rightmost/leftmost position) (shift amount...
# Set the problem type to default (submit answer problems use default type) type: default # Specify the checker source file checker: chk.cc # Time and memory limits (for submit answer problems, these may not be strictly enforced) time: 2s memory: 512m # The subtasks section subtasks: - score: 100 n_cases: 3 #...
214
algorithmic
Sequence Reversal (requese) Problem Description: You need to sort a permutation of $1\sim n$ on a strange computer. You can choose a number $x$, and then each time you can reverse a segment of length $x+1$ or a segment of length $x-1$. Please restore the sequence to $1\sim n$ within $200\times n$ operations. (Note ...
# Set the problem type to default (submit answer problems use default type) type: default # Specify the checker source file checker: chk.cc # Time and memory limits (for submit answer problems, these may not be strictly enforced) time: 2s memory: 512m # The subtasks section subtasks: - score: 100 n_cases: 3 #...
217
algorithmic
Super Dango Maker Description This is an interactive problem. JOI-kun is a professional confectioner making dangos (Japanese dumplings). There are N different colors of dangos, numbered from 1 to N. JOI-kun has M dangos of each color. Therefore, there are N * M dangos in total. These dangos are uniquely indexed fro...
 type: interactive interactor: interactor.cc # Time and memory limits still apply to the contestant's solution time: 10s memory: 256m # The subtasks section works the same way subtasks: - score: 100 n_cases: 3
22
algorithmic
Problem C. A+B Problem Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 1024 mebibytes In the era of constructives and ad-hocs, what could be more sacrilegious than combining two query problems into one? KOI City consists of N intersections and N − 1 two-way roads. You can t...
type: default time: 2s memory: 512m checker: checker.cpp cheker_type: testlib subtasks: - score: 100 n_cases: 3
220
algorithmic
Playing Around the Table ## Problem Description There are n players, numbered from 1 to n sitting around a round table. The (i+1)-th player sits to the right of the i-th player for 1≤i<n, and the 1-st player sits to the right of the n-th player. There are n^2 cards, each of which has an integer between 1 and n writt...
# Set the problem type to default (submit answer problems use default type) type: default # Specify the checker source file checker: chk.cc # Time and memory limits (for submit answer problems, these may not be strictly enforced) time: 2s memory: 256m # The subtasks section subtasks: - score: 100 n_cases: 4 #...
222
algorithmic
Problem: Hedgehog Graph Time limit: 5 seconds Memory limit: 1024 megabytes This is an interactive problem. A hedgehog graph is a directed graph where each vertex has exactly one outgoing edge and contains exactly one directed cycle of length at least 3 (the graph does not contain a loop or cycle of length 2). For e...
# Set the problem type to interactive type: interactive # Specify the interactor source file interactor: interactor.cc # Time and memory limits still apply to the contestant's solution time: 5s memory: 1024m # The subtasks section works the same way subtasks: - score: 100 n_cases: 1 # Looks for 1.in, 2.in, ......
225
algorithmic
You are given a permutation $a_1, a_2, \dots, a_n$ of numbers from $1$ to $n$. Also, you have $n$ sets $S_1, S_2, \dots, S_n$, where $S_i = \{a_i\}$. Lastly, you have a variable $cnt$, representing the current number of sets. Initially, $cnt = n$. We define two kinds of functions on sets: - $f(S) = \min_{u \in S} u$;...
type: default checker: chk.cc checker_type: testlib # Time and memory limits apply to the contestant's solution program. time: 4s memory: 512m subtasks: - score: 100 n_cases: 3
227
algorithmic
Given a permutation $p$ of length $n$, you need to divide it into four disjoint subsequences $a$ $b$ $c$ $d$ such that the sum of $\operatorname{LIS}(a) + \operatorname{LDS}(b) + \operatorname{LIS}(c) + \operatorname{LDS}(d)$ is maximized. - $\operatorname{LIS}(a)$ is the length of the Longest Increasing Subsequence (...
type: default checker: chk.cc checker_type: testlib # Time and memory limits apply to the contestant's solution program. time: 2s memory: 512m subtasks: - score: 100 n_cases: 3
228
algorithmic
You are given a 01-string (a string consisting only of characters '0' and '1'). You need to find the number of substrings such that the number of '0's in the substring is equal to the square of the number of '1's. ### Input A single line containing a 01-string. The length of the string is at most $2 \times 10^6$. ##...
type: default checker: chk.cc checker_type: testlib # Time and memory limits apply to the contestant's solution program. time: 1s memory: 512m subtasks: - score: 100 n_cases: 3