Problems
Pick a problem and write your solution in the built-in editor. The judge runs it against real test cases while you watch, and the wider archive is open to read whenever you like.
Total results514 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Starting LineupAssign 11 players to 11 positions, each with ability 0 to 100, maximizing total ability while avoiding zero-ability slots; every player suits at most 5 positions. | Medium6 | BacktrackingBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Flip It!Simulate a sequence of row and column flips that collapse a grid of cards into one pile, then list the face-up cards from the bottom. | Medium6 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Challenge 24From four distinct positive integers, enumerate every value reachable using each number once with +, -, *, and even-only division, then report the longest run of consecutive integers, choosing the largest start on ties. | Medium6 | Brute forceRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Based Integer ConstantsFor each string, decide whether it is a valid Ada integer constant, which may nest a based integer as the base of another based integer. | Medium6 | StringRecursion+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Euclid's GameGiven two starting numbers, decide who wins the subtraction game Euclid's Game under optimal play, for each pair until the terminating 0 0 line. | Medium6 | Game theoryMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Build a Square from SticksGiven up to 20 stick lengths, decide whether all sticks can be split into four groups of equal total length. | Medium6 | BacktrackingRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Sang-geun's LockCount the number of height-balanced binary trees with N nodes, print the last 9 digits padded to width 9. | Medium6 | Dynamic programmingRecursion+1 | No attempts yet | 1s | 128 MB | Judgeable |
| George Lucas and 1138Given a digit string, use all its digits with +, -, *, / and parentheses, and report the smallest positive integer that no expression can produce. | Medium6 | Divide and conquerBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Falling LeavesGiven the leaf-removal stages of a binary search tree, reconstruct the unique tree and print its preorder traversal. | Medium6 | TreeRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ChemistryParse a chemical formula with nested parentheses and multipliers, then output each element's total atom count in lexicographic order. | Medium6 | StackString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Removing ParenthesesGiven an expression of single-letter variables with addition and multiplication, remove every pair of parentheses that can go without changing the value, and print the result. | Medium6 | StackString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ResistorsParse a nested expression of series and parallel resistor connections and output the exact resistance as a reduced fraction. | Medium6 | StringStack+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Last DigitsFor each test case, print the last n digits (with leading zeros) of the power tower of height i with base b. | Medium6 | Number theoryMath+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Newton's AppleParse two binary trees from post-order tokens with nil markers, then decide whether one can be turned into the other by swapping left and right children at any nodes. | Medium6 | TreeRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Off BalanceGiven a 2D grid of digit-labeled blocks, group 4-block pieces, build the support tree, and check each piece's accumulated center of mass against its bottom-column span. | Medium6 | DFSTree+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Genome Database of All Space LifeDecode a run-length compressed genome string with nested parentheses and print the character at index i, or 0 if the index is out of range. | Medium6 | StringRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Counting ProblemFor each pair (a, b), count how many times each digit 0 through 9 appears when writing every integer between them, inclusive. | Medium6 | MathImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| A Foldy but a GoodyGiven a string of U and L folds, find the coordinates of the m-th point (end or right angle) on the unfolded strip. | Medium6 | RecursionDivide and conquer+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Fractal DistanceGiven the order of two houses along an n-th Hilbert curve, compute the straight-line distance between their grid positions. | Medium6 | Divide and conquerRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| PalindromeGiven a string, find the minimum number of characters to insert anywhere so the string becomes a palindrome. | Medium6 | Dynamic programmingString+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Binary Search TreeGiven the preorder traversal of a binary search tree, print its postorder traversal. | Medium6 | TreeDivide and conquer+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Justice LeagueDecide whether the graph of heroes can be split into a clique and an independent set. | Medium6 | GraphDivide and conquer+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Moo GameGiven N up to 1e9, report whether the N-th character of the recursively defined Moo sequence is 'm' or 'o'. | Medium6 | RecursionDivide and conquer+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Instant ComplexityParse a small nested-loop program, compute its running time as a polynomial in n, and print the collected polynomial from highest degree down. | Medium6 | ImplementationStack+2 | No attempts yet | 1s | 128 MB | Judgeable |
| StrategyParse a small strategy language, then simulate every pair of up to 10 programs for 10 rounds and print each program's total score. | Medium6 | ImplementationSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Paper FoldingDraw the dragon curve made by folding a strip of paper N times and opening each crease to 90 degrees, using underscores and bars. | Medium6 | ImplementationSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Car TriallingParse each line against a small case-sensitive grammar and decide whether it is a valid car-trialling instruction, echoing it with spaced collapsed or printing Trap!. | Medium6 | StringImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| AnagramFor each given word, print every distinct string formed by rearranging its letters, in lexicographic order with duplicates removed. | Medium6 | BacktrackingSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Even a Kindergartner Could Solve ThisDecide whether each string over the alphabet {, }, and comma is a valid set by the given grammar, where brace characters can be either delimiters or atoms. | Medium6 | StringDynamic programming+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Boolean LogicParse a fully parenthesized proposition formula, then print a truth table with each subformula's value placed at its symbol or operator column. | Medium6 | ImplementationRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Tree PruningGiven a rooted binary tree with colored nodes, prune subtrees to make the whites minus blacks equal exactly D, minimizing the number of prunes. | Medium6 | TreeDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| FractalsDraw a level-`level` block fractal of given width from (0,1) to (width,1) and list, in order, every integer y where the vertical line x meets a segment. | Medium6 | RecursionImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Sum of ProductsExpand a polynomial-like expression of variables into a sum of products, then sort each term's letters and sort the terms lexicographically. | Medium6 | StringRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| QuadtreesGiven two quadtree preorder strings for 32x32 black-and-white images, count the black pixels in their union by recursively merging overlapping quadrants. | Medium6 | RecursionTree+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Tree IsomorphismGiven two rooted trees in pre-order with '#' closing each node's child list, decide whether the trees are isomorphic ignoring node labels. | Medium6 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Turning a TreeReroot a given ordered tree at a specified leaf so the counter-clockwise order of neighbors at each node stays the same, then print the new tree. | Medium6 | TreeDFS+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Code FormattingParse a TRIVIAL program given by a grammar and print it back with strict indentation and whitespace rules. | Medium6 | ImplementationRecursion+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Beth TableauxParse a propositional formula and either report it valid or print the lexicographically smallest falsifying assignment. | Medium6 | BacktrackingImplementation+2 | No attempts yet | 2s | 64 MB | Judgeable |
| Fractal CakePrint the chocolate pattern of a rectangular window in a 2^(N+1) square grid built by recursively darkening the middle 2x2 of every 4x4 block N times. | Medium6 | Divide and conquerRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Another Rock-Paper-Scissors ProblemGiven a game number N up to 10^12, determine the move that beats Sonny's move in his self-similar rock-paper-scissors sequence. | Medium6 | RecursionDivide and conquer+1 | No attempts yet | 2s | 512 MB | Judgeable |
| SpreadsheetEvaluate a small 9x26 spreadsheet where each cell holds an integer expression with +, -, *, / and cell references, reporting 1000000 if cell A1 is part of a circular reference. | Medium6 | ImplementationDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Paper FoldingRepeatedly fold the left part of a binary strip over the right where symbols match and find the shortest reachable length. | Medium6 | Dynamic programmingString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Binary Search TreeCount the insertion orders that build the same binary search tree as the given permutation. | Medium6 | CombinatoricsTree+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Binary Search Tree 2Count the permutations of 1 to N that build the same binary search tree as the given permutation. | Medium6 | CombinatoricsTree+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SignalsCompare the signal sets generated by two series-parallel circuit expressions and print whether they are equal, nested, disjoint or overlapping. | Medium6 | String matchingRecursion+1 | No attempts yet | 1s | 128 MB | Judgeable |
| CubeCut a W by L by H integer block into integer-sided cubes with the fewest cuts and output the number of cubes. | Medium6 | Dynamic programmingRecursion | No attempts yet | 10s | 128 MB | Judgeable |
| Who needs 8 queens when you can have N?Find the lexicographically smallest placement of N non-attacking queens on an N by N board for each test case. | Medium6 | BacktrackingRecursion+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Unscrambling ImagesThe solver recovers the hidden child order at each quadtree node from the test encoding and restores the secret image. | Medium6 | TreeRecursion+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Secret CodeCount the sequences of operations that build the given string from a source of length at least 2 by gluing each string to a copy missing one end character. | Medium6 | Dynamic programmingString matching+1 | No attempts yet | 1s | 128 MB | Judgeable |
| CarpetsDecide whether the given carpets, each usable rotated, cover a W by H room exactly with no overlap. | Medium6 | BacktrackingRecursion | No attempts yet | 1s | 256 MB | Judgeable |
| Above or Below the Koch CurveGiven a level L Koch curve from (0,0) to (1,0), decide whether each query point lies above or below the curve. | Medium6 | RecursionGeometry+1 | No attempts yet | 1s | 256 MB | Judgeable |
| DepactingDecode a nested Pact structure with run-length repeats and omitted record fields, then answer value queries on it. | Medium6 | RecursionString+1 | No attempts yet | 1s | 256 MB | Judgeable |
| ImplicationGiven formulas assumed true, decide for each query formula whether it holds under every assignment that satisfies all assumptions. | Medium6 | Brute forceBit manipulation+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Hilbert SortSort up to 200,000 labeled grid points by the order in which the Hilbert curve visits them. | Medium6 | RecursionSorting+1 | No attempts yet | 5s | 256 MB | Judgeable |
| Infinite Garden (Large)Compute the shortest axis-aligned route between two even-coordinate points in the maze drawn by the tape-driven robot without crossing its walls. | Medium6 | BFSSimulation+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Equivalent StringsDecide whether two equal-length strings are equivalent under recursive splitting and optional swap of halves. | Medium6 | Divide and conquerString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| The Halting ProblemGiven a small register program that may call itself recursively, decide whether it halts on the input and output the returned value, or print * if it runs forever. | Medium6 | SimulationRecursion+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Tiling PolygonsTile a rectilinear polygon with 1x3 and 3x1 tiles, choosing at each step the lexicographically smallest covering grid. | Medium6 | BacktrackingRecursion+2 | No attempts yet | 8s | 512 MB | Judgeable |
| Hamiltonian HypercubeGiven two binary strings in Gray Code order, count how many code words lie strictly between them on the n-bit Gray Code path. | Medium6 | Bit manipulationRecursion+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Cactus ConstructionGiven a cactus as edge-disjoint paths, simulate the fixed recursive procedure that emits join, recolor, and connect operations assembling it with four colors. | Medium6 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Small Ping Pong TournamentGiven the total points each of 2^N players scored, decide whether Dudu (first score) can be the champion. | Medium6 | Brute forceRecursion+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Attendance RecordRearrange the letters of a record over A, B, C so the result is valid (B needs one rest day, C needs two) and lexicographically smallest. | Medium6 | GreedyBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Rather Perplexing Showdown (Small)Find the alphabetically smallest left-to-right lineup of R rocks, P papers, and S scissors so that a single-elimination bracket never pairs identical moves. | Medium6 | Divide and conquerRecursion+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Fractiles (Small)Choose at most S tile positions to inspect so that, for any original K-tile sequence, you can decide whether some gold tile exists. | Medium6 | RecursionMath+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Secret Cow CodeAn infinite code string grows by doubling: each step appends the current string rotated right by one. Find the N-th character. | Medium6 | RecursionDivide and conquer+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Tiling the Shower Floor (Large)Fill a 2^K by 2^K grid with L shaped trominoes leaving one drain cell empty, using the specified recursive placement and numbering scheme. | Medium6 | Divide and conquerRecursion+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Flow Graph ComplexityParse a comma-separated flow-graph string of S, B(...), L(...) nodes, count forward and backward edges and nodes, and print |EF| + W*|EB| - |V| + 2 or -1 if malformed. | Medium6 | StringImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Philosopher's WalkGiven the step index m along a Hilbert curve of side n = 2^k, find the cell coordinates (x, y) of that step. | Medium6 | Divide and conquerRecursion+2 | No attempts yet | 0.5s | 512 MB | Judgeable |
| Decisions, DecisionsGiven the truth table of an n-variable boolean function, count the vertices in its unique minimal binary decision diagram. | Medium6 | Dynamic programmingDivide and conquer+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Tournament ChartParse a knockout bracket given as a string and decide whether the reported win counts for all players can be consistent with some assignment of match winners. | Medium6 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Shredding CompanySplit a digit string into contiguous pieces so their sum is as large as possible without exceeding a target, reporting rejection on ties and error when even the smallest sum is too big. | Medium6 | BacktrackingBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Inserting Operators (2)Insert one of +, -, x, / between each adjacent pair from a limited supply, evaluating left to right with C++14 integer division, and report the largest and smallest results. | Medium6 | BacktrackingBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Dragon CurveGenerate the segments of N dragon curves on a 101 by 101 grid, mark the grid points they pass through, and count unit squares whose four corners are all marked. | Medium6 | ImplementationRecursion+2 | No attempts yet | 1s | 512 MB | Judgeable |
| You on That DayGiven measured environmental factors and one-operation definitions, compute each factor's partial derivative of HAPPY and print it as a reduced fraction. | Medium6 | Dynamic programmingDFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Eli's Curious ExperimentCount the maximal independent sets of a path on N vertices that have size at least two, for many N up to 76, labeled by test case number. | Medium6 | Dynamic programmingCombinatorics+1 | No attempts yet | 3s | 512 MB | Judgeable |
| The Total is RightDecide whether a target N can be formed exactly from up to six given integers using +, -, times, and exact division with positive intermediates. | Medium6 | Brute forceRecursion+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Drawn and QuarteredA fixed permutation is applied to a string K times; find where each index goes and output the rearranged string. | Medium6 | MathBit manipulation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Curse of the MeetingCount the ways N people around a round table can pair up and shake hands simultaneously without any arms crossing, modulo 987654321. | Medium6 | Dynamic programmingCombinatorics+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Mini BattleshipCount the ways to place k distinct ships of given sizes on an n by n grid so that hits, misses, and empty squares all match the observed board. | Medium6 | BacktrackingBrute force+2 | No attempts yet | 6s | 512 MB | Judgeable |
| Binary Ternary Search Play 1For every index in a sorted array of size N, compare the number of probes binary search and ternary search need to reach it, and count how often binary wins, ties, and loses. | Medium6 | Divide and conquerBinary search+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Nested Set ModelRoot an undirected tree at S, traverse children in ascending order, and label each node with nested left/right interval numbers. | Medium6 | DFSTree+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| The Tower of PisaGiven n disks stacked on the first of three rods, where the second rod lets you move a group of top disks together, find the minimum moves to shift all disks to the third rod. | Medium6 | Dynamic programmingRecursion+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Modified HanoiSimulate a modified Tower of Hanoi with a no-repeat-move rule and a fixed move priority order, counting moves until all disks gather on one pole. | Medium7 | SimulationRecursion+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Last Josephus SurvivorGiven N people in a circle and a step size K up to 90, find the last person remaining after repeatedly removing every K-th person, with N up to 10^15. | Medium7 | MathRecursion+1 | No attempts yet | 2s | 128 MB | Judgeable |
| WarGiven a forest of vassal relations and per-country conquest costs, find the minimum days needed to conquer or force surrender of at least M countries using tree knapsack DP. | Medium7 | Dynamic programmingTree+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Special NodesIn a rooted tree where child weights exceed parent weights, mark vertices special or ordinary to minimize the total of each ordinary vertex's weight minus its nearest special ancestor's weight. | Medium7 | Dynamic programmingTree+2 | No attempts yet | 2s | 128 MB | Judgeable |
| RPGGiven quests that require either a strength or intelligence threshold and grant points to freely raise those stats, find the maximum number of quests completable. | Medium7 | Dynamic programmingSorting+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Binary Search TreeGiven the insertion order of 0..N-1 values, compute the sum of node heights in the resulting binary search tree efficiently for N up to 250000. | Medium7 | TreeDivide and conquer+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Youngsik FunctionCount integers in [A, B] up to 1e9 whose repeated adjacent-digit-difference reduction (the Youngsik function) eventually collapses to the single digit 7. | Medium7 | Dynamic programmingRecursion+2 | No attempts yet | 2s | 128 MB | Judgeable |
| O Yeongsik's TreasureGiven a reachable target Tower of Hanoi arrangement, find the shortest move sequence from the initial all-on-A state and print the disk positions after exactly M moves. | Medium7 | RecursionDivide and conquer+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Binary Tree DrawingGiven a binary tree reconstructed from preorder and inorder traversals, compute the minimum area of a grid drawing where each right child extends the row and each down child extends the column. | Medium7 | Dynamic programmingTree+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Compare Tree Traversal PathsGiven two 0/1 Euler-tour strings from DFS traversals of a tree rooted at the same vertex, decide whether both could come from the same underlying tree. | Medium7 | TreeString+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Unit Fraction DecompositionCount ways to write p/q as a sum of at most n unit fractions (order ignored) whose denominators multiply to at most a. | Medium7 | BacktrackingNumber theory+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Mobile Binary NumberGiven a nested-bar mobile whose bars may each be flipped independently, find the K-th lexicographically smallest distinct binary string obtainable across all flip combinations. | Medium7 | Dynamic programmingRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Clearing the BeadsFind the minimum number of beads to insert between colored beads so every bead can eventually be cleared by removing runs of length at least K. | Medium7 | Dynamic programmingStack+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Strange PainterReconstruct a picture painted by a recursive quadrant-coloring process closest (in Hamming distance) to a given N x N binary target, then output that minimal difference and the picture. | Medium7 | Divide and conquerDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Sierpinski TriangleGiven a Sierpinski-triangle sub-triangle's name string, output the names of all triangles it leans against based on the fractal's midpoint-subdivision structure. | Medium7 | StringRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Formula SubstitutionGiven two formula strings with variables 0 and 1, find basic-formula substitutions for both variables that make the two formulas syntactically identical, similar to unification. | Medium7 | RecursionString matching+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Non-boring SequencesDetermine whether every contiguous subarray of a sequence has at least one element unique within that subarray, using an efficient divide and conquer approach. | Medium7 | Divide and conquerArray+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Character EquationGiven a recursive definition of a huge string T through variable concatenation equations, determine whether a pattern P is a subsequence of T without expanding T explicitly. | Medium7 | Dynamic programmingString+2 | No attempts yet | 1s | 256 MB | Judgeable |