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 results6,365 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Low Range-Sum MatrixFlip signs of at most K cells in an N by M matrix (both at most 10) so that no horizontal or vertical contiguous segment sums to more than S. | Hard9 | Brute forceDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Magic TrianglesGiven up to 100000 counter-clockwise triangles, compute the area of their common intersection. | Hard9 | GeometryDivide and conquer+2 | No attempts yet | 2s | 512 MB | Judgeable |
| mex and QueriesMaintain a set of natural numbers under range add, range remove, and range toggle queries, then output the mex after each of up to 100000 queries with values up to 1e18. | Hard9 | Segment treeIntervals+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Africa 2Submit code that matches the judge on exactly half its hidden test cases while passing the sample, a problem about exploiting judge behavior rather than a computable answer. | Hard9 | ImplementationBrute force+2 | No attempts yet | 1.357s | 1357 MB | Judgeable |
| Gahui's Sequence Mod Play (Large)Maintain a stack under push and pop, and after each type 3 query report the shortest suffix whose remainders mod m cover every residue from 0 to m-1, printing -1 if impossible. | Hard9 | StackTwo pointers+2 | No attempts yet | 1s | 256 MB | Judgeable |
| ValleysGiven an N x N grid of distinct heights, sum the sizes of all non-holey edgewise-contiguous regions whose cells are strictly lower than every orthogonally adjacent border cell. | Hard9 | Union-findGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Maintaining a SequenceMaintain a sequence under insert, delete, range assign, reverse, range sum, and global maximum subarray queries. | Hard9 | Dynamic programmingImplementation+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Parameterized Pattern MatchingFind every substring of text T that p-matches pattern P, where parameter names must correspond under a bijection and tokens match exactly. | Hard9 | StringString matching+2 | No attempts yet | Not set | 16 MB | Judgeable |
| Sequence and Queries 26Maintain a sequence under range chmin updates, range maximum queries, and range sum queries, with up to a million elements and queries. | Hard9 | Segment treeDynamic programming+2 | No attempts yet | 4s | 512 MB | Judgeable |
| CalculatorStarting from X=0, reach a given N by pressing +2, -2, *2, /2 (floor) at most 99 times while X stays in [0, 2^63-1], or report that it is impossible. | Hard9 | Binary searchMath+2 | No attempts yet | 1s | 256 MB | Judgeable |
| HotelMaintain an array under point height updates; after each update answer queries for the longest subsegment inside [l, r] that contains no strict interior valley. | Hard9 | Segment treeArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Two TransportationsTwo programs, each holding one set of weighted edges, exchange at most 58000 bits to compute single-source shortest path distances from city 0 in the union graph. | Hard9 | Shortest pathGraph+2 | No attempts yet | 10s | 256 MB | Judgeable |
| CandiesFor each j, find the maximum sum of j non-adjacent values chosen from N candies in a row. | Hard9 | Dynamic programmingGreedy+2 | No attempts yet | 5s | 512 MB | Judgeable |
| CityAssign small integer codes to nodes of a tree where depth from node 0 is at most 18, so that a decoder with only the two codes can tell which of two cities lies on the path from 0 to the other. | Hard9 | TreeBit manipulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| EmploymentGiven candidate evaluation values with point updates, answer queries asking for the number of maximal contiguous blocks of hired candidates whose value is at least a threshold. | Hard9 | Segment treeDivide and conquer+2 | No attempts yet | 5s | 512 MB | Judgeable |
| MessengerDesign strategies for two players who alternately move a piece on a 4x4 grid, knowing neither the call order nor its timing, so B can deduce the secret value X within 10000 moves. | Hard9 | ImplementationSimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| DivModuloCompute C(M,N) after removing every factor of D, and report the remainder modulo D, for M up to 4e18 and D up to 1.6e7. | Hard9 | MathNumber theory+2 | No attempts yet | 3s | 1024 MB | Judgeable |
| Colored Paper and QueriesGiven N axis-aligned rectangles and M axis-aligned query rectangles, report for each query the maximum number of input rectangles covering any single point inside it. | Hard9 | Segment treeDivide and conquer+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Six WordsGiven a connected graph whose vertex i has potential i and edge i has weight i, find the total weight of a minimum spanning tree of the line graph of the line graph. | Hard9 | GraphMinimum spanning tree+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Um_nik's AlgorithmGiven an undirected bipartite graph with up to 2e6 vertices and edges per side, output a matching whose size is at least 0.95 times the maximum matching size, with heavy constant-factor optimization required. | Hard9 | GraphGreedy+2 | No attempts yet | 4s | 512 MB | Judgeable |
| FFT AlgorithmGiven m and k, find a primitive 2^k-th root of unity modulo m, or report that none exists. | Hard9 | Number theoryMath+2 | No attempts yet | 1.5s | 512 MB | Judgeable |
| Bracket Euler TourFind an Euler tour of an undirected graph whose vertex bracket labels, read in traversal order, form a correct bracket sequence, or report that none exists. | Hard9 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| One RootCount pairs (p, q) with |p|, |q| <= m for which x^n + px + q has exactly one real root. | Hard9 | MathNumber theory+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Another Coin Weighing PuzzleGiven m weighings and k coins per bag, find the maximum number of bags whose unique heavy bag can be identified, modulo 998244353. | Hard9 | CombinatoricsMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Counting Edit DistancesCount the number of distinct strings over 'A' to 'Z' whose Levenshtein distance from a given string s is exactly d, modulo 998244353. | Hard9 | Dynamic programmingString+2 | No attempts yet | 10s | 512 MB | Judgeable |
| Basis ChangeGiven one linear recurrence with coefficients a_i, find the unique recurrence with prescribed lags b_i that every sequence satisfying the first also satisfies. | Hard9 | MathImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Long GamePlayers alternately cut a strip of a permutation while every cut must leave at least one strip containing an inversion; decide the winner with optimal play. | Hard9 | Game theoryGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| FarawayCount lattice points (xe, ye) in [0, m]^2 such that for each of up to 10 constraints, (|xi - xe| + |yi - ye|) mod ki equals ti, with ki at most 5 and m up to 1e9. | Hard9 | MathNumber theory+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Decimal ExpansionFor each query n up to 10^18, find the n-th digit after the decimal point of the infinite product (9/10)(99/100)(999/1000)... | Hard9 | MathNumber theory+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Linear Congruential GeneratorGiven a linear congruential generator and two index ranges, sum X_i mod (X_j+1) over all pairs i in the first range and j in the second. | Hard9 | MathNumber theory+2 | No attempts yet | 2s | 512 MB | Judgeable |
| IneqGiven a finite set S of integer lattice points, decide whether S can be cut out as exactly the integer points lying strictly below every line of some finite family of half-planes. | Hard9 | GeometryMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Delightful (Hard)Write a program of at most 5000 commands for a ternary computer with 26 forty-trit registers that sets Y to 1 if the input X (0 to 109) is prime and 0 otherwise. | Hard9 | Number theoryImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Xorshift32Given a starting value x and a target t, find the index at which t first appears in the Xorshift32 pseudorandom sequence. | Hard9 | MathBit manipulation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| 814 - 2Print an 8 by 14 grid of digits so that every number from 1 up to some X can be traced as an adjacent-cell path, maximizing X. | Hard9 | GraphDFS+2 | No attempts yet | 0.814s | 814 MB | Judgeable |
| OR and QueriesProcess range bitwise-OR updates on an array and count how many positions in a range currently equal a fixed K. | Hard9 | Segment treeBit manipulation+2 | No attempts yet | 1.5s | 256 MB | Judgeable |
| Nonogram QRSolve a chain of 2000 nonograms to reconstruct QR codes, decode them, follow indicator links, and recover a flag. | Hard9 | BacktrackingSimulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| CerealGiven a queue of cows each with a favorite and second-favorite cereal, report for every prefix removal how many cows still get a box. | Hard9 | GreedySimulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Integer Equation CheckerClassify an equation string as correct, format error, math error, or a typo fixable by replacing at most two characters with a valid correct equation. | Hard9 | Brute forceImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Yet Another Problem on EmpodiaCount, for each length i up to N, the number of equivalence classes of permutations of length i under the relation that agrees on which intervals are framed (max minus min equals length minus one), modulo a prime. | Hard9 | CombinatoricsDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Continue the SequenceGiven n values, extend the sequence by m terms so that it agrees with a polynomial of the smallest possible degree modulo 998244353. | Hard9 | MathNumber theory+2 | No attempts yet | 4s | 256 MB | Judgeable |
| AdditionDesign a short string-rewriting script in a custom language that reads two binary numbers joined by + and rewrites them into their binary sum. | Hard9 | String matchingSimulation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Array ChallengeGiven a linear recurrence h and closed-form arrays b and a, compute floor(sqrt(a_n)) modulo 1e9+7 for n up to 1e15. | Hard9 | MathNumber theory+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Master Zhu and Magic NumbersGiven sparse positions of ones in a triangular binary layout, simulate a bitwise dependency program to get values b_j, then answer queries asking for the popcount of ORs of selected b_j. | Hard9 | Bit manipulationImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Master Zhu and CandiesGiven n candy heaps, players may remove any positive number from one heap or split one heap into three non-empty heaps; decide the winner under optimal play. | Hard9 | Game theoryMath+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Master Zhu and RootFor each query (x, y), find the smallest k >= 0 with x^k congruent to y modulo some prime divisor p of n, or report -1. | Hard9 | Number theoryMath+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Flip a CoinTwo players each pick a heads/tails string of length up to 20; a fair coin is flipped until one or both strings appear, and we must output the probabilities of Alice winning, Bob winning, and a tie. | Hard9 | ProbabilityDynamic programming+2 | No attempts yet | 1s | 256 MB | Judgeable |
| K-th StringCount permutations t of n distinct letters whose k-th smallest non-empty substring equals s, modulo 1e9+7. | Hard9 | StringCombinatorics+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Ascent Sequences Avoiding Pattern 201Count ascent sequences of length n that avoid the pattern 201, modulo a prime p, with n up to 500. | Hard9 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Matrix and QueriesGiven an N x N integer matrix and Q values x, output det(A - xI) mod 998244353 for each query. | Hard9 | MathMatrix+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Navigation GameConstruct a 100x100 arrangement of the numbers 1 to 10000 that maximizes a navigation score, where jumps off the current row or column cost points. | Hard9 | GreedyImplementation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Sequence and Queries 39Maintain an array under range updates that add an arithmetic progression, and answer queries for the longest arithmetic-progression subarray inside a range. | Hard9 | Segment treeMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Holy cow, Vim! (Easy)Construct a stack-language program that outputs x, but outputs 2x when its lines are reversed and -x when its lines are sorted lexicographically. | Hard9 | ImplementationSimulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Holy cow, Vim! (Hard)Construct a stack-program whose lines, read normally, reversed, and lexicographically sorted, compute x, x squared, and negative x respectively. | Hard9 | ImplementationStack+2 | No attempts yet | 1s | 512 MB | Judgeable |
| The Potion of Great PowerGiven a graph whose edges change once per day with degree at most D, answer queries online for the minimum altitude difference between a neighbor of x and a neighbor of y on a given day. | Hard9 | GraphSorting+2 | No attempts yet | 3s | 256 MB | Judgeable |
| AtomsMaintain a sequence of charges under range add updates, and after restricting to a query segment, report the longest run of consecutive positions where each next charge exceeds the previous by exactly one. | Hard9 | Segment treeDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Fermat's Last TheoremOrder all positive quadruples (a,b,c,n) with n>=3 by max element then lexicographically, and print the sign of a^n+b^n compared to c^n for positions l through r. | Hard9 | MathCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Coalescing ContinentsGiven K rectangles with total area 25 on a 20x20 grid, decide if they can be translated to tile a square, and find the minimum total moves. | Hard10 | Brute forceMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| GeneratorRead an index 0 to 10 and output the exact contents of the matching recovered file gen_i.out from the archive. | Hard10 | ImplementationString+2 | No attempts yet | 2s | 256 MB | Judgeable |
| LogoGiven up to five polyomino patch shapes (each a subset of a 3x3 grid, flippable and rotatable) and up to three grid designs up to 55x5, decide if each design can be tiled exactly by non-overlapping patches and find the minimum patch count, or report NIE. | Hard10 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| String Palindrome QueriesMaintain a lowercase string under block moves, reversals, and single-character insertions, answering after each change whether a given substring reads the same forwards and backwards. | Hard10 | StringString matching+1 | No attempts yet | 2s | 256 MB | Judgeable |
| RobotsDesign two robots' instruction tables so they classify a binary string as fine or coarse from its middle third's A and B counts, using four-bit memories, exact-then-wildcard dispatch, and 1000n steps. | Hard10 | ImplementationBit manipulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Natural ParkReconstruct the exact edge set of a sparse connected graph with degree at most 7 using at most 45,000 connectivity queries over chosen subsets. | Hard10 | GraphBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Dungeon 2Explore an unknown connected graph through a move-and-color oracle and report, for each i, how many room pairs have shortest-path distance exactly i. | Hard10 | GraphBFS+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Shadow CompanionConstruct a fixed program over a bit tape with a shadow that transforms every input n < 2^10 into n squared. | Hard10 | SimulationBit manipulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Delightful (Easy)Write a program of at most 100 commands for a ternary computer with 26 40-trit registers that computes the length of the longest non-decreasing prefix of the input in register X and leaves the answer in Y. | Hard10 | ImplementationSimulation+2 | No attempts yet | 1s | 512 MB | Judgeable |