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,390 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| The Byteotian WarBoth players take turns discarding one of their top two cards and passing the other to the opponent; find the final score when both play optimally. | Hard8 | Dynamic programmingGame theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ScissorsGiven a rectilinear simple polygon, find the minimum number of drawn segments (each with endpoints on the boundary and interior inside) so that cutting along them makes every piece a rectangle. | Hard8 | GeometryGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| FosaGiven horizontal and vertical segments, find the largest axis-aligned square whose entire perimeter lies on those segments, or report that none exists. | Hard8 | GeometrySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| TransformationsGiven two binary strings of length n, decide whether disjoint ab and ba fragments can be swapped repeatedly to turn the first string into the second. | Hard8 | StringMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Pedestrian CrossingDecide whether a shoe of length s, stepping by k, can cross stripes of given widths while never overlapping a white stripe. | Hard8 | MathNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| PlotterGiven the recursively defined order-n bytecurve and m integer points, report how many times and at which seconds the pen visits each point. | Hard8 | RecursionDivide and conquer+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Laser PoolA ball bounces elastically around a grid of lit horizontal and vertical laser beams; count how many distinct lit beams it touches during t time units, including the start. | Hard8 | MathSimulation+2 | No attempts yet | 5s | 256 MB | Judgeable |
| The Shortest PeriodDelete exactly one letter from a string to minimize the length of the shortest period of the resulting word. | Hard8 | StringString matching+2 | No attempts yet | 5s | 128 MB | Judgeable |
| MushroomsA walker starts at glade 1, moves one glade every 15 minutes for t moves, picks all mushrooms on arrival, and each glade regrows 30 minutes later; maximize the total harvest. | Hard8 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Byteball MatchGiven partial results of a round-robin group, list every team that can still finish first once all remaining matches are played, under points and goal-difference tiebreaks. | Hard8 | GraphBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| StampsDecide whether a two-cell 3x3 stamp (domino in a row or column) plus an s x s all-inside stamp can turn an all-white k x k board into a given black-cell pattern. | Hard8 | MathGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| PermutationsCount completions of a partial permutation on 2n points that is an involution and encodes a correct bracket sequence. | Hard8 | CombinatoricsDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| TramFor each junction, find the greatest common divisor of all cycle lengths reachable from and returning to it, or -1 if no return is possible. | Hard8 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Paper ClipsFind the minimum number of 180-degree turns needed to separate a chain of clips joined in two possible ways, where clips sit in four orientations. | Hard8 | GreedyDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Idempotent FunctionsGiven f on {1..n}, count pairs (g, h) with g a permutation and h idempotent such that f = h composed with g, modulo 1e9+7. | Hard8 | CombinatoricsMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Conference - RectificationChoose a subset of whole reservations to keep so that total income from ticket sales minus room rent is maximized. | Hard8 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| CloudsGiven disjoint simple polygons and a fixed wind direction, place a point so the number of polygons that cross the vertical ray above it at some time is maximized. | Hard8 | GeometrySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Almost ConjugatesDecide whether two length-n words are almost conjugates and, if so, list every rotation of the first that differs from the second in exactly one position. | Hard8 | StringString matching+2 | No attempts yet | 1s | 128 MB | Judgeable |
| CrayfishFor each house, count how many turtles are reachable on a round trip that starts and ends moving backward, where special edges flip the direction of travel. | Hard8 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Sum of PolygonsAdd two convex polygons by Minkowski sum and print twice the area of the resulting polygon. | Hard8 | GeometryTwo pointers+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Holey ChessboardGiven a K by W board with holes, drill the most hole-free cells while keeping the permanent (count of non-attacking rook placements) unchanged. | Hard8 | CombinatoricsGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Courier ServicesFind all Pareto-optimal (cost, time) pairs among routes from a class-C source to a class-C destination in a network with a special office-class structure and cycles. | Hard8 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Jasiek's DrawingGiven a counter-clockwise walk around a polyomino's border cells, count the total number of blackened cells in the drawing. | Hard8 | GeometryImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Gordian DancesGiven a sequence of S (string swap) and R (quarter-turn) moves, find the minimum number of further moves that returns the dance to a horizontal, parallel, untangled state. | Hard8 | MathString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Bachelor PartyGiven a tree and one-way tickets, decide if a vertex-simple walk from s to t uses every ticket exactly once. | Hard8 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| KeyboardA 1x2 domino slides around a grid through the single uncovered cell; find the fewest moves to uncover every vowel cell at least once. | Hard8 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| GodzillaEach day Godzilla starts at junction 1, walks a path, eats a building and destroys buildings on the way; each night one person leaves every standing building. Maximize the total eaten. | Hard8 | GraphGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| VirusesGiven up to 24 virus sources with distinct daily hours, determine how many cells each one ends up occupying on an n by n board. | Hard8 | GeometryBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| MapsGiven up to a million arbitrarily rotated rectangles, find the number of edges of their common intersection polygon. | Hard8 | GeometryImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| JEvaluate a J-style vector expression over up to 100000 entries using low-degree polynomials per component and output the scalar result modulo 10^9. | Hard8 | MathImplementation | No attempts yet | 2s | 256 MB | Judgeable |
| Intuitionistic LogicGiven a DAG and its antichain algebra, test each formula over all variable assignments and report valid or invalid. | Hard8 | Brute forceGraph+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Manifest DestinySimulate turn-by-turn movement, eating, combat, and starvation on a grid, and report each group's size, position, and death year. | Hard8 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SnakeReconstruct the Hamiltonian path numbering of a 3 by n board from some given cell numbers. | Hard8 | BacktrackingGraph+1 | No attempts yet | 3s | 512 MB | Judgeable |
| The kingdomFollow the fixed DFS, vertex-split, and Euler-circuit steps to output edge-disjoint even-length trails pairing every odd-degree vertex. | Hard8 | GraphDFS+2 | No attempts yet | 1s | 256 MB | Judgeable |
| SaveitDesign encode and decode procedures that compress the all-pairs hub distances of a connected graph into a short bitstream, with decode reconstructing every hub-to-city hop count. | Hard8 | GraphBFS+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Who Do You Think You Are?Read a family tree and answer queries naming the relationship of name1 to name2, including blood, cousin, and in-law terms. | Hard8 | GraphTree+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Watering the fieldsCover every non-scarecrow cell with trominoes of three cells while letting at most R times C trominoes cross field borders. | Hard8 | ImplementationBacktracking+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Yut Nori (Large)You receive every throw in order and the pieces left on the board, and you decide whether the game rules can produce that board. | Hard8 | BacktrackingSimulation+1 | No attempts yet | 10s | 512 MB | Judgeable |
| Polygraph (Large)Each of N people is a truth-teller or a liar; given their statements about who shares which city, mark each person as forced Truthtown, forced Liarville, or undetermined. | Hard8 | Union-findGraph+1 | No attempts yet | 5s | 512 MB | Judgeable |
| MarblesGiven 2n marbles of n colors in a row, find the minimum height of non-crossing paths pairing each color, or -1 if impossible. | Hard8 | Dynamic programmingImplementation+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Two Lights in a Square RoomGiven two point lights and up to 50 circular pillars inside a square, find the area lit by neither, by red only, by green only, and by both. | Hard8 | GeometryImplementation+2 | No attempts yet | 40s | 512 MB | Judgeable |
| EZ-Sokoban (Small)Move at most three magnetized boxes on a grid to their goal cells with the fewest pushes, where boxes must stay connected except for at most one push. | Hard8 | BFSSimulation+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Painting a Fence (Large)Pick the fewest offers from N interval-and-color proposals so every one of 10000 fence sections is covered using at most 3 distinct colors. | Hard8 | IntervalsGreedy+2 | No attempts yet | 10s | 512 MB | Judgeable |
| Apocalypse Soon (Large)On a grid of nations attacking their strongest living neighbor each day, choose your own attacks to maximize how many days your nation survives. | Hard8 | SimulationGreedy+2 | No attempts yet | 5s | 512 MB | Judgeable |
| How Big Are the Pockets? (Large)A run-length-encoded turtle walk traces a simple closed lattice polygon; compute the total area of all points outside it that have boundary both east and west or both north and south. | Hard8 | GeometrySimulation+2 | No attempts yet | 5s | 512 MB | Judgeable |
| PortalFind the fewest moves to reach the cake in a walled grid, where firing a portal gun at walls (free of move cost) lets you teleport between two portal openings. | Hard8 | BFSGraph+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Minimum transmitter powerPlace a flagship in 3D so the maximum weighted Manhattan distance to N ships is minimized, and report that minimum power rounded to six decimals. | Hard8 | GeometryBinary search+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Fly Swatter (Small)Compute the probability that a randomly placed fly disk touches a circular ring crossed by a grid of cylindrical strings, and print it to six decimals. | Hard8 | GeometryMath+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Fly Swatter (Large)Given the racquet geometry, compute the probability that a fly of radius f, centered uniformly in the outer circle, overlaps the ring or any string. | Hard8 | GeometryMath+2 | No attempts yet | 20s | 512 MB | Judgeable |
| BossesBuild a rooted tree on n employees where each node's parent is one of its accepted bosses, then assign minimum positive salaries with every boss exceeding the sum of children. | Hard8 | TreeDynamic programming+2 | No attempts yet | 1.5s | 256 MB | Judgeable |
| Spiral Rectangle SumsIn a counterclockwise spiral of numbers on a (2n+1)x(2n+1) grid centered at 1, answer q queries for the sum inside an axis-aligned rectangle modulo 1e9+7. | Hard8 | MathImplementation+2 | No attempts yet | 1.5s | 256 MB | Judgeable |
| HyperwaysAfter each edge is added to a multigraph, report how many edges became safe, where an edge is safe when it lies on a cycle. | Hard8 | Union-findGraph+2 | No attempts yet | 3s | 1024 MB | Judgeable |
| Next 3-1-2 pattern avoiding permutationGiven a 3-1-2-avoiding permutation of 1 to n, print the next one in lexicographic order. | Hard8 | CombinatoricsGreedy+1 | No attempts yet | 0.1s | 32 MB | Judgeable |
| Hongjun Loves PaintingBricks start with color equal to their index and colorfulness 0; range paint operations add the absolute color change to each brick, and queries ask for the total colorfulness over a range. | Hard8 | Segment treeImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Finding an integerFind the smallest integer at least N whose decimal digits contain d1 at least c1 times and d2 at least c2 times. | Hard8 | GreedyImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Maximum substring costGiven a string T, find the maximum of length times number of occurrences over all substrings S of T. | Hard8 | StringSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Block PuzzleOn an N by N grid, roll a 1x1x2 block from any start cell to the goal without falling into holes; find the fewest cells to dig into holes so the goal becomes unreachable. | Hard8 | BFSGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Array GCDDelete one contiguous block and change at most one element by 1 each, so the remaining array has gcd greater than 1, at minimum cost. | Hard8 | Number theoryGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Points on a CircleGiven n random points on a unit circle and an angle p, compute -log2 of the probability that all n points fit inside some arc of central angle p. | Hard8 | ProbabilityMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Fewest letters for a suffix arrayGiven a permutation that is a suffix array, find the minimum number of distinct letters needed for a string that realizes exactly this suffix array. | Hard8 | StringGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Minho's WishFor each of Q range queries on an array, count how many distinct values occur at least three times within the queried index range. | Hard8 | Segment treePrefix sum+2 | No attempts yet | 2s | 512 MB | Judgeable |
| BarbariansA tree's edges are deleted one by one, each deletion multiplies each vertex's anger by (reachable before) - (reachable after) + 1, and after each deletion the total anger is printed modulo 1e9+7. | Hard8 | TreeUnion-find+2 | No attempts yet | 4s | 512 MB | Judgeable |
| Containers and ReagentsDecide whether all reagents can be fully distributed among containers so each container's volume range and one reagent's minimum percentage are met. | Hard8 | GreedyMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Elimination Round, Problem FGiven positive a_i and d, decide whether nonzero x_i exist with sum a_i x_i = d, and if so build the unique sequence defined by the greedy rule minimizing each |D_i|. | Hard8 | Number theoryGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| New Adventure of Marty and DocPlace a recycling plant on one grid cell so a robot carries every part to it with the fewest moves, picking up and dropping one part at a time. | Hard8 | MathPrefix sum+2 | No attempts yet | 2s | 512 MB | Judgeable |
| WhiteboardGiven a path on a grid and a target pattern, find the smallest and largest drying timestep T so the final board matches the target. | Hard8 | SimulationImplementation+2 | No attempts yet | 5s | 512 MB | Judgeable |
| FenceGiven points on grid corners, find the shortest closed fence along cell edges and diagonals that encloses all of them, output as a + b*sqrt(2). | Hard8 | GeometrySorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Shortest BridgeGiven two polygonal riverbanks and points s and t on opposite sides, minimize the bridge length between the banks, then the road lengths from s and t to its endpoints. | Hard8 | GeometryBrute force+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Unknown SwitchesGiven switch-operation patterns and resulting bulb states over Q steps, determine which of N switches controls each bulb, or mark it unknown. Standard whiteboard task? No. | Hard8 | Bit manipulationMath+2 | No attempts yet | 8s | 512 MB | Judgeable |
| Scorpion Test for Permutation GraphsAfter each swap in a permutation A, decide whether the permutation graph (edges between crossing chords) is scorpion-like. | Hard8 | GraphSorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Router 2Build a unique-path layered router digraph with N inputs and N outputs, at most M_lim edges, node power at most P_lim, printing the lexicographically smallest edge list. | Hard8 | GraphGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Counting rectangles by distinct numbersCount rectangles of every size by how many distinct numbers they contain, then output a product of those counts modulo 1e9+7. | Hard8 | ImplementationBit manipulation+2 | No attempts yet | 3s | 256 MB | Judgeable |
| Dots and BoxesGiven a Dots and Boxes position with no completed square, find the longest sequence of moves that still avoids closing any square, then print that length plus one. | Hard8 | GraphDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Free DessertsCount pairs a, b with a < b, a + b = P, and no decimal digit repeats across a, b, and P, listing up to 5000 of them. | Hard8 | Bit manipulationBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| PrimonimoFind counts of row/column increments mod prime p that turn all squares into p, choosing the lexicographically smallest solution. | Hard8 | MathNumber theory+2 | No attempts yet | 2s | 512 MB | Judgeable |
| TreeAfter each query asks whether two vertices are still connected, the tree may lose one edge based on the answer, so connectivity must be tracked under online deletions. | Hard8 | TreeUnion-find+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Magic Towers and TeleportationDecide whether repeatedly reflecting the whole set of points across three fixed towers can turn one given point multiset into another, with soldiers considered indistinguishable. | Hard8 | GeometryMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Rock BandEach of M members ranks all S songs; a set list is valid if every member plays all songs they rank above any chosen song. Find a shortest valid set list. | Hard8 | GreedySorting+2 | No attempts yet | 4s | 512 MB | Judgeable |
| ArtworkPaint horizontal and vertical black strokes on a grid one at a time, and after each stroke report the number of white connected regions. | Hard8 | Union-findImplementation+2 | No attempts yet | 4s | 512 MB | Judgeable |
| InterceptionPlace the fewest listening devices on the edges of a street-wide phone-line graph so that every given call route is covered. | Hard8 | GraphGreedy+2 | No attempts yet | 8s | 512 MB | Judgeable |
| Keeping the Dogs ApartTwo dogs follow their own polyline routes at the same constant speed; find the minimum distance between them while both are still walking. | Hard8 | GeometryTwo pointers+2 | No attempts yet | 6s | 512 MB | Judgeable |
| Placing Medals on a Binary TreeGiven medals with depths in a pile, decide greedily and incrementally which can be placed on a perfect binary tree so that no placed node is an ancestor of another. | Hard8 | GreedyTree+1 | No attempts yet | 4s | 512 MB | Judgeable |
| Cover the Polygon with Your DiskPlace a fixed-radius disk anywhere on the plane to maximize the area shared with a convex polygon, and print that maximum. | Hard8 | GeometryBinary search+1 | No attempts yet | 3s | 512 MB | Judgeable |
| Sorting GameApply K sets of operations, each sorting a prefix of length A ascending then a prefix of length B descending, and print the final sequence. | Hard8 | SortingImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Laser TowersOn a grid with directional laser towers and enemy counts, choose which towers fire and at which cell so lasers never intersect, maximizing enemies destroyed. | Hard8 | GreedyBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Counting ear shapesCount quadruples of red points and pairs of blue points forming an ear shape with angle and containment conditions. | Hard8 | GeometryBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Edsger DijkstraGiven a program of labeled print statements and if-goto statements with counters that are true for a bounded number of times, decide whether transforming every if-goto into a do-while loop keeps the program's output and compiles. | Hard8 | SimulationImplementation+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Substitution Cipher KeyGiven N distinct words and a target permutation, find the lexicographically smallest substitution cipher key that sorts the encrypted words into that order, or report none. | Hard8 | GreedySorting+2 | No attempts yet | 1s | 64 MB | Judgeable |
| KingN elves each target a dwarf; elves enter one at a time and slide clockwise to the next free spot. Choose the entry order to maximize elven wins. | Hard8 | GreedySorting+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Vertices connected by the same colorProcess color flip and reachability queries on a tree where two vertices are connected if every vertex on their path has the same color. | Hard8 | TreeUnion-find+2 | No attempts yet | 2s | 512 MB | Judgeable |
| K-th smallest weight on a tree pathFor each query, print the k-th smallest vertex weight on the unique tree path between two vertices. | Hard8 | TreeBinary search+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Palindromes and QueriesSupport range character assignments and count palindromic substrings of length at most K inside a queried range. | Hard8 | Segment treeString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| RoomGiven points on the edges of an unknown orthogonal monotone polygon with edge orientations, reconstruct it and output its perimeter or -1 if impossible. | Hard8 | GeometrySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Feasible roundingRound each decimal entry to floor or ceiling so that every row and column sum still matches its stated total, choosing the lexicographically smallest whole table. | Hard8 | GreedyMatrix+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Olympic Gold AthletesEach athlete's skill and fatigue change linearly in time; count those who are the unique max-skill and unique min-fatigue athlete at some time t >= 0. | Hard8 | GeometryBinary search+2 | No attempts yet | 1s | 512 MB | Judgeable |
| OminoboxFor every fixed N-omino placement in a small grid, the drop score is H minus the maximum stack height covered; sum the best placement score over all N-ominoes. | Hard8 | Brute forceImplementation+2 | No attempts yet | 10s | 512 MB | Judgeable |
| Dona MinhocaOn a cactus graph, for each query (entry chamber, worm length) decide whether a closed non-backtracking walk of length at most M exists and give the shortest such distance. | Hard8 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Ecology PreserveGiven an N by N grid of tree counts, pick a connected set of exactly M cells (M at most 10) maximizing the total tree count. | Hard8 | Dynamic programmingDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| War Among the StarsCompute the shortest distance between two tetrahedra in space, given the coordinates of their eight vertices. | Hard8 | GeometryImplementation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Scientists' RegattaGiven start, finish, and non-intersecting segment obstacles in the plane, compute the shortest path that never crosses a segment interior. | Hard8 | GeometryShortest path+2 | No attempts yet | 2s | 512 MB | Judgeable |