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 results868 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Kirchhoff's LawsGiven a resistor network, compute the equivalent resistance between node 1 and node N by solving Kirchhoff's laws. | Hard8 | GraphMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| It looks like the Fibonacci sequence, but...Sum F_i times i^k for i from 1 to n, where F is Fibonacci with F_1=1, F_2=2, and n can reach 10^17. | Hard8 | MathDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Number of good treesCount labeled trees on kn nodes split into n blocks of size k, with no edge inside a block, modulo 1e9+7. | Hard8 | CombinatoricsMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Binary StringsCount binary strings whose length lies in [L, R], is a multiple of K, and contains no two adjacent 1s, modulo 1e9+7. | Hard8 | MathCombinatorics+2 | No attempts yet | 1s | 512 MB | Judgeable |
| MaxplusGiven 3x3 integer matrices A and C, find the entrywise-largest integer matrix B with A (max-plus) B = C, or report that none exists. | Hard8 | MathMatrix+2 | No attempts yet | 1s | 128 MB | Judgeable |
| f(X) = A + X + B + X + CCount occurrences of pattern F in the K-fold string expansion f(X)=A+X+B+X+C applied to S, modulo 1e9+7. | Hard8 | String matchingDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Safe Squares (Large)Count all grid-aligned square regions of any size that contain no monster, given a sparse set of at most K monster cells on an R by C board. | Hard8 | ArrayDynamic programming+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Counting CyclesCount all closed walks (cycles) of length less than K in a directed graph, where rotations count separately, modulo M. | Hard8 | GraphMatrix+2 | No attempts yet | 2s | 512 MB | Judgeable |
| RaspadSum the number of connected components of 1-cells over every contiguous band of rows in an n by m grid, with m at most 50 and n up to 100000. | Hard8 | Dynamic programmingDivide and conquer+2 | No attempts yet | 6s | 1024 MB | Judgeable |
| COWBASICInterpret a tiny language of assignments, nested fixed-count MOO loops, and one RETURN, all additions taken modulo 10^9+7, and print the returned value. | Hard8 | ImplementationSimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Nemmo Nemmo (Hard)Count subsets of occupied cells in an N by M grid (N times M at most 300) that contain no full 2 by 2 square, modulo 1e9+7. | Hard8 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| ACGCount assignments of N ordered problems to three solvers so A's count is a multiple of k, C never solves two in a row, and G solves at least one, modulo 10000007. | Hard8 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Dango MakerChoose disjoint horizontal or vertical runs of three cells reading R, G, W in order on an N by M grid, maximizing how many such sticks fit. | Hard8 | Dynamic programmingMatrix+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Blocks 4Count the tilings of an N by M rectangle using blocks of size k by N (rotatable) for k from 1 to N, modulo 1999, where M can be as large as 1e10. | Hard8 | Dynamic programmingMath+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Sacred ScarecrowsCount subsets of empty cells in an R x C grid, modulo 1e9+7, such that every row has a scarecrow and every pair of consecutive columns has one. | Hard8 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Word ClockPlace n distinct words left to right on an h by w grid where words may share letters, or report that no placement exists. | Hard8 | BacktrackingImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| CherrypickFor each cell, find the axis-aligned square containing it that maximizes the minimum cherry sweetness minus the square of its side length. | Hard8 | MatrixBinary search+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Club Room ExpansionGiven each cell's count of walled directions (0 to 4), decide whether the grid can be fully partitioned into connected rooms of one to three cells fitting that wall count. | Hard8 | Dynamic programmingBacktracking+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Racial DiscriminationWith up to 10 categories and 200 people, each with a selected flag, choose at most c categories and a rule on their bit patterns that misclassifies as few people as possible, and output that minimum. | Hard8 | Bit manipulationBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Balcony RepairsGiven a huge R by C grid with at most 1000 blocked cells, place horizontal dominoes on free cells to maximize the count, then report that maximum and the number of ways modulo 1e9+7. | Hard8 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| PlateAssign labels to odd lattice points on a quadrant-by-quadrant recursive spiral, then sum labels of points on x + y = k. | Hard8 | MathSimulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Chemical tableGiven some cells of an n by m grid, fill the rest by purchasing cells and closing 2x2 rectangles; find the minimum number of purchases. | Hard8 | Union-findGraph+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Pixel TrianglesGiven up to four million right isosceles triangles on a 2000x2000 grid, count the total number of grid cells covered by at least one triangle. | Hard8 | Prefix sumMatrix+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Far, Far AwayGiven an n by n cost matrix and budget m, find the maximum number of edges on a walk from vertex 1 with total cost at most m; vertices and edges may repeat. | Hard8 | Binary searchGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Painting the Barn (Gold)Given N painted axis-aligned rectangles on a 200x200 grid, add up to two disjoint rectangles to maximize the total area covered by exactly K coats. | Hard8 | Prefix sumMatrix+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Raider Choragi and Queries (Normal)A donut-shaped ring of 2N zones holds prisoner counts that change over Q updates; after each change, print the minimum number of squads, each covering one zone or two adjacent zones with total at most W. | Hard8 | Dynamic programmingSegment tree+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Making Everything WhiteGiven an N by M black/white grid, choose for each cell one of three local color-inversion actions so that every cell ends up white, or report impossibility. | Hard8 | GreedyImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Counting Spanning TreesCount spanning trees of a path graph where every pair of nodes at distance at most k is joined, k <= 5, n <= 10^15, modulo 65521. | Hard8 | MatrixDynamic programming+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Third Baseman UnknownOn an N by N grid of uppercase letters, walk right or down from the top-left to the bottom-right and maximize how many times "MOLA" appears in the collected string. | Hard8 | Dynamic programmingMatrix+2 | No attempts yet | 1s | 512 MB | Judgeable |
| 2xN Tiling with QueriesMaintain the count of tilings of a 2xN grid by 1x2 and 2x1 tiles while cells get blocked and unblocked by queries. | Hard8 | Dynamic programmingSegment tree+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Just Passing ThroughGrid path from the west edge to the east edge moving east, northeast, or southeast, crossing exactly n passes, minimizing total elevation. | Hard8 | Dynamic programmingMatrix+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Ranch CCTVFor each query, sheep in a grid shift one cell per day in a fixed direction for K days; report the XOR of the daily maximum over the CCTV rectangle. | Hard8 | Prefix sumMatrix+2 | No attempts yet | 2s | 256 MB | Judgeable |
| K==SCount sequences of length N over 26 letters that avoid any of Q given forbidden strings as contiguous substrings, modulo 1e9+7, where N can be up to 1e9. | Hard8 | String matchingDynamic programming+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Shortest Paths and QueriesGiven a grid with up to 5 rows and 100,000 columns, answer queries for the minimum-weight monotone-free path between two cells. | Hard8 | Dynamic programmingMatrix+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Fantastic FožgajCount length-m lowercase strings over 26 letters that avoid any of n forbidden patterns as a substring, modulo 1e9+7, with m up to 1e9. | Hard8 | Dynamic programmingString matching+2 | No attempts yet | 1.5s | 512 MB | Judgeable |
| Coloring a Rectangle 2Count binary colorings of an N by M grid, N up to 1e18 and M at most 5, with no 2x2 block of a single color, modulo 1e9+7. | Hard8 | Dynamic programmingMatrix+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Non-Decreasing SubsequencesGiven an array of values from 1 to K, answer queries counting non-decreasing subsequences within a subarray, including the empty one, modulo 1e9+7. | Hard8 | Dynamic programmingDivide and conquer+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Block BreakerBlocks drop in a grid when a knocked block has a dropped left/right neighbor and a dropped front/back neighbor; after each of q moves, report how many blocks fall. | Hard8 | Union-findSimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Banned WordsCount length-L strings over 26 letters avoiding a given set of banned substrings, modulo 998244353, with L up to 1e9. | Hard8 | String matchingTrie+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Addition RobotMaintain a binary string under range flips and answer queries that apply the range's A/B operations to a pair of numbers, modulo 1e9+7. | Hard8 | Segment treeMatrix+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Matrix SwapsGiven binary matrices A and B and a per-cell swap-count limit matrix C, find the minimum number of adjacent (including diagonal) cell swaps to turn A into B, or report impossibility. | Hard9 | GraphShortest path+2 | No attempts yet | 2s | 128 MB | Judgeable |
| All Closed-Walk LengthsGiven a directed graph, decide for every length x whether a closed walk of that length exists, then print the eventually periodic 0/1 sequence in its shortest prefix-plus-period notation. | Hard9 | GraphMatrix+2 | No attempts yet | 2s | 128 MB | Judgeable |
| District PartitioningPick X horizontal and Y vertical dividing roads from an (n+1)x(m+1) population grid so the maximum population of any resulting block is minimized. | Hard9 | Binary searchGreedy+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Domino TilingFind the lexicographically smallest way to tile an N by M grid with dominoes while respecting forbidden borders between certain adjacent cells, or report impossibility. | Hard9 | GraphBFS+2 | No attempts yet | 5s | 128 MB | Judgeable |
| OrchardGiven up to 2500 non-overlapping colored rectangles, find the maximum area axis-aligned rectangle fully covered by orchards of one fruit type. | Hard9 | GeometryMatrix+2 | No attempts yet | 2s | 64 MB | Judgeable |
| Matrix and Fibonacci SumCompute the sum of Fibonacci numbers with linearly growing indices times increasing powers of a K×K matrix, modulo a prime, for N up to 10^1000. | Hard9 | MatrixMath+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Standard ProblemGiven a 0/1 grid, answer up to a million offline queries for the largest all-zero rectangle confined to a specified row range. | Hard9 | Segment treeDivide and conquer+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Nice PrefixesCount length-L strings over a K-letter alphabet where every prefix keeps all symbol counts within 2 of each other, modulo 1e9+7, with L up to 1e18. | Hard9 | Dynamic programmingCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Mine the GradientGiven a grayscale grid, find the largest square subgrid whose values follow a vertical, horizontal, or diagonal uniform gradient, and report its area. | Hard9 | Dynamic programmingImplementation+2 | No attempts yet | 10s | 128 MB | Judgeable |
| The Lights Going On and OffGiven a light grid, pushing the button beside row k XORs it with the row above; count how many distinct bottom-row patterns can result from any subset and order of pushes. | Hard9 | Bit manipulationMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| HighwaysMaintain a layered graph where each province has a few cities and highway lane counts change over time, answering route-count queries modulo d after each update. | Hard9 | MatrixSegment tree+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Overwriting GameYou repeat random prefix-rectangle repaints until the board matches the target, and report the expected total of painted cells as a reduced fraction. | Hard9 | ProbabilityMatrix+1 | No attempts yet | 8s | 512 MB | Judgeable |
| Slave to Achievements 2Repeatedly craft as many N-scrap daggers as possible and reclaim 0 to K scraps per dagger, then find the distribution of the final leftover under N scraps. | Hard9 | ProbabilityDynamic programming+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Counting StringsCount strings over the lowercase alphabet whose length lies between L*K and L*K+N and in which at most K non-overlapping copies of a given pattern S can be found. | Hard9 | Dynamic programmingString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Number of walksGiven a directed graph as an adjacency matrix, find the smallest K such that the number of walks of length L grows as O(L^K), or -1 if none exists. | Hard9 | GraphDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Solve this one tooGiven an N x L matrix, find windows of 3N columns split into matrices A, B, C with A*B=C; pick disjoint windows to maximize total colored cells. | Hard9 | MatrixDynamic programming+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Hangar HurdlesGiven an n by n grid of blocked and empty cells, answer q queries asking for the largest centered square crate that can slide between two empty cells. | Hard9 | Union-findBFS+2 | No attempts yet | 8s | 512 MB | Judgeable |
| NPM998244353 (Hard)For every digit-sum cap from 0 to MM, count length-N digit strings divisible by P, modulo 998244353. | Hard9 | CombinatoricsDynamic programming+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Counting multiples with a bounded digit sumCount length-N digit strings divisible by P with digit sum at most M, for every M up to the limit, modulo 998244353. | Hard9 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Blocks 2Count the ways to tile an N x M rectangle with rotated k x N blocks (k=1..N), modulo 1999, where M can be as large as 10^10. | Hard9 | CombinatoricsDynamic programming+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Colored Tiles 2Place given 1x1 and 1x2 tiles on an H by W board without overlap to maximize the total score of edges between neighboring tiles, then output every tile's coordinates. | Hard9 | Dynamic programmingImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| MessageCount length-n lowercase strings that contain a given pattern p as a substring, modulo m, where n can reach 10^12 and p has length at most 50. | Hard9 | Dynamic programmingString matching+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Sum of Equivalent Resistances Between Every Pair of Vertices Joined by an Edge, Given a Connected Graph with Unit Resistance EdgesGiven a connected unit-resistance graph, compute the sum of effective resistances over all m edges, using the fact that each equals the probability a random walk crosses that edge in the commute. | Hard9 | GraphMatrix+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Working CellsGiven T periodic N-vertex weighted digraphs, count modulo 1e9+7 the number of D-step walks from every hub i to every hub j. | Hard9 | MatrixDivide and conquer+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Chessboard MovementCount paths from row 1 to row N on an N x M chessboard where odd rows restrict moves to same-colored adjacent cells and even rows allow any adjacent move, modulo 1e9+7. | Hard9 | Dynamic programmingMatrix+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Good Word, Bad WordBacteria on an N by N grid can step to an orthogonal neighbor for cost a, or jump up to Chebyshev distance D from a good cell for cost b; for each meeting cell find the total minimum cost for all bacteria to reach it. | Hard9 | Shortest pathGraph+2 | No attempts yet | 2.5s | 1024 MB | Judgeable |
| Modulo-magic squaresCount n x n matrices over Z_m whose row, column, and two diagonal sums are all congruent to one constant, for n and m up to 1e9. | Hard9 | MathCombinatorics+2 | No attempts yet | 1s | 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 |