problem_id stringlengths 21 55 | problem_code stringclasses 13
values | problem_slug stringlengths 3 35 | problem_title stringlengths 4 36 | contest_name stringclasses 7
values | contest_full_name stringclasses 7
values | year stringdate 2017-01-01 00:00:00 2025-01-01 00:00:00 | source stringclasses 7
values | total_teams int64 15 80 | total_problems int64 11 13 | time_limit stringclasses 8
values | memory_limit stringclasses 4
values | author stringlengths 0 41 | analysis_author stringclasses 15
values | statement stringlengths 957 5.98k | analysis stringlengths 177 8.98k | sample_test_cases_input listlengths 1 6 | sample_test_cases_output listlengths 1 6 | num_sample_test_cases int64 1 6 | hidden_test_cases_input listlengths 0 159 | hidden_test_cases_output listlengths 0 159 | num_hidden_test_cases int64 0 159 | has_special_judge bool 2
classes | special_judge_code stringclasses 16
values | special_judge_format stringclasses 3
values | uses_kattis bool 2
classes | kattis_problem_id stringlengths 0 26 | contest_standings_csv stringclasses 7
values | scoreboard_url stringclasses 7
values | teams_solved int64 0 75 | teams_wrong_answer int64 0 33 ⌀ | teams_unattempted int64 0 77 | teams_tried int64 0 75 | solve_percentage float64 0 100 | first_solve_time int64 0 5.22k | average_solve_time float64 0 5.25k | total_attempts int64 0 311 | average_attempts float64 1 13.6 ⌀ | Difficulty_Tertile stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CS3233_2023_Midterm_absolutely_symmetric | A | absolutely_symmetric | Absolutely Symmetric | CS3233_2023_Midterm | CS3233 Midterm Contest 2023 | 2023 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4 | 25 | 11 | 1 sec | 1024 MB | # Problem Statement
SoCCat the Mathematician is a very curious cat. Currently, SoCCat is learning linear algebra!
SoCCat deemed a matrix $T$ of size $n \times n$ consisting of integers to be absolutely symmetric if and only if $|T_{i,j}| = |T_{j,i}|$ for all $1 \le i, j \le n$. In other words, the absolute value of th... | Note that an absolutely symmetric matrix has the same parity on $(i, j)$ and $(j, i)$. Therefore, if the parity of $A_{i,j}$ and $A_{j,i}$ is different, the answer is $-1$.
If the initial matrix is already absolutely symmetric, the answer is $1$ (the matrix itself). Otherwise, the answer is at least $2$. Note that the... | [
"3\n0 0 0\n0 0 0\n0 0 0",
"2\n0 1\n0 0",
"2\n1 3\n5 7"
] | [
"1\n0 0 0\n0 0 0\n0 0 0",
"-1",
"2\n1 -1\n1 -1\n0 4\n4 8"
] | 3 | [] | [] | 0 | false | true | absolutelysymmetric | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K
1,:,9,735,111 min,297 min,,137 min,125 min,1111 min,122 min,2201 min,,2167 min,14 min
2,,9,987,126 min,1173 min,,197 min,152 min,163 min,2110 min,3234 min,,3123 min,19 ... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4/standings | 23 | null | 2 | 23 | 92 | 14 | 1,207.8 | 0 | null | T1 | ||||
CS3233_2023_Midterm_bachelor_s_thesis | B | bachelor_s_thesis | Bachelor's Thesis | CS3233_2023_Midterm | CS3233 Midterm Contest 2023 | 2023 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4 | 25 | 11 | 1 sec | 1024 MB | # Problem Statement
> *SoCCat the Undergraduate is a very studious cat. Currently, SoCCat is writing their Bachelor’s Thesis!*
For SoCCat’s Final Year Project, SoCCat will write a thesis studying the behaviour of a particular operation: the *cat-split*.
Initially, suppose SoCCat has an array of $n$ integers $a_1, a_2... | If $k = n$, the problem is trivial – only $2$ permutations are possible, the original sequence or its reverse. We can compute the inversion of each array and take the minimum. Otherwise, if $k < n$, the following construction will sort the array $a$ (thus making the number of inversions $0$):
- **If $k + 1 < n$**, we ... | [
"4 4\n3 3 2 3",
"4 4\n3 2 3 3",
"5 2\n1 2 4 3 5"
] | [
"1\n3\n1111\n1111\n1111",
"1\n0",
"0\n2\n01010\n01100"
] | 3 | [] | [] | 0 | false | true | bachelorsthesis | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K
1,:,9,735,111 min,297 min,,137 min,125 min,1111 min,122 min,2201 min,,2167 min,14 min
2,,9,987,126 min,1173 min,,197 min,152 min,163 min,2110 min,3234 min,,3123 min,19 ... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4/standings | 4 | null | 21 | 4 | 16 | 297 | 1,974 | 0 | null | T3 | ||||
CS3233_2023_Midterm_construction_worker | C | construction_worker | Construction Worker | CS3233_2023_Midterm | CS3233 Midterm Contest 2023 | 2023 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4 | 25 | 11 | 4 sec | 1024 MB | # Problem Statement
> *SoCCat the Construction Worker is a very diligent cat. Currently, SoCCat is planning to build the tallest tower in all of cat history!*
To build the tallest tower, SoCCat needs a lot of cat dollars. SoCCat plans to make money by taking on construction jobs optimally.
There are $n$ companies tha... | We have the following straightforward dynamic programming solution: let $f[\text{time}][\text{starttime}]$ be the maximum amount of money that can be obtained if we start from day $\text{starttime}$ (modulo $T$) and work for $\text{time}$ days.
However, in this case, it is beneficial to reverse the variables: let $g[\... | [
"10 2\n0 5 1\n3 16 4\n7\n5\n14\n15\n19\n1000\n1005\n3233"
] | [
"1\n1\n2\n4\n200\n201\n645"
] | 1 | [] | [] | 0 | false | true | constructionworker | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K
1,:,9,735,111 min,297 min,,137 min,125 min,1111 min,122 min,2201 min,,2167 min,14 min
2,,9,987,126 min,1173 min,,197 min,152 min,163 min,2110 min,3234 min,,3123 min,19 ... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4/standings | 0 | null | 25 | 0 | 0 | 0 | 0 | 0 | null | T3 | ||||
CS3233_2023_Midterm_drill_sergeant | D | drill_sergeant | Drill Sergeant | CS3233_2023_Midterm | CS3233 Midterm Contest 2023 | 2023 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4 | 25 | 11 | 3 sec | 1024 MB | # Problem Statement
SoCCat the Drill Sergeant is a very strict cat. Currently, SoCCat is training cat recruits!
Drill Sergeant SoCCat is known for their ability to turn raw cat recruits into disciplined cat soldiers.
There are $n$ cat recruits, numbered $1$ to $n$. Cat recruit $i$ has height $i$ cat units.
Being cat... | We maintain an ordered set $S$ which contains the cats currently in the line, and an integer $\text{ans}$ which is the current sum of discontentment. For implementation convenience, we can add $\infty$ and $-\infty$ to $S$ without affecting the answer. Define a function $\text{count}(i)$ where $i \in S$ which returns o... | [
"10 4\n1 3\n3 5\n5 7\n7 9\n13\n1 1\n1 3\n1 5\n1 7\n1 2\n1 8\n1 9\n1 4\n2 8\n1 6\n2 1\n2 2\n2 9"
] | [
"3\n355\n3588\n6821\n3594\n3597\n3600\n373\n3600\n373\n370\n367\n15"
] | 1 | [] | [] | 0 | false | true | drillsergeant | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K
1,:,9,735,111 min,297 min,,137 min,125 min,1111 min,122 min,2201 min,,2167 min,14 min
2,,9,987,126 min,1173 min,,197 min,152 min,163 min,2110 min,3234 min,,3123 min,19 ... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4/standings | 23 | null | 2 | 23 | 92 | 137 | 1,736.3 | 0 | null | T1 | ||||
CS3233_2023_Midterm_esoteric_spells | E | esoteric_spells | Esoteric Spells | CS3233_2023_Midterm | CS3233 Midterm Contest 2023 | 2023 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4 | 25 | 11 | 1 sec | 1024 MB | # Problem Statement
> SoCCat the Spellcaster is a very magical cat. Currently, SoCCat is learning about combination spells!
SoCCat has just learned about combination spells, which are spells that combine two or more spells from different spellcasters to deal more damage.
According to the Unified Theory of Magic, if t... | We greedily assign the bits from high to low. Initially, we set all $x_i = 0$. Suppose we are currently considering bit $b$. If there are $0$ elements with bit $b$ on, then we can simply skip this. If there is $1$ element $a_i$, then we can turn bit $b$ of $x_i$ on. If there are $2$ or more elements, let any two of the... | [
"2\n3\n3 7 1\n4\n3 2 3 3"
] | [
"7\n3 5 1\n3\n3 0 3 3"
] | 1 | [] | [] | 0 | false | true | esotericspells | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K
1,:,9,735,111 min,297 min,,137 min,125 min,1111 min,122 min,2201 min,,2167 min,14 min
2,,9,987,126 min,1173 min,,197 min,152 min,163 min,2110 min,3234 min,,3123 min,19 ... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4/standings | 21 | null | 4 | 21 | 84 | 117 | 2,142.9 | 0 | null | T2 | ||||
CS3233_2023_Midterm_fake_graph_theory | F | fake_graph_theory | Fake Graph Theory | CS3233_2023_Midterm | CS3233 Midterm Contest 2023 | 2023 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4 | 25 | 11 | 1 sec | 1024 MB | # Problem Statement
> SoCCat the Combinatorician is a very combinatoricky cat. Currently, SoCCat is challenging you to solve a combinatorics problem!
SoCCat challenges you to solve the following combinatorics problem:
Given a graph $G$ with $4n$ vertices, along with two permutations $p$ and $q$, each with size $2n$ o... | By drawing the generated graphs, we can conclude that each connected component must be a cycle. Suppose we draw the graph such that $p$ adds edges on the left part of the graph, and $q$ adds edges on the right part. The edges $(i, i + 2n)$ will then connect vertices from the left and right parts.
Before we start, let’... | [
"2"
] | [
"768"
] | 1 | [] | [] | 0 | false | true | fakegraphtheory | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K
1,:,9,735,111 min,297 min,,137 min,125 min,1111 min,122 min,2201 min,,2167 min,14 min
2,,9,987,126 min,1173 min,,197 min,152 min,163 min,2110 min,3234 min,,3123 min,19 ... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4/standings | 8 | null | 17 | 8 | 32 | 163 | 1,204.1 | 0 | null | T2 | ||||
CS3233_2023_Midterm_game_theory | G | game_theory | Game Theory | CS3233_2023_Midterm | CS3233 Midterm Contest 2023 | 2023 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4 | 25 | 11 | 1 sec | 1024 MB | # Problem Statement
> SoCCat the Game Theorist is a very tricky cat. Currently, SoCCat is challenging you to beat them in a game!
SoCCat challenges you to the following game:
There are $n$ cells arranged in a row, with numbers $1$ to $n$ written on them. The $i$-th cell from the left has the number $p_i$ written on i... | We use dynamic programming. Let $d^+(x)$ denote the score of the game if the token is at the $x$-th cell and it’s the maximizing player’s turn, and $d^-(x)$ if it’s the minimizing player’s turn. The base case of the dynamic programming is $d^+(x) = d^-(x) = 0$ if $x > n$. Then,
$$
d^+(x) = a_x + \max\{d^-(x + k \cdot ... | [
"2\n10\n3 1 5 2 4 9 6 10 8 7\n1 -2 3 -4 5 -6 7 -8 9 -10\n4\n4 3 2 1\n3 2 3 3"
] | [
"8 7 3 -4 14 -6 7 -8 9 -10\n3 2 3 3"
] | 1 | [] | [] | 0 | false | true | gametheory | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K
1,:,9,735,111 min,297 min,,137 min,125 min,1111 min,122 min,2201 min,,2167 min,14 min
2,,9,987,126 min,1173 min,,197 min,152 min,163 min,2110 min,3234 min,,3123 min,19 ... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4/standings | 22 | null | 3 | 22 | 88 | 122 | 982.2 | 0 | null | T2 | ||||
CS3233_2023_Midterm_hill_climbing | H | hill_climbing | Hill Climbing | CS3233_2023_Midterm | CS3233 Midterm Contest 2023 | 2023 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4 | 25 | 11 | 1 sec | 1024 MB | # Problem Statement
> SoCCat the Hill Climber is a very determined cat. Currently, SoCCat is climbing the hill of an NP-hard problem!
Everyone knows that the graph edge partitioning problem is NP-hard. As there are many variants of it, here’s the one that SoCCat is talking about:
There is a connected graph with $n$ v... | If $\sum a_i < \left\lceil \frac{n}{2} \right\rceil$, the answer is **No** since we can’t color enough edges.
Otherwise, the answer is **Yes**. We solve for the case $\sum a_i = \left\lceil \frac{n}{2} \right\rceil$. If it’s greater, we can simply decrement any $a_i$ until equality is reached. Also, we can simply cons... | [
"4\n5 4\n4 0 0 0\n2 3\n2 1\n4 5\n4 3\n6 11\n0 0 0 0 0 0 0 3 2 3 3\n1 2\n2 3\n3 4\n4 5\n5 6\n6 1\n1 4\n4 2\n2 5\n5 3\n4 6\n6 11\n0 0 0 0 0 0 0 3 2 3 3\n1 2\n2 3\n3 4\n4 5\n5 6\n6 1\n1 4\n4 2\n2 5\n5 3\n4 6\n5 10\n1 0 0 0 0 0 0 0 0 1\n1 2\n2 3\n3 4\n4 5\n5 1\n1 3\n3 5\n5 2\n2 4\n4 1"
] | [
"Yes\n1 1 0 1\nYes\n8 11 10 10 9 8 8 11 9 10 11\nYes\n11 11 11 0 0 0 0 0 0 0 0\nNo"
] | 1 | [] | [] | 0 | false | true | hillclimbing | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K
1,:,9,735,111 min,297 min,,137 min,125 min,1111 min,122 min,2201 min,,2167 min,14 min
2,,9,987,126 min,1173 min,,197 min,152 min,163 min,2110 min,3234 min,,3123 min,19 ... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4/standings | 2 | null | 23 | 2 | 8 | 2,201 | 2,717.5 | 0 | null | T3 | ||||
CS3233_2023_Midterm_indistinguishable_sequences | I | indistinguishable_sequences | Indistinguishable Sequences | CS3233_2023_Midterm | CS3233 Midterm Contest 2023 | 2023 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4 | 25 | 11 | 1 sec | 1024 MB | # Problem Statement
> SoCCat the Group Theorist is a very detail-oriented cat. Currently, SoCCat is researching a unique equivalence relation on sequences!
SoCCat defines a map $L : \bigcup_{i \in \mathbb{N}} \mathbb{Z}^i \rightarrow \mathbb{N}$ which takes in a sequence $\mathbf{s} = (s_1, s_2, \ldots, s_k)$ of integ... | Let’s make a few observations. Since the test cases are random, we can generate them on our own to test whether our solution is fast enough.
First, we only need to consider elements which can be a part of some LIS (longest increasing subsequence). If an element $a_i$ is never part of any LIS, then deleting it will not... | [
"4\n4 1 3 2",
"10\n2 4 8 7 3 9 5 6 1 10"
] | [
"6",
"84"
] | 2 | [] | [] | 0 | false | true | indistinguishablesequences | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K
1,:,9,735,111 min,297 min,,137 min,125 min,1111 min,122 min,2201 min,,2167 min,14 min
2,,9,987,126 min,1173 min,,197 min,152 min,163 min,2110 min,3234 min,,3123 min,19 ... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4/standings | 0 | null | 25 | 0 | 0 | 0 | 0 | 0 | null | T3 | ||||
CS3233_2023_Midterm_just_do_it | J | just_do_it | Just Do It | CS3233_2023_Midterm | CS3233 Midterm Contest 2023 | 2023 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4 | 25 | 11 | 1 sec | 1024 MB | # Problem Statement
> _SoCCat the Competitive Programmer is very tired of reading long statements unrelated to the actual problem. So, here’s a problem statement that’s just a single sentence!_
Given an array $a_1, a_2, \ldots, a_n$ of integers, find the following value, modulo $1\ 000\ 003\ 233$:
$$
\sum_{i=1}^{n} \... | Let’s solve a simpler problem – suppose we have another array $b$ of size $n$, and the cost $c(l, r)$ of a subarray $[l, r]$ is $\min\{a_l, a_{l+1}, \ldots, a_r\} \times b_l$.
We fix the right endpoint $r$, and move it from $1$ to $n$. While we do that, we additionally maintain two other variables – `ans` which is the... | [
"3\n1 2 3",
"4\n1 2 1 2",
"6\n1 1 1 1 1 1"
] | [
"25",
"22",
"21"
] | 3 | [] | [] | 0 | false | true | justdoit | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K
1,:,9,735,111 min,297 min,,137 min,125 min,1111 min,122 min,2201 min,,2167 min,14 min
2,,9,987,126 min,1173 min,,197 min,152 min,163 min,2110 min,3234 min,,3123 min,19 ... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4/standings | 9 | null | 16 | 9 | 36 | 196 | 2,670.1 | 0 | null | T2 | ||||
CS3233_2023_Midterm_king_s_decree | K | king_s_decree | King's Decree | CS3233_2023_Midterm | CS3233 Midterm Contest 2023 | 2023 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4 | 25 | 11 | 1 sec | 1024 MB | # Problem Statement
> **SoCCat the Cat King is a very fair cat. Currently, SoCCat wants to ensure all cats can live in peace and harmony!**
The Cat Kingdom is a very large kingdom, with $n$ cats living in it. The cats are numbered from $1$ to $n$.
King SoCCat has noticed a glaring problem in the kingdom — the uneven ... | Note that we want to maximize the minimum value – hence, let’s try to binary search the answer. Suppose we want to test whether every cat can have at least $\lambda$ wealth. If $w_i \leq \lambda$, then cat $i$ needs $\lambda - w_i$ wealth. If $w_i > \lambda$, then cat $i$ can donate $w_i - \max\{l_i, \lambda\}$ wealth.... | [
"2\n5\n4 2 3 6 12\n3 2 3 3 10\n8\n998 244 353 3109 4650 4305 6507 9699\n100 200 300 2040 4230 4236 5234 3233"
] | [
"4\n3233"
] | 1 | [] | [] | 0 | false | true | kingsdecree | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K
1,:,9,735,111 min,297 min,,137 min,125 min,1111 min,122 min,2201 min,,2167 min,14 min
2,,9,987,126 min,1173 min,,197 min,152 min,163 min,2110 min,3234 min,,3123 min,19 ... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2223/assignments/b7jej4/standings | 23 | null | 2 | 23 | 92 | 14 | 273.2 | 0 | null | T1 | ||||
CS3233_2024_Midterm_AplusB_or_AminusB | A | AplusB_or_AminusB | A+B or A-B? | CS3233_2024_Midterm | CS3233 Midterm Contest 2024 | 2024 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a | 15 | 12 | 1 sec | 1024 MB | # Problem Statement
Alice believes that a friendly mid-term contest should start with an $A + B$ problem. But Bob disagrees. To increase creativity, he thinks an $A - B$ problem should be used instead.
To settle the dispute, the contest organizers have decided to use both problems. Given two integers $A$ and $B$, the ... | Denote $f(R_A, R_B)$ be the number of possible pairs $(A, B)$ such that $B \le A,\ A \le R_A$ and $B \le R_B$. Then we are finding
$f(R, R) - f(L - 1, R) - f(R, L - 1) + f(L - 1, L - 1)$.
$f(R_A, R_B)$ can be found by dynamic programming with bitmasks. We have to maintain the following states:
- **current_bit**: Th... | [
"5 7"
] | [
"5"
] | 1 | [] | [] | 0 | false | true | aplusorminusb | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K,Problem_L
1,Cossacks and Samurai,12,1447,169 min,111 min,1196 min,1253 min,5224 min,1103 min,148 min,1215 min,185 min,133 min,119 min,291 min
2,The Spider from Mars,8,9... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a/standings | 5 | null | 10 | 5 | 33.3 | 151 | 2,404 | 0 | null | T2 | ||||
CS3233_2024_Midterm_busy_roads | B | busy_roads | Busy Roads | CS3233_2024_Midterm | CS3233 Midterm Contest 2024 | 2024 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a | 15 | 12 | 1 sec | 1024 MB | # Problem Statement
Robert lives in ERPLand, a country with $N$ cities numbered 1 to $N$. Each day in this country has $C$ seconds, numbered 0 to $C - 1$. There are $M$ bi-directional roads connecting pairs of cities. Road $i$ connects cities $A_i, B_i$, takes Robert $T_i$ seconds to travel through, and can only be ent... | Run Dijkstra, but when trying to use a road from city $a$, determine the earliest time that you can enter it by considering the shortest time it takes to get to $a$ modulo $C$.
| [
"3 3 10\n1 2 3 0 5\n1 3 1 7 8\n3 2 4 3 3",
"5 5 10\n1 2 1 6 8\n1 3 4 3 5\n2 4 4 1 5\n3 4 2 2 6\n4 5 6 3 7"
] | [
"7",
"20"
] | 2 | [] | [] | 0 | false | true | busyroads | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K,Problem_L
1,Cossacks and Samurai,12,1447,169 min,111 min,1196 min,1253 min,5224 min,1103 min,148 min,1215 min,185 min,133 min,119 min,291 min
2,The Spider from Mars,8,9... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a/standings | 14 | null | 1 | 14 | 93.3 | 111 | 1,144.7 | 0 | null | T1 | ||||
CS3233_2024_Midterm_cursed_cactus_challenge | C | cursed_cactus_challenge | Cursed Cactus Challenge | CS3233_2024_Midterm | CS3233 Midterm Contest 2024 | 2024 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a | 15 | 12 | 1 sec | 1024 MB | # Problem Statement
You are given a simple connected graph $G$ with $n$ vertices and $m$ edges. Each vertex $i$ has a value $a_i$. No two edges connect the same pair of vertices. Interestingly, each edge lies in at most one simple cycle.
A simple cycle is a sequence of $k$ distinct vertices $v_1, v_2, \ldots, v_k$, su... | Let $A = \{S_i\}$ be a set of possible independent sets and $B = \{S_i\}$ be another set of possible independent sets. Let’s denote the operation $C = A \times B$ as a convolution of sets where the independent sets in $A$ have no intersection with independent sets in $B$. Namely $C = \{S_A \cup S_B \mid S_A \in A, S_B ... | [
"3 2\n1 1 1\n1 2\n2 3",
"4 4\n3 2 3 3\n1 2\n2 3\n3 4\n4 1",
"10 12\n1 2 3 4 5 6 7 8 9 10\n1 2\n2 3\n3 1\n1 4\n4 5\n5 1\n1 6\n6 7\n7 1\n1 8\n8 9\n9 10"
] | [
"7",
"92",
"50520"
] | 3 | [] | [] | 0 | false | true | cursedcactuschallenge | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K,Problem_L
1,Cossacks and Samurai,12,1447,169 min,111 min,1196 min,1253 min,5224 min,1103 min,148 min,1215 min,185 min,133 min,119 min,291 min
2,The Spider from Mars,8,9... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a/standings | 2 | null | 13 | 2 | 13.3 | 297 | 746.5 | 0 | null | T3 | ||||
CS3233_2024_Midterm_deja_vu | D | deja_vu | Déjà vu | CS3233_2024_Midterm | CS3233 Midterm Contest 2024 | 2024 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a | 15 | 12 | 1 sec | 1024 MB | # Problem Statement
You have $n$ objects that you like. The $i$-th object gives you a happiness rating $H_i$ when you bring it with you.
However, you can only bring exactly $k$ out of those $n$ objects for your upcoming holiday (due to baggage/airline limitation, etc).
Which objects should you take?
...wait a minute... | Let the happiness levels be $H_1 \ge H_2 \ge \cdots \ge H_n$. We shall describe a subset of happiness levels by their indices, in ascending order. So if we want to take objects with happiness levels $H_1, H_2, H_4$, we’ll just refer to it as $(1, 2, 4)$.
Now clearly, the greatest happiness level is attained by $(1, 2,... | [
"4 2 6\n3 2 3 3",
"5 1 10\n1 1 1 1 1",
"20 10 20\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4"
] | [
"6\n6\n6\n5\n5\n5",
"1\n1\n1\n1\n1\n-1\n-1\n-1\n-1\n-1",
"71\n70\n70\n70\n70\n70\n70\n69\n69\n69\n69\n69\n69\n69\n69\n69\n69\n69\n69\n69"
] | 3 | [] | [] | 0 | false | true | dejavu2 | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K,Problem_L
1,Cossacks and Samurai,12,1447,169 min,111 min,1196 min,1253 min,5224 min,1103 min,148 min,1215 min,185 min,133 min,119 min,291 min
2,The Spider from Mars,8,9... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a/standings | 3 | null | 12 | 3 | 20 | 1,253 | 3,927 | 0 | null | T2 | ||||
CS3233_2024_Midterm_endangered_safari_zone | E | endangered_safari_zone | Endangered Safari Zone | CS3233_2024_Midterm | CS3233 Midterm Contest 2024 | 2024 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a | 15 | 12 | 2 sec | 1024 MB | # Problem Statement
Pichuu has just entered the Safari Zone and is amazed by all the rare Pokemon in the Safari Zone. The Safari Zone can be divided into different zones labelled 1 to $N$ arranged in a line from left to right. Using the binoculars from the viewing platform, Pichuu was able to scout all the different zo... | ### No Updates
First let us consider how we can solve the question without any updates.
Let’s assume we are currently trying to answer query $[L, R]$. We can ignore the elements after $R$ and only consider elements in $[1, R]$.
Main Idea: For each distinct element, we want to $+1$ but if the number of distinct eleme... | [
"5 5 2\n1 2 2 2 1 \n2 1 4\n1 3 3\n2 1 4\n1 3 3\n2 1 5",
"10 10 3\n5 2 5 2 5 2 5 2 3 2 \n2 6 10\n2 1 9\n1 7 2\n1 9 2\n1 2 3\n2 5 9\n1 10 3\n2 1 9\n2 3 10\n2 2 8"
] | [
"1\n3\n3",
"3\n1\n1\n2\n2\n2"
] | 2 | [] | [] | 0 | false | true | endangeredsafarizone | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K,Problem_L
1,Cossacks and Samurai,12,1447,169 min,111 min,1196 min,1253 min,5224 min,1103 min,148 min,1215 min,185 min,133 min,119 min,291 min
2,The Spider from Mars,8,9... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a/standings | 1 | null | 14 | 1 | 6.7 | 5,224 | 5,224 | 0 | null | T3 | ||||
CS3233_2024_Midterm_false_sanctum | F | false_sanctum | False Sanctum | CS3233_2024_Midterm | CS3233 Midterm Contest 2024 | 2024 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a | 15 | 12 | 1 sec | 1024 MB | # Problem Statement
Kivotos is in deep trouble. Familiar yet different monsters had made their appearance all over Kivotos, guarding what seems to be False Sanctums. The students plan to destroy these sanctums as fast as possible to stop the monster raid.
The hacker group of the Millenium Science School, Veritas, is t... | We can solve this problem using a segment tree. Notice that we can abstract any information in a segment tree node as long as it supports efficient merging between nodes.
For each node in the segment tree, if we only maintain the density of the substring, we will run into issues during merging, in particular, when the... | [
"9 3\naabcccacc\n2 1 9\n1 7 c\n2 2 8"
] | [
"19\n27"
] | 1 | [] | [] | 0 | false | true | falsesanctum | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K,Problem_L
1,Cossacks and Samurai,12,1447,169 min,111 min,1196 min,1253 min,5224 min,1103 min,148 min,1215 min,185 min,133 min,119 min,291 min
2,The Spider from Mars,8,9... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a/standings | 11 | null | 4 | 11 | 73.3 | 1,103 | 1,697.7 | 0 | null | T2 | ||||
CS3233_2024_Midterm_galactic_sabotage | G | galactic_sabotage | Galactic Sabotage | CS3233_2024_Midterm | CS3233 Midterm Contest 2024 | 2024 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a | 15 | 12 | 2 sec | 1024 MB | # Problem Statement
Pichuu has just finished his catching spree in the safari zone and decided to spend the day organising his messy PC, where his Pokemon are stored. A PC has multiple boxes in a row and each box can store an unlimited amount of Pokemon. For simplicity, you can assume that the Pokemon in a box are also... | Let’s first try to solve the problem without updates.
Let $R_i$ denote the endpoint of the $i^{th}$ contiguous segment. The array is then split up in to the following segments: $[1, R_1], [R_1 + 1, R_2], \ldots, [R_{K-1} + 1, R_K]$.
In this question we want to maximise $K$, while ensuring that sorting all the individ... | [
"6 5\n3 1 2 5 4 6 \n2 3\n1 3\n3 5\n1 2\n3 6",
"10 8\n1 4 3 2 5 6 7 10 9 8 \n8 10\n4 2\n6 7\n6 7\n2 4\n9 10\n4 2\n8 9"
] | [
"3\n3\n5\n4\n3\n2",
"6\n8\n10\n9\n10\n8\n7\n9\n8"
] | 2 | [] | [] | 0 | false | true | galacticsabotage | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K,Problem_L
1,Cossacks and Samurai,12,1447,169 min,111 min,1196 min,1253 min,5224 min,1103 min,148 min,1215 min,185 min,133 min,119 min,291 min
2,The Spider from Mars,8,9... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a/standings | 5 | null | 10 | 5 | 33.3 | 148 | 1,556 | 0 | null | T2 | ||||
CS3233_2024_Midterm_hero_leveling | H | hero_leveling | Hero Leveling | CS3233_2024_Midterm | CS3233 Midterm Contest 2024 | 2024 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a | 15 | 12 | 2 sec | 1024 MB | # Problem Statement
Edgar wants to be a hero! However, to take the Hero Qualification Test, he must be at least level $L$. He is currently level $0$, and there are $N$ quests available for him to take. Quest $i$ requires him to be at least level $M_i$ to complete, and he will gain $X_i$ levels upon completing the quest... | Firstly, note that a set of quests can be completed if and only if it can be completed when we do the quests in increasing order of their $m_i$. Thus we will sort the quests by their $m_i$ value. We shall also interchangeably use the terms "trauma rating" and "cost".
We first discuss an initial idea, that gives us a p... | [
"5 2 10\n0 3 5\n5 5 9\n2 2 3\n7 4 6\n0 4 7",
"6 4 10\n3 6 6\n0 4 7\n0 3 5\n4 2 4\n6 7 4\n7 3 3"
] | [
"13",
"13"
] | 2 | [] | [] | 0 | false | true | heroleveling | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K,Problem_L
1,Cossacks and Samurai,12,1447,169 min,111 min,1196 min,1253 min,5224 min,1103 min,148 min,1215 min,185 min,133 min,119 min,291 min
2,The Spider from Mars,8,9... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a/standings | 1 | null | 14 | 1 | 6.7 | 1,215 | 1,215 | 0 | null | T3 | ||||
CS3233_2024_Midterm_interval_scheduling | I | interval_scheduling | Interval Scheduling | CS3233_2024_Midterm | CS3233 Midterm Contest 2024 | 2024 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a | 15 | 12 | 1 sec | 1024 MB | # Problem Statement
Many couples will dine out on Valentine’s day. To serve as many customers as possible, a particular Western restaurant adopts the "Staggered Seating" strategy on the night of Valentine’s day.
The strategy works as follows: The restaurant divides its opening hours into $N$ non-overlapping time inter... | *Let’s solve a simpler problem: Assume we already have a target duration, and we would like to extend the time intervals to (at least) match that target duration.*
This can be solved using a greedy algorithm: consider the intervals in chronological order. For each interval considered, set the starting time of the inte... | [
"3\n19:00 - 20:00\n21:08 - 21:24\n22:00 - 22:46",
"2\n19:01 - 19:02\n19:03 - 19:04"
] | [
"19:00 - 20:15\n20:15 - 21:30\n21:31 - 22:46",
"19:01 - 19:03\n19:03 - 19:04"
] | 2 | [] | [] | 0 | false | true | intervalscheduling2 | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K,Problem_L
1,Cossacks and Samurai,12,1447,169 min,111 min,1196 min,1253 min,5224 min,1103 min,148 min,1215 min,185 min,133 min,119 min,291 min
2,The Spider from Mars,8,9... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a/standings | 15 | null | 0 | 15 | 100 | 129 | 1,151.5 | 0 | null | T1 | ||||
CS3233_2024_Midterm_joining_points | J | joining_points | Joining Points | CS3233_2024_Midterm | CS3233 Midterm Contest 2024 | 2024 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a | 15 | 12 | 1 sec | 1024 MB | # Problem Statement
You have $N$ points on a Cartesian coordinate plane. The $i$-th point is located at $(X_i, Y_i)$, where $X_i$ and $Y_i$ are integers.
As a competitive programmer, you hate non-rectilinear geometrical objects. Therefore, you wish to connect all the points such that the resulting shape is a square, w... | The key observation is to consider the bounding rectangle of the points, that is, the minimum and maximum $x$- and $y$-coordinates over the points. This bounding rectangle is the only possibility if there is at least one point on each side of the square.
What if there are no points on at least one side of the square? ... | [
"3\n7 6\n2 4\n4 0",
"4\n2 6\n8 8\n10 2\n3 3"
] | [
"2 8 0 6",
"Impossible"
] | 2 | [] | [] | 0 | false | true | joiningpoints | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K,Problem_L
1,Cossacks and Samurai,12,1447,169 min,111 min,1196 min,1253 min,5224 min,1103 min,148 min,1215 min,185 min,133 min,119 min,291 min
2,The Spider from Mars,8,9... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a/standings | 15 | null | 0 | 15 | 100 | 125 | 1,474.4 | 0 | null | T1 | ||||
CS3233_2024_Midterm_key_item_recovery | K | key_item_recovery | Key Item Recovery | CS3233_2024_Midterm | CS3233 Midterm Contest 2024 | 2024 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a | 15 | 12 | 1 sec | 1024 MB | # Problem Statement
Pichuu, the Pokemon Master, faced a dilemma after destroying Team Galactic, becoming the champion and catching every legendary Pokemon. He realized he had lost his town map, a precious item given to him by his mother and also a Key Item! To avoid her scolding, Pichuu decided to reconstruct the map.
... | Let’s remove node 1 from the tree. This will split the tree into $1 \leq K$ subtrees.
Note that if $A_{i,j} > 1$ then nodes $i$ and $j$ are in the same subtree. Since nodes in different subtree will have to pass through town 1 in the original tree and having a minimum node of 1. Now we have a way of identifying if two... | [
"3\n1 1 1 \n1 2 1 \n1 1 3",
"6\n1 1 1 1 1 1 \n1 2 2 2 2 2 \n1 2 3 2 2 2 \n1 2 2 4 2 2 \n1 2 2 2 5 2 \n1 2 2 2 2 6"
] | [
"2 1\n3 1",
"2 3\n2 4\n2 5\n2 6\n1 2"
] | 2 | [] | [] | 0 | false | true | keyitemrecovery | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K,Problem_L
1,Cossacks and Samurai,12,1447,169 min,111 min,1196 min,1253 min,5224 min,1103 min,148 min,1215 min,185 min,133 min,119 min,291 min
2,The Spider from Mars,8,9... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a/standings | 15 | null | 0 | 15 | 100 | 111 | 828.8 | 0 | null | T1 | ||||
CS3233_2024_Midterm_large_differences | L | large_differences | Large Differences | CS3233_2024_Midterm | CS3233 Midterm Contest 2024 | 2024 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a | 15 | 12 | 1 sec | 1024 MB | # Problem Statement
Tom has $N$ objects of various heights, where object $i$ has height $H_i$. He wants to line them up in a row and take a photo of them. Since he likes chaos, he wants the photo to look as disorderly as possible. In particular, given an arrangement, he will calculate the minimum difference in heights,... | Sort the array and suppose $ a_1 \leq a_2 \leq \cdots \leq a_n $. Consider 2 cases.
**Case 1**: $ n = 2k $.
Note that for any $ k+1 $ elements of $ a $, there must be two which are adjacent. Thus among $ a_1, \ldots, a_{k+1} $, there are two of them which are adjacent. Thus there is an adjacent difference which is at... | [
"4\n2 6 10 2",
"5\n2 6 7 3 8"
] | [
"4",
"4"
] | 2 | [] | [] | 0 | false | true | largedifferences | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K,Problem_L
1,Cossacks and Samurai,12,1447,169 min,111 min,1196 min,1253 min,5224 min,1103 min,148 min,1215 min,185 min,133 min,119 min,291 min
2,The Spider from Mars,8,9... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2324/assignments/xbuv2a/standings | 2 | null | 13 | 2 | 13.3 | 291 | 2,768.5 | 0 | null | T3 | ||||
CS3233_2025_Midterm_arts_and_computing_students | A | arts_and_computing_students | Arts and Computing Students | CS3233_2025_Midterm | CS3233 Midterm Contest 2025 | 2025 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2425/assignments/nuv64c | 16 | 11 | 1 sec | 1024 MB | # Problem Statement
To encourage interdisciplinary collaboration, the School of Computing has decided to hold a dinner event for students in School of Computing and the Faculty of Arts and Social Sciences. The event will be held in a large hall with a long table that can seat $2N$ students. Interestingly, the $2N$ sea... | There are two solutions to this problem:
- **Dynamic Programming**: Observe that our ultimate goal is to pair up the students as much as possible, as we risk running out of space (there are only $N$ pairs of seats) if we do not pair them up sufficiently. We can let $\texttt{dp}[i]$ be the minimum number of pairs neede... | [
"3\nC.AAAC",
"4\nAAA.CCAC",
"4\nCA.A.C.A"
] | [
"YES\nCAA.AC",
"NO",
"YES\nCA..ACA."
] | 3 | [
"3\nC.AAAC",
"4\nAAA.CCAC",
"4\nCA.A.C.A"
] | [
"YES\nCAA.AC",
"NO",
"YES\nCA..ACA."
] | 3 | false | true | artsandcomputing | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K
1,Team 2,10,1133,195 min,117 min,,2166 min,2107 min,5253 min,113 min,3151 min,260 min,128 min,163 min
2,Team 1,10,1148,160 min,126 min,,1148 min,250 min,6265 min,122 mi... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2425/assignments/nuv64c/standings | 9 | null | 7 | 9 | 56.2 | 160 | 2,329.2 | 0 | null | T2 | ||||
CS3233_2025_Midterm_brilliance_of_wings | B | brilliance_of_wings | Brilliance of Wings | CS3233_2025_Midterm | CS3233 Midterm Contest 2025 | 2025 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2425/assignments/nuv64c | 16 | 11 | 1 sec | 1024 MB | # Problem Statement
Mashiro has a tree with $N$ vertices and $N - 1$ unweighted edges. It is known that any two vertices in the tree are connected.
Mashiro wants to perform a *Morfonication* on the tree. To put it simply, Mashiro will do several operations to transform the original tree to a new tree to her liking. E... | Let $n$ be the number of nodes and $m$ be the number of edges that are shared between the two trees, the answer is then $n - 1 - m$.
**Proof:** Consider the following algorithm while there exists edges that are not shared between the two trees.
1. Delete an arbitrary edge from Tree 1 that is not in Tree 2
2. The gra... | [
"4\n1 2\n2 3\n3 4\n3 1\n4 1\n2 4"
] | [
"3"
] | 1 | [
"4\n1 2\n2 3\n3 4\n3 1\n4 1\n2 4"
] | [
"3"
] | 1 | false | true | brillianceofwings | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K
1,Team 2,10,1133,195 min,117 min,,2166 min,2107 min,5253 min,113 min,3151 min,260 min,128 min,163 min
2,Team 1,10,1148,160 min,126 min,,1148 min,250 min,6265 min,122 mi... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2425/assignments/nuv64c/standings | 16 | null | 0 | 16 | 100 | 117 | 144.3 | 0 | null | T1 | ||||
CS3233_2025_Midterm_chained_maimai_slides | C | chained_maimai_slides | Chained maimai Slides | CS3233_2025_Midterm | CS3233 Midterm Contest 2025 | 2025 | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2425/assignments/nuv64c | 16 | 11 | 1 sec | 1024 MB | # Problem Statement
maimai is an arcade rhythm game that plays on a circular touch screen surrounded by $8$ evenly spaced buttons. Apart from tap notes and hold notes other rhythm games have, *maimai* has a type of note unique to the game, which are slides. A slide is a path on the touch screen that goes from one butt... | Consider a valid set of slides with the minimum speed of the slide to be $L$ and the maximum speed to be $R$. It is no less optimal to consider **every** type of slide which speeds fall into this interval. Also, if a valid set of slides with speed interval $[L, R]$ can make a valid level, then so are sets with speed in... | [
"12 9\n4 4 7\n4 8 6\n8 5 5\n5 1 5\n1 6 7\n6 2 6\n2 7 10\n7 3 3\n3 4 7\n5 5 100\n6 3 1\n3 4 7",
"4 1\n1 3 5\n4 1 1\n1 8 4\n1 3 5",
"8 8\n1 2 1\n2 3 3\n3 4 5\n4 1 7\n5 6 9\n6 7 11\n7 8 13\n8 5 15",
"7 7\n1 2 1\n2 3 3\n3 4 5\n4 1 7\n5 6 9\n6 7 11\n7 5 13",
"23 8\n1 3 94\n3 5 94\n5 7 95\n7 1 95\n1 3 97\n4 1 98\... | [
"7",
"-1",
"14",
"-1",
"-1",
"17"
] | 6 | [
"12 9\n4 4 7\n4 8 6\n8 5 5\n5 1 5\n1 6 7\n6 2 6\n2 7 10\n7 3 3\n3 4 7\n5 5 100\n6 3 1\n3 4 7",
"4 1\n1 3 5\n4 1 1\n1 8 4\n1 3 5",
"8 8\n1 2 1\n2 3 3\n3 4 5\n4 1 7\n5 6 9\n6 7 11\n7 8 13\n8 5 15",
"7 7\n1 2 1\n2 3 3\n3 4 5\n4 1 7\n5 6 9\n6 7 11\n7 5 13",
"23 8\n1 3 94\n3 5 94\n5 7 95\n7 1 95\n1 3 97\n4 1 98\... | [
"7",
"-1",
"14",
"-1",
"-1",
"17"
] | 6 | false | true | chainslides | Rank,Team_Name,Problems_Solved,Total_Time,Problem_A,Problem_B,Problem_C,Problem_D,Problem_E,Problem_F,Problem_G,Problem_H,Problem_I,Problem_J,Problem_K
1,Team 2,10,1133,195 min,117 min,,2166 min,2107 min,5253 min,113 min,3151 min,260 min,128 min,163 min
2,Team 1,10,1148,160 min,126 min,,1148 min,250 min,6265 min,122 mi... | https://nus.kattis.com/courses/CS3233/CS3233_S2_AY2425/assignments/nuv64c/standings | 0 | null | 16 | 0 | 0 | 0 | 0 | 0 | null | T3 |
Idea First, Code Later: CP Benchmark
Benchmark dataset for the paper: "Idea First, Code Later: Disentangling Problem Solving from Code Generation in Evaluating LLMs for Competitive Programming"
A curated benchmark of 83 competitive programming problems designed for evaluating LLMs on algorithmic problem-solving separately from code generation.
Motivation
We curate problems from seven contests that are not hosted on major public CP platforms (e.g., Codeforces, AtCoder). While some problem statements may be publicly accessible (e.g., contest PDFs or course materials), we expect contamination risk to be lower than for widely scraped judge platforms.
The problems come from regional ICPC contests and CS3233 (Competitive Programming course) examinations at the National University of Singapore, spanning 2017–2025.
What's Included
Each problem package includes:
- Original problem statement in Markdown format
- Gold editorial written by the problem setter or tester (solution analysis)
- Full official test suite (sample + hidden test cases)
We rely on complete judge test suites to avoid false positives in evaluation.
Difficulty Grouping
To account for variation in problem difficulty, we group problems using solve rates (the proportion of teams that solved the problem) from official scoreboards. Within each contest, problems are ranked by solve rate and partitioned into three contest-relative tertiles:
- T1 (easiest third)
- T2 (middle third)
- T3 (hardest third)
Pooling across contests yields approximately balanced difficulty groups while preserving each contest's intrinsic difficulty profile.
Dataset Composition
| Contest | Year | Source | #Teams | #Problems |
|---|---|---|---|---|
| CS3233 Midterm Contest | 2023 | NUS | 25 | 11 |
| CS3233 Midterm Contest | 2024 | NUS | 15 | 12 |
| CS3233 Midterm Contest | 2025 | NUS | 16 | 11 |
| ICPC Asia Pacific Championship | 2024 | GitHub | 65 | 13 |
| ICPC Asia Jakarta Regional | 2017 | GitHub | 80 | 12 |
| ICPC Asia Jakarta Regional | 2018 | GitHub | 75 | 12 |
| ICPC Asia Jakarta Regional | 2019 | GitHub | 80 | 12 |
| Total | -- | -- | -- | 83 |
Dataset Description
This dataset contains competitive programming problems with:
- Problem statements in Markdown format
- Test cases (input/output pairs)
- Solution analysis (where available)
- Contest metadata (difficulty, solve rates, etc.)
Sources
The problems are sourced from:
- ICPC Asia Pacific Championship 2024
- ICPC Jakarta Regionals (2017, 2018, 2019)
- CS3233 NUS Midterm Contests (2023, 2024, 2025)
Copyright and Permissions
The CS3233 portion of the dataset consists of course assessment materials from the National University of Singapore. We obtained copyright permission from the course instructor to include and redistribute these materials (problem statements, gold editorials) as part of our dataset release.
The CS3233 gold editorials are private course materials that were not publicly released prior to this work.
Dataset Structure
Each example contains:
Identifiers
| Field | Type | Description |
|---|---|---|
problem_id |
string | Unique identifier (contest_slug) |
problem_code |
string | Problem letter (A, B, C, ...) |
problem_slug |
string | URL-friendly problem name |
problem_title |
string | Full problem title |
Contest Information
| Field | Type | Description |
|---|---|---|
contest_name |
string | Contest identifier |
contest_full_name |
string | Full contest name |
year |
string | Competition year |
source |
string | Source URL/repository |
total_teams |
int | Total teams in contest |
total_problems |
int | Total problems in contest |
Problem Details
| Field | Type | Description |
|---|---|---|
statement |
string | Problem statement in Markdown |
analysis |
string | Editorial/solution analysis |
time_limit |
string | Time limit for solutions |
memory_limit |
string | Memory limit |
author |
string | Problem author |
analysis_author |
string | Editorial author |
Test Cases
| Field | Type | Description |
|---|---|---|
sample_test_cases_input |
list[string] | Sample inputs (public) |
sample_test_cases_output |
list[string] | Sample outputs (public) |
hidden_test_cases_input |
list[string] | Hidden inputs (judging) |
hidden_test_cases_output |
list[string] | Hidden outputs (judging) |
has_special_judge |
bool | True if problem accepts multiple correct outputs |
special_judge_code |
string | C++ scorer code (testlib) for validating outputs |
special_judge_format |
string | "standard" or "jakarta2017" |
uses_kattis |
bool | True for CS3233 (submit via Kattis) |
kattis_problem_id |
string | Kattis problem ID for submission |
contest_standings_csv |
string | Full contest scoreboard in CSV format |
scoreboard_url |
string | Original URL of the contest scoreboard |
Special Judge (Scorer)
Some problems accept multiple correct outputs for a given input (e.g., "output any valid permutation"). These problems have has_special_judge=True and include a C++ scorer in special_judge_code that validates whether a contestant's output is correct.
standard format (most contests):
./scorer <input_file> <judge_output_file> <contestant_output_file>
# Prints "AC" or "WA" to stdout
jakarta2017 format (ICPC Jakarta 2017 only):
./scorer <input_file> <unused> <judge_output_file> < contestant_output
# Reads contestant output from stdin
# Prints "WA" if wrong, nothing if correct
CS3233 Contests (Kattis Submission)
For CS3233 problems, hidden test cases are not publicly available (hosted on Kattis). Sample test cases are extracted from problem statements.
To submit solutions, set up Kattis CLI following the instructions in their repository, then run:
kattis <solution_file> -p <problem_id> -f
The kattis_problem_id field contains the Kattis problem ID for submission.
Notes on Empty Fields
Some fields may be empty depending on the contest source:
| Field | When Empty | Reason |
|---|---|---|
hidden_test_cases_* |
CS3233 contests | Test cases hosted on Kattis, not public |
author, analysis_author |
CS3233 contests | Author info not available |
special_judge_* |
Most problems | Only ~40% of problems need special judges |
kattis_problem_id |
ICPC contests | Only CS3233 uses Kattis |
memory_limit |
Some ICPC contests | Not always specified |
Contest Statistics
| Field | Type | Description |
|---|---|---|
teams_solved |
int | Number of teams that solved |
teams_wrong_answer |
int | Teams with wrong answers |
teams_unattempted |
int | Teams that didn't try |
teams_tried |
int | Teams that attempted |
solve_percentage |
float | % of teams that solved |
first_solve_time |
int | Time to first solve (minutes) |
average_solve_time |
float | Average solve time (minutes) |
total_attempts |
int | Total submission attempts |
average_attempts |
float | Average attempts per team |
Difficulty_Tertile |
int | Difficulty rank in contest |
Usage
from datasets import load_dataset
dataset = load_dataset("samahadhoud/idea-first-code-later-cp")
# Access a problem
problem = dataset["train"][0]
print(problem["problem_title"])
print(problem["statement"])
# Get test cases
for inp, out in zip(problem["sample_test_cases_input"], problem["sample_test_cases_output"]):
print(f"Sample Input: {inp[:100]}...")
print(f"Sample Output: {out[:100]}...")
# Hidden test cases for evaluation
print(f"Hidden test cases: {len(problem['hidden_test_cases_input'])}")
Test Runner
Use the provided test runner to evaluate solutions:
from hf_test_runner import TestRunner
runner = TestRunner()
# Run a C++ solution
results = runner.run_solution(
problem_id="icpc-jakarta-2017_icpc",
solution_code="""
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
cout << n * 2 << endl;
return 0;
}
""",
language="cpp"
)
print(results["status"]) # "PASSED" or error type
The test runner automatically handles:
- Sample and hidden test cases
- Special judges (problems with multiple valid outputs)
- Kattis submission (for CS3233 problems via kattis-cli)
- Memory and time limits
Citation
If you use this dataset in your research, please cite the following paper:
@misc{hadhoud2026ideafirstcodelater,
title={Idea First, Code Later: Disentangling Problem Solving from Code Generation in Evaluating LLMs for Competitive Programming},
author={Sama Hadhoud and Alaa Elsetohy and Frederikus Hudi and Jan Christian Blaise Cruz and Steven Halim and Alham Fikri Aji},
year={2026},
eprint={2601.11332},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2601.11332}
}
License
MIT License
- Downloads last month
- 167