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 results907 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Seat SwappingGiven N students each with a team label (K up to 8), find the minimum adjacent swaps to group each team into one contiguous block in some chosen team order. | Medium7 | Dynamic programmingBit manipulation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Sitting and StandingSimulate a cyclic cellular automaton of standing or sitting students for up to a billion steps efficiently using the XOR-with-neighbor structure. | Medium7 | Bit manipulationMath+1 | No attempts yet | 10s | 128 MB | Judgeable |
| Line UpGiven N students and M precedence constraints, compute the minimum and maximum possible position each student can occupy in any valid linear order, or report impossibility if a cycle exists. | Medium7 | Topological sortGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Covering Holes in a BoardGiven a grid of holes, find the minimum number of horizontal or vertical tape strips (which may overlap on hole cells but never cover a non-hole cell) needed to cover every hole. | Medium7 | GraphBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| I²CParse raw I2C SCL/SDA bit-sample sequences to decode start/stop bits, address, direction, ACKs, and data bytes, reporting the transaction or the first protocol error. | Medium7 | SimulationString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Romantic KingGiven a grid with a start, an end, and up to 16 gift trees where movement speed decreases with carried gifts, find the maximum number of gifts deliverable within a time limit. | Medium7 | BFSDynamic programming+1 | No attempts yet | 10s | 128 MB | Judgeable |
| Donghyuk, King of the Board GameGiven a board colored by AND of bit patterns of row and column indices, count gray cells visited in the first K steps of a zigzag diagonal traversal of an R x C grid. | Medium7 | MathBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TV SwitchesFind the minimum number of switch presses, where pressing a switch releases only a fixed subset of others, to reach a state where only switch 3 is pressed. | Medium7 | BFSBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Bitwise ExpressionsGiven ranges for variables combined by OR within groups and AND across groups, find the maximum achievable value of the resulting bitwise expression. | Medium7 | Bit manipulationGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Strange BillboardFind the minimum number of tile taps (a Lights Out style toggle puzzle) needed to make an R x C grid all white, or report impossibility. | Medium7 | Bit manipulationBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Binary Stirling NumbersGiven n and m up to 1e9, determine the parity of the Stirling number of the second kind S(n, m) for many test cases efficiently. | Medium7 | Bit manipulationMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| High SecurityGiven up to 50000 length-5 passwords over 62 characters, count pairs of passwords for each Hamming distance from 0 to 5. | Medium7 | StringCombinatorics+2 | No attempts yet | 3s | 256 MB | Judgeable |
| Orthogonal ClosureGiven two binary strings, decide whether T equals the XOR of some pair of circular shifts of S, requiring an efficient algorithm beyond brute force for n up to 5000. | Medium7 | String matchingBit manipulation+1 | No attempts yet | 2s | 64 MB | Judgeable |
| Digital ClockDetermine every plausible starting real time for a broken seven-segment clock, given a sequence of minute-by-minute observed displays where some segments are permanently dead. | Medium7 | Bit manipulationSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Let There Be LightGiven up to 2000 balloons blocking up to 15 point lights from a target point, choose at most R balloons to remove to maximize total illumination, computed via geometric occlusion and a min-cut/greedy set-cover style optimization over light-blocking sets, printed as an exact fraction. | Medium7 | GeometryBit manipulation+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Awkward LightsGiven a grid where toggling a switch flips lights at a fixed Manhattan distance, decide over GF(2) whether all lights can be turned off simultaneously. | Medium7 | MathBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Exact MeasurementEach box offers up to q_i masses of weight 10^k_i; find the fewest boxes to open so the chosen masses sum to exactly x. | Medium7 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| HyperdromeCount substrings of S whose characters can be rearranged into a palindrome, where only the parity of each letter's count matters. | Medium7 | Bit manipulationPrefix sum+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Sofa, So GoodGiven framing and upholstering time matrices, find the minimum-cost framing assignment, then the minimum-cost upholstering assignment, and report each worker's schedule and total idle time. | Medium7 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Moving PointsFind the least time for one chaser to intercept N moving targets in order when the chaser is faster than every target. | Medium7 | Dynamic programmingGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Counting BitsCount integers in [LO, HI] whose number of halving steps under the popcount map reaches 1 in exactly X steps. | Medium7 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ShoppingGiven weighted roads and up to 10 stores, find the shortest round trip from house 0 visiting every store. | Medium7 | GraphShortest path+2 | No attempts yet | 3s | 128 MB | Judgeable |
| RooksGiven a 15x15 board of marked squares, find the minimum number of rooks needed so every marked square lies in a chosen row or column. | Medium7 | GreedyBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| YahtzeeGiven 13 rounds of five dice, assign each round to a distinct Yahtzee category to maximize total score including the upper-section bonus. | Medium7 | Dynamic programmingBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Rings and RunesValidate the runes for several gates, report the highest-priority error, then decide if the resulting 3-CNF formula is satisfiable. | Medium7 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Save the Python Programmers!Six labeled teams on a graph must swap houses, moving one team per night into an adjacent empty house while strictly alternating team type; find the minimum number of nights or report impossibility. | Medium7 | BFSGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| PegsGiven a 5x5 peg solitaire board with empty, peg, and blocked cells, find the minimum number of pegs reachable by any sequence of horizontal or vertical jumps. | Medium7 | DFSBacktracking+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Shut the BoxGiven N pieces labeled 1 to N and up to T turn values, mark disjoint sets of unmarked pieces summing exactly to each turn value in order, and find the largest total number of pieces markable. | Medium7 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| PlanksGiven a 10x10 grid of stumps and several sets of plank lengths, find the minimum number of planks needed to walk from the top-left stump to the bottom-right stump using each plank at most once. | Medium7 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Knight StoryAssign N knights to N distinct target cells on an infinite chessboard to minimize the total number of knight moves. | Medium7 | Dynamic programmingShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Walsh MatrixSum entries in one row of a Walsh matrix over columns S through E, where the matrix size 2^N can reach 2^60. | Medium7 | Divide and conquerRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| And Then, How Many Are There?Given stacked discs of four colors, repeatedly remove two same-colored discs that are both uncovered; find the maximum number of discs removable. | Medium7 | Dynamic programmingBit manipulation+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Traveling by StagecoachWith up to 8 one-use tickets, each giving a speed, find the fastest route from city a to city b, or report Impossible. | Medium7 | GraphShortest path+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Robot VacuumFind the minimum number of moves for a robot to visit and clean all dirty cells in a grid with furniture, or report -1 if some are unreachable. | Medium7 | BFSShortest path+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Power BloggerFind the cheapest closed walk from city 1 that traverses every required edge at least once, using optional extra edges. | Medium7 | GraphDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Allergy TestFind the shortest non-adaptive schedule for applying allergens on a single morning each day so that every reaction pattern identifies exactly the allergy set. | Medium7 | CombinatoricsBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Whac-a-MoleGiven each mole's position and time, find the maximum number of moles whacked while the hammer moves at most distance d between time steps. | Medium7 | Dynamic programmingGeometry+1 | No attempts yet | 1s | 128 MB | Judgeable |
| BarteringGiven starting items, wanted items, and up to 20 barter trades usable at most M times, find the fewest trades to hold all wanted items while never exceeding 5 held items. | Medium7 | BFSGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Protect Our Treasure!Given each pirate's set of keys, list every minimal group whose union covers all locks, ordered by size then lexicographically. | Medium7 | CombinatoricsBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Polly Wants a CrackerMatch each spoken word to a distinct original word minimizing total Levenshtein edit distance, and report that minimum sum. | Medium7 | Dynamic programmingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| EvolutionGiven N DNA strings linked in an unknown parent-child order, compute each creature's probability of being the original ancestor. | Medium7 | ProbabilityBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Queen GameGiven N queens on an R by C board that move up, left, or up-left, decide if the first player wins with optimal play. | Medium7 | Game theoryMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Uncle Tom's Inherited LandGiven a grid where at most 50 squares are usable land and the rest are ponds, find the maximum number of 1x2 dominoes that tile the usable squares. | Medium7 | GraphDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| BlinkEach bulb toggles when its left neighbor was on the previous step; given N up to 16 bulbs and a step count B up to 10^15, report the final states. | Medium7 | MatrixBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| RelocationGiven an undirected weighted graph with up to 5 market towns, pick a non-market town as home and an order to visit all markets and return, minimizing total distance. | Medium7 | Shortest pathGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Binary SudokuGiven a 9x9 grid of 0s and 1s, find the fewest toggles so that every row, column, and 3x3 block has an even number of 1s. | Medium7 | MathBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Corn FieldsCount subsets of fertile cells in an M by N grid, M,N at most 12, with no two chosen cells sharing an edge, modulo 100000000. | Medium7 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cow YahtzeeCount ordered rolls of N dice with S sides that satisfy at least one OR-ed expression, where each expression ANDs forms like WxR meaning at least W copies of face R. | Medium7 | CombinatoricsMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Gold Balanced LineupGiven N cows each with a K-bit feature ID, find the longest contiguous range where every one of the K features appears the same number of times. | Medium7 | Hash mapPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| DiningEach cow likes certain foods and drinks, each item can go to one cow; maximize the number of cows that get a liked food and a liked drink. | Medium7 | GraphDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Islands and BridgesFind the maximum score of a Hamilton path on a graph where the score adds vertex values, edge products, and triangle products, and count how many paths achieve it. | Medium7 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| It's not a Bug, it's a Feature!Each bug state is a bitmask; find the shortest total patch time from all bugs present to no bugs, where patches have presence and absence preconditions. | Medium7 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Help BobGiven up to 15 pizzas with prices, areas, and stacked discount coupons unlocked by buying other pizzas, find the minimum total price over total area of any nonempty purchase order. | Medium7 | Dynamic programmingBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Bus Clock DisplayGiven up to 100 partial 7-segment clock readings with min and max elapsed minutes between consecutive readings, determine the time at each reading or report how many possibilities remain. | Medium7 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Measuring Problem DifficultyGiven three permutations of the numbers 1 to N, count pairs whose relative order is identical in all three orderings. | Medium7 | SortingDivide and conquer+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Wooden FenceGiven up to 16 trees with coordinates, values, and wood lengths, choose trees to cut so their total wood covers the convex hull perimeter of the rest, minimizing lost value. | Medium7 | GeometryBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Mysterious VillaGiven up to 10 rooms with doors and switches that may control other rooms' lights, find the minimum number of moves and toggles to reach the bedroom with only its light on. | Medium7 | BFSGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| S-NimGiven a move set S, decide for each position whether the S-Nim game is a win or a loss by computing Grundy numbers and XORing them over the heaps. | Medium7 | Game theoryDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Sylvester constructionGiven a Hadamard matrix built by the Sylvester doubling rule, print a small rectangular sub-matrix specified by its top-left corner. | Medium7 | Divide and conquerRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Odd Loving BakersSimulate monthly celebrations where bakers with an odd chalk count win and add marks to their favorite bakers; find the number of winners at celebration t up to 1e9. | Medium7 | Bit manipulationMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Letter ArithmeticAssign distinct digits to letters so that each given letter word plus a second equals a third, then print the three numeric values. | Medium7 | BacktrackingMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Shift RegisterGiven the first 2N output bits of a linear feedback shift register, recover the N switch values, choosing the lexicographically smallest valid setting or reporting -1. | Medium7 | MathBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| A New BeginningFind the fastest route through airport flight graph, refuelling at up to 20 airports within tank capacity, using great-circle distances. | Medium7 | GraphShortest path+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Cycle DetectionGiven a graph on at most 20 vertices, for each edge that lies on a cycle, count how many distinct simple cycles contain it. | Medium7 | GraphBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Color PaletteMaintain a set of K-bit colors under insertions and, for each query color, return the stored color with the maximum number of matching bit positions, breaking ties by smallest value. | Medium7 | TrieBit manipulation+2 | No attempts yet | 3s | 1024 MB | Judgeable |
| IOI PhotosEach order lists photo ranges on named rolls; choose for every roll to print individually, print the whole roll, or buy all rolls, minimizing total cost. | Medium7 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Destroying SquaresGiven an n x n matchstick grid (n <= 5) with some sticks already removed, find the minimum number of additional sticks to remove so that no square remains complete. | Medium7 | BacktrackingBit manipulation+2 | No attempts yet | 5s | 128 MB | Judgeable |
| PipesGiven a grid of modules with costs on interior walls, find the minimum-cost cycle that visits every module exactly once, starting and ending at the service module. | Medium7 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Queen KingdomOn an n by n board with pillars blocking queens' attacks, find the maximum number of non-attacking queens and the number of placements attaining it. | Medium7 | BacktrackingBrute force+2 | No attempts yet | 2s | 128 MB | Judgeable |
| ParityGiven n binary strings and target bits, find the smallest column subset of size at most k whose XOR over each string matches its bit. | Medium7 | Bit manipulationGreedy+2 | No attempts yet | 10s | 512 MB | Judgeable |
| RobotFind the shortest travel time for a robot that moves at speed 1 and turns 1 degree per second, hopping between points within distance R. | Medium7 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Better and Faster!Compute a CRC-style bit checksum of a string after each of up to 1e5 character substitutions, fast enough that recomputing from scratch times out. | Medium7 | Bit manipulationMath+1 | No attempts yet | 2s | 512 MB | Judgeable |
| (False) facesGiven a 0/1 matrix of proposed left-right pairs, decide whether the number of perfect matchings is divisible by 4. | Medium7 | CombinatoricsMath+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Vase CollectionGiven up to 100 shape-decoration pairs drawn from a 36 by 36 grid, find the largest k for which some k shapes and k decorations form a complete k by k block of owned pairs. | Medium7 | Brute forceBacktracking+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Violet Jigsaw PuzzleCount how many ways to place and rotate the given pieces into an n by m rectangle so that all touching sides match tab-to-blank and border sides are flat. | Medium7 | BacktrackingImplementation+1 | No attempts yet | 5s | 128 MB | Judgeable |
| ChainGiven which rings of a bytish chain are on a bar, find the minimum number of legal put-on/take-off moves to remove all rings. | Medium7 | Dynamic programmingRecursion+2 | No attempts yet | 3s | 512 MB | Judgeable |
| PrimitivusGiven a set of ordered pairs, find the shortest sequence in which every pair appears consecutively at least once. | Medium7 | GraphShortest path+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Multiset Permutation RankGiven one permutation of a multiset, compute its lexicographic rank among all distinct permutations, modulo m. | Medium7 | CombinatoricsMath+2 | No attempts yet | 2s | 128 MB | Judgeable |
| HexerFind the shortest walk from town 1 to town n where each road can be used only after collecting swords for all monster kinds on it. | Medium7 | Shortest pathGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| WalkGiven up to one million missing strings among n-bit names, decide whether two present names are connected through single-bit flips avoiding blocked names. | Medium7 | BFSGraph+2 | No attempts yet | 5s | 256 MB | Judgeable |
| SweetsPartition n boxes (n up to 24) of sweets into three groups with sums A <= D <= B, minimizing B - A. | Medium7 | Brute forceGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| MosaicismFor each phage, count ordered pairs of genes and pairs of other phages where one gene has a homolog in one phage and the other gene has a homolog in the other. | Medium7 | CombinatoricsBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| RooksGiven an n x n 0/1 board, decide whether the number of ways to place n non-attacking rooks on the 1-cells is odd or even. | Medium7 | CombinatoricsMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Interplanetary VacationFor each of n planets, compute the Manhattan distance to the farthest planet. | Medium7 | MathBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Three-bit Computers Strike BackGiven up to five functions on n states, decide whether some composition maps every state to 0. | Medium7 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| RoundupCount the axis-aligned squares of side at least 2 whose border cells are all 1 in an n by n binary grid. | Medium7 | Prefix sumMatrix+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Paper StripsCount the sets of dyadic pieces from repeated halving that exactly tile sectors a to b, modulo m. | Medium7 | Dynamic programmingDivide and conquer+1 | No attempts yet | 1s | 128 MB | Judgeable |
| EquipmentChoose exactly K of N pieces, each with five scores, to maximize the sum of the five category maxima. | Medium7 | Brute forceBit manipulation+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Movie Theater SeatingDecide whether S solo guests and C couples fit into R rows of 8 seats with reserved seats while keeping neighbors and front seats empty. | Medium7 | Dynamic programmingBit manipulation+1 | No attempts yet | 2s | 64 MB | Judgeable |
| Royal GemsFill each cell of an n by m board with one of four gems to maximize the ruby count while every ruby, emerald, and sapphire neighbors the required higher gems. | Medium7 | Dynamic programmingBacktracking+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Treasure ChestsOpen up to 12 treasure chests in the order that leaves the most keys, spending colored keys before wild ones to fill each lock. | Medium7 | Dynamic programmingBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Card GameTwo players alternately pick cards and OR the value into a shared number, losing by completing 511 or moving with no cards left. | Medium7 | Game theoryBit manipulation | No attempts yet | 1s | 128 MB | Judgeable |
| Lock PatternCount valid lock patterns on a 3 by 4 grid whose Manhattan segment lengths sum to L while avoiding the dots in S. | Medium7 | Dynamic programmingBit manipulation | No attempts yet | 5s | 128 MB | Judgeable |
| No ChangePay the ordered purchases with distinct coins, each covering one consecutive group within its value, to maximize unused value, or print -1. | Medium7 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Hack ProtectionCount the subarrays of the given array whose bitwise XOR equals their bitwise AND. | Medium7 | Bit manipulationPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| JanosikCount how many money bags Janosik pockets when n caskets holding 1 to n bags are emptied by the smallest-first split, pocket, or hand-out rule. | Medium7 | MathBit manipulation | No attempts yet | 1s | 128 MB | Judgeable |
| XOR Set ExpansionGiven an initial integer set, count the expansion rounds that add XORs of current and original elements until the set stops growing. | Medium7 | Bit manipulationBFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| The Urge to MergeYou pick disjoint adjacent pairs in a 3 by n grid to maximize the sum of the products of paired values. | Medium7 | Dynamic programmingBit manipulation | No attempts yet | 5s | 128 MB | Judgeable |
| Ride the dominoes on a chessboardPlace exactly K non-overlapping dominoes on an N by 3 board of integers to maximize the sum of covered cells. | Medium7 | Dynamic programmingBit manipulation | No attempts yet | 3s | 128 MB | Judgeable |
| Cow DecathlonAssign each cow to one event to maximize base scores plus prefix bonuses that cascade when thresholds are met. | Medium7 | Dynamic programmingBit manipulation | No attempts yet | 1s | 128 MB | Judgeable |