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 |
|---|---|---|---|---|---|---|
| Coin FlippingGiven an N by N grid of H/T coins (N up to 20), find the minimum number of tails achievable by flipping any subset of rows and columns. | Medium6 | Bit manipulationBrute force+2 | No attempts yet | 6s | 128 MB | Judgeable |
| Assigning Tasks 1Given an N by N cost matrix, assign each person exactly one task to minimize the total assignment cost. | Medium6 | Dynamic programmingBit manipulation+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Coin Flips IIGiven an N by M grid of coins, find the minimum number of top-left rectangle flips needed to turn every coin to heads. | Medium6 | MatrixGreedy+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Shom SquareConstruct the lexicographically smallest N by N grid using digits 0 to D-1 so every row and column contains all D values at least once. | Medium6 | BacktrackingGreedy+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Turning On the LightsFind the minimum number of bulb presses, each flipping a cell and its 8 neighbors, needed to turn all bulbs on an N×M grid (N,M ≤ 8) on, or report impossibility. | Medium6 | Bit manipulationBrute force+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Minho's CuriosityGiven an all-pairs shortest-time matrix for N cities, reconstruct the minimum-edge road network with the same shortest times and output the total edge weight, or -1 if impossible. | Medium6 | Shortest pathGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Dongmin SequenceCount sequences of lucky numbers (digits 4/7 only) chosen from a given list of length L, where consecutive elements share first/last digit, modulo 1,234,567,891. | Medium6 | MatrixDynamic programming+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Position ExchangeFind the minimum number of simultaneous turns for two players on a grid to swap starting cells, moving in 8 directions while avoiding walls, collisions, and direct swaps, using BFS over joint position states. | Medium6 | BFSGraph+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Escape the Hazard ZonesGiven overlapping rectangular zones on a 501x501 grid marking safe, dangerous, and blocked cells, find the minimum life lost moving from (0,0) to (500,500). | Medium6 | BFSGraph+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Monkey Who Wants to Move Like a HorseFind the minimum number of moves for a monkey to reach the bottom-right cell of a grid using normal steps and at most K knight-like jumps over obstacles. | Medium6 | BFSShortest path+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Coin FlipsFind the minimum number of row and column flips on an odd N by M 0/1 grid so every row and column has an even count of 1s, or output -1. | Medium6 | MathBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Largest Zero SubmatrixGiven a binary matrix, find the maximum area rectangle of consecutive rows and columns that contains only zeros. | Medium6 | StackDynamic programming+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Box PuzzlePlace n^2 rotatable cube boxes into an n by n grid so touching side faces match and outward faces show 0, then output the arrangement and rotation counts. | Medium6 | BacktrackingMatrix+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Maximum Submatrix SumGiven an N by M integer matrix, find the maximum possible sum over all contiguous rectangular submatrices. | Medium6 | Dynamic programmingMatrix+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Finding the Maximum Score PathFind the maximum-score simple path from the top-left to bottom-right cell of an N x N grid moving only in four directions without revisiting cells. | Medium6 | BacktrackingDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Greedy PandaFind the longest strictly increasing path through adjacent cells in an n x n grid using memoized DFS. | Medium6 | DFSDynamic programming+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Matrix ConstructionGiven target row sums and column sums, construct any 0/1 n x n matrix satisfying both, or report impossibility. | Medium6 | GreedyMatrix+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Submatrix Range QueriesGiven an N x N matrix and K fixed-size BxB submatrix queries, output the max minus min value for each queried window efficiently. | Medium6 | Sliding windowMatrix+1 | No attempts yet | 2s | 128 MB | Judgeable |
| MinecraftGiven three 2D projections of a 3D 0/1 grid, construct any consistent 3D grid or report impossibility. | Medium6 | MatrixGreedy+1 | No attempts yet | 1.52s | 1024 MB | Judgeable |
| Largest L ShapeGiven a binary grid, find the maximum-area L-shape (union of two rectangles sharing a lower-left corner, wider base and taller top) made entirely of 1-cells. | Medium6 | Dynamic programmingMatrix+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Go TerritoryReconstruct a unique black/white Go board from row, column, and both diagonal stone counts, then flood-fill empty regions to count enclosed territory. | Medium6 | Brute forceBFS+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Nth Largest NumberGiven an N x N matrix where each column is sorted top to bottom, find the Nth largest value among all N^2 entries efficiently. | Medium6 | Binary searchMatrix+1 | No attempts yet | 1s | 12 MB | Judgeable |
| Game of DeathGiven a directed graph where each of N people points to two others, determine for M queries if b can be reached from a in exactly K steps. | Medium6 | GraphMatrix+1 | No attempts yet | 3s | 256 MB | Judgeable |
| GalleryGiven a grid of walls and empty cells, compute the maximum number of double-cell-length pictures that can be hung on wall faces adjacent to empty space without overlapping. | Medium6 | GreedyMatrix+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Robot NavigationGiven an N x M grid, find the maximum sum path from top-left to bottom-right moving only left, right, or down without revisiting cells. | Medium6 | Dynamic programmingMatrix+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Palindrome PathsCount length-L walks on an N x N grid with 8-directional moves whose visited digit sequence forms a palindrome. | Medium6 | Dynamic programmingMatrix+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Matchsticks and SquaresGiven a grid of matchsticks drawn with horizontal and vertical line segments, count all squares of any size whose four full sides are present. | Medium6 | MatrixBrute force+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SudokuSolve a given 9x9 Sudoku puzzle via backtracking and output the lexicographically smallest completed board if multiple solutions exist. | Medium6 | BacktrackingMatrix+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Water FillingGiven a grid of terrain heights, compute the maximum water volume trapped inside using a boundary-based priority-queue flood fill (trapping rain water 2D). | Medium6 | HeapMatrix+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Mirror RaysSimulate light rays reflecting off '/' mirrors in an N×M grid and report, for each numbered border hole, which hole the ray exits from. | Medium6 | SimulationMatrix+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Automatic SprinklersReconstruct the placement of fertilizer and herbicide sprinklers on an 8x8 grid given the resulting yields per row and column effects, along with the sprinkler count. | Medium6 | MatrixMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SudokuSolve a standard 9x9 sudoku puzzle by filling empty cells so every row, column, and 3x3 box contains digits 1 through 9, using backtracking search. | Medium6 | BacktrackingMatrix+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Police CarsAssign a sequence of incidents to one of two police cars moving along Manhattan-distance shortest paths so that total travel distance is minimized, and output the assignment. | Medium6 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| CheeseSimulate hourly melting of cheese cells on a grid, where a cell melts if at least two sides touch outside air reachable via BFS/flood fill, and output total hours until all cheese disappears. | Medium6 | BFSSimulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Beautiful MatrixGiven an N x N matrix (N up to 400), find the maximum difference between the main diagonal sum and anti-diagonal sum over all possible square submatrices. | Medium6 | MatrixPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Counting Pipe InstallationsCount the ways to lay a single connected pipe path with six pipe shapes from the top-left entry to the bottom-right exit through a grid with blocked cells, modulo 10007. | Medium6 | Dynamic programmingMatrix+1 | No attempts yet | 2s | 128 MB | Judgeable |
| 45-Degree RotationRotate a character grid clockwise by a multiple of 45 degrees, including diagonal renderings, keeping letters upright and output compact. | Medium6 | SimulationMatrix+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Stone DroppingSimulate stones falling one at a time down a grid with walls, sliding left or right when blocked, and print the final board. | Medium6 | SimulationMatrix+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Number of PlusesCount all plus-shaped patterns of odd size at least 3 in an N x N binary matrix, where every cell outside the cross must be 0. | Medium6 | Dynamic programmingMatrix+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Apples and BananasFind a monotone down/right/diagonal path in an RxC grid to maximize apples below plus bananas above it, with R,C up to 1500. | Medium6 | Dynamic programmingMatrix+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Minimum Trailing Zeros PathFind a path from top-left to bottom-right of an N×N grid, avoiding zero cells, that minimizes trailing zeros in the product of visited cells. | Medium6 | Dynamic programmingMatrix+1 | No attempts yet | 1s | 128 MB | Judgeable |
| An Arithmetic RectangleDetermine whether missing cells in a grid can be filled with rationals so every row and column becomes an arithmetic progression. | Medium6 | MathMatrix+1 | No attempts yet | 1s | 128 MB | Judgeable |
| GamersFor a grid where each cell must visit every other cell offering a different game via round trips through its own home, compute the total travel cost summed over all cells. | Medium6 | MatrixMath+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Row and Column Deletion GameGiven an n x n matrix where players alternately remove the last row or column if its sum is even, determine which player wins with optimal play across possibly many test cases up to n=1000. | Medium6 | Game theoryDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| 16x16 SudokuSolve a given 16x16 Sudoku puzzle so each row, column, and 4x4 box contains letters A to P exactly once, given a unique solution exists. | Medium6 | BacktrackingMatrix+1 | No attempts yet | 3s | 128 MB | Judgeable |
| City GameGiven several grid maps of free and reserved cells, find the largest all-free rectangle in each grid and print its area times three. | Medium6 | StackDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| One-Dimensional Cellular AutomatonSimulate a linear recurrence over N cells modulo M for up to 1e9 steps using fast matrix exponentiation. | Medium6 | MatrixMath+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Fake ScoreboardReconstruct a binary team-by-problem matrix matching given row and column sums, outputting the lexicographically smallest valid matrix or reporting impossibility (Gale-Ryser style bipartite degree sequence problem). | Medium6 | GreedyCombinatorics+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Production ProcessGiven a matrix chain-like joining table for pieces, find the minimum-time parenthesization to assemble a given string, breaking ties by piece order. | Medium6 | Dynamic programmingString+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Where's WallyDecode base64-like bit matrices for an image and a square pattern, then count all image squares matching the pattern under any rotation or mirror flip. | Medium6 | MatrixString matching+2 | No attempts yet | 4s | 128 MB | Judgeable |
| Cubist ArtworkGiven front and side view maximum heights for a grid of cube piles, find the minimum total number of cubes consistent with both views. | Medium6 | GreedyMatrix+1 | 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 |
| Tic-Tac-ToeGiven an n by n tic-tac-toe board with win length m, decide if the state is in progress, finished (X, O, or draw), or impossible. | Medium6 | ImplementationSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Fire!Given a grid with walls, one starting cell, and burning cells, find the earliest minute Jihoon can step off the edge, given the fire spreads one cell per minute. | Medium6 | BFSGraph+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Janken TacticsOn a hex grid with terrain costs and enemy-threat rules, validate a sequence of moves by finding the cheapest legal path and reporting leftover movement points. | Medium6 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Don't Get RookedFind the maximum number of non-attacking rooks on a board up to 4x4 where walls block rook attacks. | Medium6 | BacktrackingBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| A Puzzling ProblemPlace up to 5 fixed-orientation polyomino pieces, each labeled by index, to tile a 4x4 square exactly, printing the lexicographically smallest labeled grid or a failure message. | Medium6 | BacktrackingBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Doggone MolesTrack which grid cells the mole could occupy across observed terrier moves, since standing on or beside a terrier means capture. | Medium6 | SimulationMatrix+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Cliff ClimbingFind the minimum total time for Jack to climb a grid, moving feet alternately under distance constraints, from a bottom S block to a top T block. | Medium6 | Shortest pathGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Rotation MazeGiven a maze where a ball falls under gravity, find the shortest sequence of 90-degree left and right rotations that brings the ball to rest on the goal. | Medium6 | BFSSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| CubingSimulate a sequence of Rubik's cube face turns from a solved state and print the colors on the up face. | Medium6 | ImplementationSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Drawing with XOREach XOR call flips a rectangle anchored at the bottom right, so the number of calls equals the count of pixels that differ from the pixel below and the pixel to the right, plus the bottom-right pixel. | Medium6 | ArrayMatrix+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Starry NightFind 8-connected star clusters in a grid and assign the same letter to clusters that match under rotation and reflection. | Medium6 | DFSMatrix+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SenbeiGiven a binary R x C grid with R at most 10, choose one subset of rows and one subset of columns to flip so the number of 1s is maximized. | Medium6 | Brute forceGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Finding SeatsGiven an R by C grid of free and taken seats, place K people on free seats so the bounding rectangle has the smallest area. | Medium6 | Two pointersBinary search+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Grandpa's Rubik CubeGiven a Rubik's cube configuration and a list of face rotations, decide whether applying them all yields a solved cube with each face a single color. | Medium6 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| RobberyGiven time-stamped rectangular exclusions, find the robber's position at each time step where it is uniquely determined, moving at most one cell per step. | Medium6 | Dynamic programmingSimulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| The GameFor each pair of pieces on a grid, decide if an orthogonal path can join them without crossing others, and give the minimum number of straight segments. | Medium6 | BFSGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Plato's BlocksGiven three n by n shadow patterns, decide whether one connected solid built from unit cubes can cast all three shadows simultaneously. | Medium6 | BacktrackingBrute force+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 |
| Homogeneous SquareGiven an n by n grid, decide whether every choice of n cells with distinct rows and distinct columns has the same sum. | Medium6 | MathMatrix+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Interesting Maze GameGiven a 7x7 labyrinth and one extra card, decide whether inserting and rotating that card lets the piece walk to the target in a single move. | Medium6 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cross SpiralTrace a clockwise inward spiral walk on a cross-shaped tile grid and report the column and row after S steps, or where she gets trapped. | Medium6 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Number MatrixGiven a digit grid, find the lexicographically smallest set of three digits such that some 4-directional path uses only those digits from row 1 to row M. | Medium6 | GraphBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| BlindfoldGiven a grid with obstacles and a fixed sequence of forward/turn moves, mark every walkable square that can be a final position for some unknown start and heading. | Medium6 | SimulationBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Stacking CubesGiven a stacking pattern as non-increasing rows with non-increasing columns, print its left and right rotations as corner stackings. | Medium6 | ArrayImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Street NetworkDecide whether a directed multigraph has an Eulerian trail, count possible start nodes, and for S at most 3 count closed walks of length S from each node, sorted. | Medium6 | GraphImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Heating MainCount the ways to lay a single non-crossing path of four fixed pipe shapes from the top-left top side to the bottom-right right side, respecting fixed pipes and blocked garden cells on a grid of at most 10 by 10. | Medium6 | BacktrackingDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Swimming PoolGiven an m by n grid of tower heights, find the total volume of water trapped among the towers when the grid is flooded from the outside. | Medium6 | HeapBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Alphariz Table CollapseGiven a letter grid and a list of chosen cells, repeatedly erase each chosen cell's 4-connected equal-letter region, then slide rows left and columns down, deleting empty rows and columns. | Medium6 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Space Station ShieldingGiven occupied unit cells of a connected 3D station, count faces on the external surface, where enclosed hollow pockets do not count. | Medium6 | BFSImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Square IceGiven an alternating sign matrix, render the corresponding square ice grid using H, O, dashes, bars, and an asterisk border. | Medium6 | ImplementationMatrix+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SudokuFill every empty cell of a 9x9 Sudoku grid so each row, column, and 3x3 box contains the digits 1 through 9 exactly once. | Medium6 | BacktrackingMatrix | No attempts yet | 1s | 128 MB | Judgeable |
| SkewersCount strings of length n over p letters that avoid a given set of forbidden bigrams and trigrams, modulo m. | Medium6 | Dynamic programmingMatrix | No attempts yet | 1s | 128 MB | Judgeable |
| WaterGiven a grid of cuboid heights, find the total volume of water trapped in the depressions after rain, where water cannot escape past the grid boundary. | Medium6 | HeapBFS+2 | No attempts yet | 3s | 128 MB | Judgeable |
| The Right-Turn Drivers' ClubOn a grid with blocked cells, find the shortest A-to-B path that never turns left or makes a U-turn, counting squares visited. | Medium6 | BFSGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| MapGiven an n by m grid and q queries, each comparing two h by w subrectangles, decide if at most k corresponding cells differ. | Medium6 | Prefix sumMatrix+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Magic SquareFill in the n missing cells, one per row and column, so all rows, columns, and both diagonals add to the same total. | Medium6 | MathMatrix | No attempts yet | 1s | 512 MB | Judgeable |
| KlasyPrint the requested subrectangle of an n by n grid filled in spiral order from a corner by a walk that turns only right or only left. | Medium6 | SimulationMath+1 | No attempts yet | 1s | 512 MB | Judgeable |
| AquaparkSum the grid values inside the Manhattan diamond of radius l_i around each lifeguard. | Medium6 | Prefix sumMatrix | No attempts yet | 1s | 512 MB | Judgeable |
| Paweł i GawełTwo players alternate moving a pawn across a grid, swapping floors whenever it enters a marked cell, each trying to hold the upper floor at the end. | Medium6 | Game theoryDynamic programming+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Art classGiven red, green, and blue values for each pixel of a painting, decide which of four described art styles it belongs to and print its number. | Medium6 | SimulationMatrix+1 | No attempts yet | 5s | 256 MB | Judgeable |
| Pile of CubesFind the largest number of cubes in a gravity-respecting pile that matches the given top, front, and right views, or report -1 when no pile fits. | Medium6 | GreedyMatrix | No attempts yet | 1s | 128 MB | Judgeable |
| If only I could think Linearly...Given a matrix M and output vector y, find the three nonzero entries of the input vector x with Mx equal to y. | Medium6 | MatrixBrute force | 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 |
| GoSimulate simplified Go on boards up to 20 by 20, reject the first stone placed on an occupied point, and count each side's stones plus surrounded empty points. | Medium6 | SimulationBFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Omar Loves CandiesFind the largest sum of any non-empty sub-rectangle in a grid whose rows and columns strictly increase. | Medium6 | Prefix sumGreedy+1 | No attempts yet | 3s | 128 MB | Judgeable |
| CubeDecide whether six numbered cells in a 6 by 6 grid fold into a cube and report the face opposite face 1. | Medium6 | SimulationBFS+1 | No attempts yet | 2s | 1024 MB | Judgeable |
| OrchardPick one rectangle for Bert to minimize the bananas left outside it plus the apples inside it. | Medium6 | MatrixPrefix sum+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Quality of LivingFind the smallest median among all H by W subrectangles of a grid holding the numbers 1 to R times C. | Medium6 | Binary searchPrefix sum+1 | No attempts yet | 5s | 256 MB | Judgeable |