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
TitleLevelTopicsSolvedTime limitMemory limitJudge
Matrix AdditionRead two N by M integer matrices and print their element-wise sum.Easy1MatrixImplementationNo attempts yet1s128 MBJudgeable
WężykPrint the numbers 1 to n squared in n rows that alternate between left-to-right and right-to-left order.Easy1SimulationMatrixNo attempts yet1s128 MBJudgeable
Crossword puzzle decorationSurround the M by N letter grid with the given padding and fill the added cells with alternating # and . by row plus column parity.Easy1ImplementationMatrixNo attempts yet1s128 MBJudgeable
The Princess and the Magic MirrorPrint an N by N picture unchanged, mirrored left to right, or flipped top to bottom according to the given mood number.Easy1MatrixImplementationNo attempts yet2s256 MBJudgeable
Hot fish-shaped bunPrint the given N by M binary picture mirrored left to right.Easy1MatrixImplementationNo attempts yet1s32 MBJudgeable
RectangleImplement a Rectangle class with width and height, range-checked setters, and methods for area, perimeter, and square detection.Easy1ImplementationMath+2No attempts yet1s512 MBJudgeable
Floor DecorationCount the number of wooden planks by counting maximal runs of consecutive '-' in each row and '|' in each column of a grid.Easy2MatrixImplementation+1No attempts yet2s128 MBJudgeable
Find Places to Lie DownCount maximal horizontal and vertical runs of at least two consecutive empty cells in an N x N grid.Easy2MatrixSimulationNo attempts yet2s128 MBJudgeable
Matrix MultiplicationRead two matrices of bounded size and print their standard matrix product.Easy2MatrixImplementationNo attempts yet1s128 MBJudgeable
Monster TruckCount 2x2 blocks in a grid without any building, grouped by how many parked cars they contain (0 to 4).Easy2MatrixImplementationNo attempts yet1s128 MBJudgeable
MinesweeperGiven a grid of mines and empty cells, replace each empty cell with the count of mines in its eight neighbors.Easy2SimulationImplementation+2No attempts yet1s128 MBJudgeable
The PaintingRead an n by m grid of . and # characters and print it rotated 90 degrees clockwise, producing m rows of n characters.Easy2ArrayMatrix+1No attempts yet1s128 MBJudgeable
Tidying the Banquet TablesFour teams sit mixed across four tables, and you assign one team to each table so the fewest guests move.Easy2Brute forceMatrixNo attempts yet1s128 MBJudgeable
WoodwormsCount the table squares each woodworm ate and report the name of the one that ate the most.Easy2MatrixImplementationNo attempts yet1s128 MBJudgeable
Crossword Puzzle Clue NumberingScan the letter grid, number each square that starts an across or down word, and list every entry number with its letter count.Easy2SimulationMatrix+1No attempts yet1s128 MBJudgeable
Painting PartyPaint up to 100 filled or one-pixel-border rectangles in order on an N by N grid and print the final colors.Easy2SimulationMatrixNo attempts yet5s128 MBJudgeable
BoxesBoxes fall straight down in each column of a grid, and the program sums how many cells all boxes move.Easy2SimulationMatrixNo attempts yet1s256 MBJudgeable
Roman Catholic MassThe program seats the latecomer in the empty spot with the most occupied neighbors and counts every adjacent occupied pair once.Easy2Brute forceMatrix+1No attempts yet1s128 MBJudgeable
Contest Venue SetupCount the schools that have two of their teams seated in king-adjacent cells of an N by M grid with empty seats.Easy2MatrixImplementationNo attempts yet1s128 MBJudgeable
Magic SquaresCheck each test case square by comparing every row, column, and both diagonal sums and report whether it is magic.Easy2MatrixSimulationNo attempts yet1s256 MBJudgeable
Queens on Bad TermsCheck an 8x8 board holding eight queens and print valid only when no two queens share a row, column, or diagonal.Easy2ImplementationMatrixNo attempts yet1s256 MBJudgeable
Crossword Clue NumberingScan the grid for empty cells that begin a word of at least three cells across or down and print them in reading order.Easy2ImplementationMatrixNo attempts yet1s256 MBJudgeable
Secret MessagePad each message with asterisks to a square, rotate the square 90 degrees clockwise, then read it row by row without asterisks.Easy2MatrixSimulationNo attempts yet2s256 MBJudgeable
Coverity CrosswordDecide whether every listed word appears horizontally, vertically, or diagonally in an 8 by 8 letter grid.Easy2String matchingMatrix+1No attempts yet2s256 MBJudgeable
Crushing ConfectionsFind the lexicographically smallest row or column triple of equal candies in each grid and print its positions.Easy2MatrixImplementationNo attempts yet1s256 MBJudgeable
Black and White PanelPrint the fixed 101-column black and white grid whose isolated single tiles yield exactly b black areas and w white areas.Easy2ImplementationMatrixNo attempts yet2s256 MBJudgeable
Lucky ChancesCount over every grid cell how many of the four directions contain only smaller numbers or reach the edge.Easy2Brute forceMatrix+1No attempts yet2s256 MBJudgeable
Tiling recordGiven a floor tiled with 1 by n tiles labeled by number, list each tile as h or v in row-major order of its first cell.Easy2SimulationMatrix+1No attempts yet1s256 MBJudgeable
gMatrix (Small)Build the matrix from the given formula and add the largest entry of every K by K consecutive submatrix.Easy2Brute forceMatrix+1No attempts yet5s512 MBJudgeable
BazaCount the database rows that match each query in every column not marked -1.Easy2Brute forceMatrixNo attempts yet1s64 MBJudgeable
Tic-Tac-Toe-Tomek (Small)Given a 4 by 4 tic-tac-toe board with a wildcard T, report whether X won, O won, the game is a draw, or play continues.Easy2ImplementationMatrixNo attempts yet5s512 MBJudgeable
Tic-Tac-Toe-Tomek (Large)Given a 4x4 tic-tac-toe board with a wildcard T, report whether X won, O won, the game is a draw, or play continues.Easy2ImplementationBrute force+1No attempts yet5s512 MBJudgeable
Tic Tac ToeRead a 3x3 board of X, O, and dots and print YES if some row, column, or diagonal has three equal non-dot symbols.Easy2ImplementationMatrix+1No attempts yet2s512 MBJudgeable
Magic SquaresGiven a 4x4 grid, check whether all four row sums and all four column sums are equal, then print whether it is magic.Easy2ImplementationMatrixNo attempts yet2s512 MBJudgeable
Magic SquareGiven an N by N matrix, decide whether its entries form a magic square with equal row, column, and diagonal sums.Easy2ImplementationMatrix+1No attempts yet1s512 MBJudgeable
Matrix Multiplication CalculatorRead pairs of matrices with dimension lines, multiply them when the inner dimensions match, and print each result row wrapped in vertical bars, or print undefined.Easy2ImplementationMatrix+2No attempts yet2s512 MBJudgeable
SculptureGiven a grid of distinct neighboring heights, mark each interior cell with 1 if all four adjacent cells are higher, otherwise 0.Easy2ArrayImplementation+1No attempts yet2s512 MBJudgeable
Number SquareGiven an N by M grid of digits, find the area of the largest axis-aligned square whose four corner cells share the same digit.Easy3Brute forceMatrix+1No attempts yet2s128 MBJudgeable
FriendsGiven an N x N friendship matrix (N ≤ 50), find the maximum count of people reachable within two friendship links from any single person.Easy3GraphMatrix+1No attempts yet2s128 MBJudgeable
Come Back HomeCount simple paths of exact length K from the bottom-left to the top-right cell of a small grid, avoiding blocked cells and revisits.Easy3BacktrackingDFS+1No attempts yet2s128 MBJudgeable
Maze ConstructionSimulate a sequence of forward moves and turns on a grid, then print the smallest rectangular map marking visited cells as passable and the rest as walls.Easy3SimulationImplementation+1No attempts yet2s128 MBJudgeable
Woodcut TracesSimulate a tool moving on an N by N grid following U/D/L/R commands, ignoring out-of-bounds moves, and mark each point as unvisited, vertical-only, horizontal-only, or both.Easy3SimulationMatrix+1No attempts yet2s128 MBJudgeable
CipherGiven an encrypted string built by zigzag row reading of a column-filled table, reconstruct the original string for a given number of columns.Easy3SimulationMatrix+2No attempts yet2s128 MBJudgeable
Median FilterApply a 3x3 median filter over an image and count filtered pixels whose median value is at least a given threshold.Easy3MatrixSorting+1No attempts yet2s128 MBJudgeable
Painted AreasCount connected components of 1-cells in a grid (4-directional adjacency) and output the count and the size of the largest component.Easy3BFSDFS+1No attempts yet2s128 MBJudgeable
Integer TriangleGiven a triangle of up to 500 rows, compute the maximum sum path from top to bottom moving diagonally at each step.Easy3Dynamic programmingMatrixNo attempts yet2s128 MBJudgeable
Snail 2Simulate a snail-like spiral fill on an M by N grid and count how many times the path turns before every cell is visited.Easy3SimulationMatrix+1No attempts yet2s128 MBJudgeable
MinesweeperGiven an N x N minesweeper grid with mine counts (possibly multi-mine cells), output each empty cell's summed adjacent mine count, capping at 'M' for 10+.Easy3MatrixSimulation+1No attempts yet2s128 MBJudgeable
Completing a Magic SquareGiven a 3x3 magic square with up to three cells erased (marked 0), fill in the missing positive integers so all rows, columns, and diagonals share the same sum.Easy3MathMatrix+1No attempts yet2s128 MBJudgeable
Downward GameGiven an N x 3 grid with limited column transitions between rows, compute the maximum and minimum total path sums from top to bottom.Easy3Dynamic programmingMatrixNo attempts yet1s4 MBJudgeable
Picture ComparisonGiven N small 5x7 grids, find the pair of pictures with the fewest differing cells and output their indices.Easy3Brute forceMatrix+1No attempts yet2s128 MBJudgeable
2D Array Range SumBuild a 2D prefix sum over an N by M grid and answer up to 10,000 rectangle sum queries in O(1) each.Easy3Prefix sumMatrix+1No attempts yet2s128 MBJudgeable
Maze SearchFind the minimum number of cells traversed on a grid path from top-left to bottom-right using BFS shortest path.Easy3BFSGraph+1No attempts yet1s192 MBJudgeable
Magic Square ClassificationRead multiple square matrices and classify each into one of five magic square categories based on row, column, diagonal sums, distinctness, and consecutiveness.Easy3MatrixImplementation+1No attempts yet1s128 MBJudgeable
Candy Doctor ChangyoungScan a character grid to count fixed 3-cell horizontal ('>o<') or vertical ('v/o/^') candy patterns.Easy3MatrixImplementation+1No attempts yet1s128 MBJudgeable
BingoSimulate marking a 5x5 bingo board as numbers are called and find the call count when 3 lines (rows, columns, or diagonals) are first completed.Easy3SimulationArray+1No attempts yet1s128 MBJudgeable
Making Colored PaperRecursively quadtree-split an N×N grid of 0/1 cells into uniform-color squares and count the resulting white and blue pieces.Easy3RecursionDivide and conquer+1No attempts yet1s128 MBJudgeable
Secret EmailGiven an encrypted string, find matrix dimensions R<=C with R*C=N and largest R, then reverse a row-major-write column-major-read transposition to recover the original message.Easy3MatrixString+1No attempts yet1s128 MBJudgeable
Marathon Tic-Tac-ToeScan an N by N board to find if any letter forms three consecutive equal marks in a row, column, or diagonal, and print that letter or 'ongoing'.Easy3MatrixSimulation+1No attempts yet1s128 MBJudgeable
GameGiven many filled 5x5 tic-tac-toe boards, determine for each whether A, B, or neither has three consecutive same marbles in a row, column, or diagonal.Easy3MatrixSimulation+1No attempts yet1s128 MBJudgeable
Building for the UNPrint a fixed two-floor n by n grid where the lower floor's rows and upper floor's columns each represent a labeled country, satisfying a connectivity and adjacency construction.Easy3ImplementationSimulation+1No attempts yet3s128 MBJudgeable
Laser Turret MaintenanceGiven a conflict-free n-queens configuration as a column vector, output the eight rotations and reflections in a fixed order with three-character right-justified fields.Easy3ImplementationMatrix+2No attempts yet1s128 MBJudgeable
GymGiven an N by N matrix of card counts, compute the probability distribution over N baskets for the first 10 steps of a Markov process starting at basket 1.Easy3MathMatrix+2No attempts yet1s128 MBJudgeable
Number of IslandsGiven a grid of land and sea cells with 8-directional adjacency, count the connected land components.Easy3GraphDFS+2No attempts yet1s128 MBJudgeable
Red and BlackCount how many black tiles are reachable from a start tile in a small grid by moving up, down, left, and right.Easy3DFSGraph+1No attempts yet1s128 MBJudgeable
Global WarmingGiven a small land/sea grid, mark every land cell with three or more sea neighbours as sea simultaneously, then print the tight bounding box of the remaining land.Easy3ArraySimulation+2No attempts yet1s128 MBJudgeable
spiral123Given n, construct the prescribed n by n spiral123 matrix using the recursive definition from M(n-6) plus a fixed 6 by 6 corner pattern.Easy3MatrixImplementationNo attempts yet1s64 MBJudgeable
Asteroid FieldFind the minimum number of moves from the top-left cell to the bottom-right cell in a grid, avoiding asteroid cells.Easy3BFSGraph+1No attempts yet1s128 MBJudgeable
Commute RouteCount monotone east/north lattice paths from (1,1) to (a,b) that avoid n blocked intersections, with a and b at most 16.Easy3Dynamic programmingCombinatorics+2No attempts yet1s128 MBJudgeable
A Spiral WalkFill an N by N grid with the visit order of a clockwise spiral that starts at the top-left and ends near the center.Easy3SimulationMatrix+1No attempts yet1s128 MBJudgeable
Invasion of the MilkweedSpread milkweed from a start cell to all eight neighbors each week and report the week it covers the last non-boulder cell.Easy3BFSGraph+2No attempts yet1s128 MBJudgeable
Feeding TimeGiven a W by H grid of grass and rock, find the size of the largest connected grass region using 8-directional adjacency.Easy3DFSBFS+2No attempts yet1s128 MBJudgeable
Bad GrassCount connected components of nonzero cells in a grid, where two cells connect if they touch horizontally, vertically, or diagonally.Easy3GraphDFS+2No attempts yet1s128 MBJudgeable
Plumbing the PondGiven a grid of depth readings, find the largest positive value that appears in at least two cells adjacent horizontally, vertically, or diagonally.Easy3ArrayImplementation+2No attempts yet1s128 MBJudgeable
Mouse JourneyCount monotone right/down paths on an R by C grid from (1,1) to (R,C) that avoid K blocked cat cells.Easy3Dynamic programmingMatrix+1No attempts yet2s512 MBJudgeable
ClassGiven a grid of digits, sum each cell's average absolute difference from its up to four orthogonal neighbors, and print the total with four decimals.Easy3ImplementationMatrix+2No attempts yet1s1024 MBJudgeable
Nash EquilibriumGiven two m by n payoff matrices for players A and B, list every action pair where each player's action is a best response to the other's.Easy3Brute forceMatrix+1No attempts yet1s128 MBJudgeable
The Chosen Sub MatrixFor each N x N matrix, find the M x M sub matrix with the fewest distinct values, breaking ties by larger descending value lists, then by smaller top-left row and column.Easy3Brute forceImplementation+2No attempts yet1s128 MBJudgeable
Sudoku CheckerGiven an N^2 by N^2 grid with zeros for blanks, decide whether every row, column, and N by N square holds distinct nonzero numbers.Easy3Hash mapImplementation+1No attempts yet2s128 MBJudgeable
The HareFind the fewest knight jumps from the start cell to the burrow on a grid with blocked cells, or output NIE when unreachable.Easy3BFSGraph+1No attempts yet1s512 MBJudgeable
LagnoCount the most white pieces a single black move flips on an 8 by 8 Othello board.Easy3SimulationMatrix+1No attempts yet1s128 MBJudgeable
Taxi RoutesCount the routes from the southwest to the northeast corner of a grid up to 30 by 30 that move only east or north and avoid blocked intersections.Easy3Dynamic programmingMatrixNo attempts yet1s128 MBJudgeable
Sudoku GradingCheck each filled 9x9 board and report whether every row, column, and 3x3 box holds the digits 1 to 9 exactly once.Easy3ImplementationMatrixNo attempts yet1s128 MBJudgeable
Robot in a MazeFind the fewest up, down, left, or right moves from S to any G in each grid maze, or report that no exit exists.Easy3BFSMatrixNo attempts yet1s128 MBJudgeable
CrankCount the boundary rooftops that can reach the boss by moving only to equal or lower adjacent buildings.Easy3BFSGraph+1No attempts yet1s128 MBJudgeable
Rainforest CanopyCount the groups of 1s connected through all eight neighbours in each square binary image.Easy3DFSGraph+1No attempts yet1s128 MBJudgeable
Surface AreaGiven column heights on a grid, compute the total exposed surface area of the solid, including top, sides, and floor.Easy3SimulationMatrixNo attempts yet1s128 MBJudgeable
Mini Sudoku XRead 6 by 6 grids and report whether each row, column, diagonal, and 2 by 3 block holds digits 1 to 6 exactly once.Easy3ImplementationMatrixNo attempts yet1s256 MBJudgeable
Knight MovesFind the fewest knight moves from K to X on a grid with blocked squares, or output -1 when unreachable.Easy3BFSMatrixNo attempts yet1s128 MBJudgeable
Elephant ShowCount the yellow tiles reachable from the elephant start by moving up, down, left, or right.Easy3DFSMatrixNo attempts yet1s128 MBJudgeable
GeckoPick a top-row tile and move straight down, down-left, or down-right each row to maximize the mosquitoes eaten.Easy3Dynamic programmingMatrixNo attempts yet2s512 MBJudgeable
Playing Fair with CryptographyGiven a key and a plaintext, build the 5x5 Playfair grid and encrypt the text into digraphs with cycling filler letters.Easy3SimulationImplementation+2No attempts yet2s128 MBJudgeable
RockyA horse walks straight across a grid and turns by fixed rules when a rock blocks it; report the exit square and the number of stepped squares.Easy3SimulationMatrixNo attempts yet1s128 MBJudgeable
Quadtree Image CompressionCount the bits produced by recursively splitting an L by L binary image into quadrants until each block is uniform.Easy3Divide and conquerRecursion+1No attempts yet2s1024 MBJudgeable
Frogger's For DinnerSimulate a frog walking down a 10 by 10 road while cars wrap around their lanes and decide if any starting column reaches the far side alive.Easy3SimulationBrute force+1No attempts yet1s128 MBJudgeable
Asteroids!Find the shortest 6-directional path through an N by N by N grid with blocked cells, or report that no route exists.Easy3BFSMatrixNo attempts yet1s128 MBJudgeable
Color WeaknessCount connected R, G, B regions in an N by N grid twice, once normally and once with R and G merged.Easy3BFSMatrixNo attempts yet1s128 MBJudgeable
Colored PaperCompute the area of each of N overlapping axis-aligned rectangles that stays visible after later rectangles cover it.Easy3SimulationMatrix+1No attempts yet1s64 MBJudgeable
Minion WalkMark every grid cell reachable from the top-left corner, print the room as an ASCII table, and report whether the bottom-right cell is reachable.Easy3BFSMatrix+1No attempts yet1s256 MBJudgeable
The Trojan HorseMark all cells visited by patrol routes on an h by w grid, then count 4-connected unvisited regions with at least s cells.Easy3DFSSimulation+1No attempts yet1s256 MBJudgeable