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 |
|---|---|---|---|---|---|---|
| Radio CoverageChoose a non-overlapping subset of at most 10 candidate disks inside a base disk to maximize the union area of the base and chosen disks. | Medium6 | GeometryBrute force+1 | No attempts yet | 3s | 128 MB | Judgeable |
| ChecksumAppend zeros to a bit message, divide the polynomial over F2 by a generator, output the remainder as decimal, or ERROR if the generator is composite. | Medium6 | MathNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| XOR NetsGiven a XOR net with n inputs, count how many binary words in the range [a, b] make the net output 1. | Medium6 | Bit manipulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| KnightsOn a 3 by n board with one possibly blocked square per column, place the maximum number of non-attacking knights and count the number of maximum placements. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Truth Fraction of a FormulaGiven a DNF formula over n variables, count the valuations that satisfy at least one clause and print the fraction over 2^n as an exact decimal. | Medium6 | Bit manipulationCombinatorics+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Signed Binary ExpansionGiven a decimal integer with up to 500 digits, find the smallest possible count of nonzero digits in a signed binary expansion. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Moving PegsJump pegs over lines of pegs on a 15-hole triangle to leave one peg in the starting hole in the fewest moves. | Medium6 | BFSBrute force+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Contest Problem AssignmentSplit up to ten contest problems among three members with individual time limits to solve the largest possible count. | Medium6 | Dynamic programmingBit manipulation | No attempts yet | 1s | 128 MB | Judgeable |
| Who needs 8 queens when you can have N?Find the lexicographically smallest placement of N non-attacking queens on an N by N board for each test case. | Medium6 | BacktrackingRecursion+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Suspicious OrdersCount the cliques in a network of up to 20 people whose combined ordered items cover at least one of the given attack combinations. | Medium6 | BacktrackingBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| InfluenceFrom the candidate set X, pick the person who reaches the most people through transitive influence, breaking ties by smallest id. | Medium6 | Topological sortGraph+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Friendship GraphDecide up to 200000 reachability queries on a directed graph with 2000 vertices, printing 1 when Y is reachable from X. | Medium6 | GraphDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| LazycatFind the shortest walk on a grid with walls that starts at S, visits every food cell, then ends at the bed. | Medium6 | Dynamic programmingBFS+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Unicycle countingFind the smallest number of arithmetic progressions that leave marks exactly at the observed road positions. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Web Service DependenciesCount the launch orders that place each container after all of its dependencies for each configuration. | Medium6 | Dynamic programmingTopological sort+1 | No attempts yet | 1s | 256 MB | Judgeable |
| SuperbullPick N minus 1 pairings that connect all team IDs into one group so the sum of pairwise XOR values is as large as possible. | Medium6 | Minimum spanning treeGraph+1 | No attempts yet | 1s | 256 MB | Judgeable |
| ImplicationGiven formulas assumed true, decide for each query formula whether it holds under every assignment that satisfies all assumptions. | Medium6 | Brute forceBit manipulation+1 | No attempts yet | 2s | 256 MB | Judgeable |
| 4×n TilingCount the ways to tile a 4 by N board with 1 by 3 and 3 by 1 trominoes modulo 1000000007 for each test case. | Medium6 | Dynamic programmingBit manipulation | No attempts yet | 2s | 256 MB | Judgeable |
| Coin Turning GameGiven a row of heads and tails, decide if the first player wins the interval-flip game and report the smallest winning first move. | Medium6 | Game theoryDynamic programming+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Dance RecitalReorder the given routines so the total number of dancers shared by consecutive routines is as small as possible. | Medium6 | Dynamic programmingBit manipulation | No attempts yet | 1s | 256 MB | Judgeable |
| Frodo and the MonsterSimulate up to 200000 cuts on the head count where odd cuts add the largest smaller prime and even cuts remove every head with the same binary popcount. | Medium6 | SimulationNumber theory+2 | No attempts yet | 1s | 256 MB | Judgeable |
| BankDecide whether M banknotes can be distributed to N people so each person receives exactly the owed salary. | Medium6 | Dynamic programmingBit manipulation | No attempts yet | 1s | 256 MB | Judgeable |
| NimbleEach turn slides one coin left along numbered squares, so print which player moves the last coin onto square zero under optimal play. | Medium6 | Game theoryBit manipulation | No attempts yet | 2s | 512 MB | Judgeable |
| XorbonacciGiven the first K terms of an XOR recurrence, answer many queries asking for the XOR of terms l through r with indices up to 1e18. | Medium6 | MathPrefix sum+1 | No attempts yet | 1s | 64 MB | Judgeable |
| IP Address SummarizationMerge the given IPv4 subnets and print the shortest ordered list of normalized subnets that covers exactly the same addresses. | Medium6 | IntervalsBit manipulation+2 | No attempts yet | 5s | 512 MB | Judgeable |
| IP Address Summarization (Large)The task merges the given IPv4 subnets into the shortest sorted list of normalized subnets covering exactly the same addresses. | Medium6 | TrieBit manipulation+1 | No attempts yet | 5s | 512 MB | Judgeable |
| River Flow (Small)Find the fewest farmers whose power-of-two toggling cycles explain N days of river flow, or declare the record impossible. | Medium6 | Brute forceBit manipulation+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Cut Tiles (Large)Pack square tiles with power-of-two sides into the fewest MxM tiles using only side-parallel cuts. | Medium6 | GreedySorting+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Charging Chaos (Large)Find a bit mask applied to every outlet string that makes the outlet set match the device set with the fewest flipped bits, or report that it is impossible. | Medium6 | Bit manipulationHash map+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Rational Number TreeGiven the infinite binary tree that lists every positive rational once, find the nth fraction in level order and the level-order position of a given fraction. | Medium6 | MathNumber theory+2 | No attempts yet | 5s | 512 MB | Judgeable |
| King (Small)On a board of at most 16 squares with burned cells, a king moves to unvisited neighbors; decide who wins under optimal play. | Medium6 | Game theoryDFS+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Painting blocksCount colorings of N blocks with 4 colors so that the number of red and yellow blocks are both even, modulo 10007. | Medium6 | CombinatoricsMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Colorful VillageMaintain N houses under range repaint operations and answer queries counting how many of the T colors appear in a range. | Medium6 | Segment treeBit manipulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| TrislePartition N powers into three nonempty groups to maximize the sum of the three XOR values. | Medium6 | Dynamic programmingBit manipulation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Good SetsCount nonempty subsets of {1,...,N} whose decimal digits, pooled together, use each digit 0-9 at most once. | Medium6 | Bit manipulationCombinatorics+1 | No attempts yet | 2s | 512 MB | Judgeable |
| OR Score of a SequenceSplit the array into K contiguous non-empty groups and maximize the sum of each group's bitwise OR. | Medium6 | Dynamic programmingBit manipulation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Maximum XOR of two numbersGiven N non-negative integers, find the maximum XOR over all pairs of distinct elements. | Medium6 | Bit manipulationTrie | No attempts yet | 2s | 512 MB | Judgeable |
| Flipping Coins 3Flip whole rows or columns of an N by M grid of coins to leave as few tails as possible, with N at most 20. | Medium6 | Bit manipulationBrute force+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Consistent Letter PathFind the shortest path on an N by N letter grid from top-left to bottom-right where no letter appears in both lowercase and uppercase along the path. | Medium6 | BFSBit manipulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Linear Feedback Shift RegisterGiven an N-bit linear feedback shift register, its taps, and two states, find the minimum number of clock pulses to reach the final state, or report that it is impossible. | Medium6 | Bit manipulationMath+1 | No attempts yet | 2s | 512 MB | Judgeable |
| XOR Sum 3Compute the XOR of every contiguous subsequence of A and print the sum of all those XOR values. | Medium6 | Bit manipulationPrefix sum+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Hamiltonian HypercubeGiven two binary strings in Gray Code order, count how many code words lie strictly between them on the n-bit Gray Code path. | Medium6 | Bit manipulationRecursion+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Emptying the GlassesGiven N glasses and pairwise pour costs, find the minimum effort to end with water in at most K glasses. | Medium6 | Dynamic programmingGraph+2 | No attempts yet | 2s | 32 MB | Judgeable |
| The Longest Travel RouteGiven a directed weighted graph with at most 18 cities, find the maximum total length of a simple path from city 0 to city n-1. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| O CanadaEach move flips a 2x2 block of an N x N red/white grid. Count pairs of given grids that can reach each other by such moves. | Medium6 | Bit manipulationHash map+2 | No attempts yet | 1s | 512 MB | Judgeable |
| BeesGiven an n by m hexagonal honeycomb's initial honey pattern, apply the rule that each cell fills next day exactly when an odd number of its neighbors were filled, and print the state after k days. | Medium6 | Bit manipulationSimulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| XORMaintain an array under range XOR updates and point queries, printing each queried element in order. | Medium6 | Binary searchPrefix sum+2 | No attempts yet | 2s | 512 MB | Judgeable |
| XOR EquationCount ordered pairs of positive integers A and B with A+B=S and A xor B=X. | Medium6 | MathBit manipulation | No attempts yet | 2s | 512 MB | Judgeable |
| XOR GroupsErase cells from an N by M grid in increasing value order and after each erasure report the maximum sum of XOR values of the connected groups. | Medium6 | Union-findSimulation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Key Rearrangement 2Given n keys with lists of compatible keyholes and a time limit k, decide whether a perfect matching exists with total |i-j| cost at most k. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Monster Path (Small)Given a small grid, a start cell, and a fixed step count, choose a walk maximizing the expected number of distinct monsters caught. | Medium6 | Dynamic programmingBit manipulation+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Integer GameGiven N and up to 15 divisors, remove multiples of each in order and count how many numbers from 1 to N survive. | Medium6 | MathNumber theory+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Subarray XOR sumsFor a sequence, count how often each XOR value appears among all contiguous subarrays, then report the most frequent value, breaking ties by choosing the smallest. | Medium6 | Prefix sumBit manipulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Elevator PrankEach move toggles a fixed set of buttons and costs N, N/2, N/2, or N/3 seconds; count the distinct button states reachable with total time at most m, including pressing nothing. | Medium6 | Bit manipulationBrute force+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Turning Off the LightsGiven a 10x10 grid of lit and unlit bulbs, find the minimum presses so that every bulb ends up off. | Medium6 | Brute forceBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Asphalt PavingGiven segments on a triangular grid, choose the largest subset so that no two share an endpoint at an acute angle. | Medium6 | GraphDynamic programming+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Friend PalindromeGiven a friendship graph on up to 20 students, find the largest number of students that can form a palindrome-like line where every student except the possible middle one is paired with a friend. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| PaversCount the tilings of a 2 x n board with 1x1 squares, 2x1 rectangles, and L-trominoes, and sum the total number of each paver over all tilings. | Medium6 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Birthday Gift SequenceFor each query (x, K), form every non-empty subset sum of {1, x, x^2, ...}, sort uniquely, and sum the K-th values over all queries modulo 1e9+7. | Medium6 | MathCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Football Association ElectionGiven N ranked ballots over M candidates, find the current winner and the fewest candidates to remove so that candidate K wins. | Medium6 | Brute forceBit manipulation+2 | No attempts yet | 3s | 64 MB | Judgeable |
| Tap Titanz at Moloco (Easy)On an n by n black/white board, each tap flips a whole same-color connected region; find the minimum taps to make the board one color. | Medium6 | GraphBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| ifConstruct a value x of type int or long such that x != 0 and x == -x, exploring two's complement overflow wrap-around. | Medium6 | MathBit manipulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| The PricesChoose for each product a wholesaler to buy it from, paying each visited wholesaler's round-trip cost once, to minimize the total. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Two teams with the smallest ability gapSplit N people into two nonempty teams so the difference between the two teams' pairwise ability sums is minimized, and print that minimum. | Medium6 | Bit manipulationBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Escape RoomEach press toggles one button and up to two buttons to its right; find the fewest presses to turn an all-off row of N lights into a target 0/1 pattern. | Medium6 | GreedyArray+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Edge ColoringCount subsets of edges of a multigraph, modulo 100000007, such that every vertex has an odd number of chosen incident edges. | Medium6 | MathBit manipulation+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Drawn and QuarteredA fixed permutation is applied to a string K times; find where each index goes and output the rearranged string. | Medium6 | MathBit manipulation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Is-A? Has-A? Who Knowz-A?Given is-a and has-a edges between classes, answer queries whether one class is-a or has-a another using inheritance and field transitivity. | Medium6 | GraphBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| EscapeFind the fewest presses of A (add 1) and B (double then cut the leading digit) turning N into G without passing 99999 in T steps, or report impossible. | Medium6 | BFSGraph+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Monkey SportsAssign each of N monkeys to team A or B on each of 7 days so that every pair of monkeys is split across teams on at least one day. | Medium6 | CombinatoricsMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| DebloGiven a tree with numbers on its nodes, add up the XOR of every node-value along every path between two nodes, counting single-node paths too. | Medium6 | TreeBit manipulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| CrazinessGiven a symmetric matrix of pairwise and individual craziness values for n up to 20 relatives, find the non-empty subset whose invited pairs plus individual terms sum to the maximum. | Medium6 | Brute forceBit manipulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Hotel ManagementEach room belongs to exactly two switches; find whether pressing some subset of switches turns every room's lock state to open. | Medium6 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Traveling Salesman 3Find the minimum-length round trip that visits all N cities exactly once and returns to the start, where N is at most 16. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| ParametriziranCount pairs of equal-length words over lowercase letters and question marks that can be made identical by filling the question marks. | Medium6 | Bit manipulationHash map+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Space ProbeGiven travel times between N planets and a start planet, find the shortest route that visits every planet, with no need to return to the start. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Team SelectionPick five of n candidates and assign each a distinct role among A to E so the total skill summed over roles is as large as possible. | Medium6 | Dynamic programmingBit manipulation+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Oh Right, the UmbrellaOn a grid with walls, find the shortest walk from S that picks up every X item (at most 5) and ends at E. | Medium6 | BFSBit manipulation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Getting-Up SyndromeChoose an initial integer x in [0, m] so that applying n bitwise OR/XOR/AND gates with given parameters maximizes the final value. | Medium6 | Bit manipulationGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Feeding the CatsStarting at (0,0), visit all N cats on a grid, moving in Manhattan steps, and return to (0,0) in the shortest time. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Getting ConfidenceGiven an N by N matrix of confidence values, assign each of N ornaments to a distinct position so that the product of the chosen values is maximized, and output the assignment. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 0.5s | 512 MB | Judgeable |
| Two-Pan BalanceGiven up to 13 distinct weights, count how many integers from 1 to their sum cannot be formed when each weight goes on the bowl side, the other pan, or unused. | Medium6 | Brute forceBacktracking+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Bus PlanningSplit n kids (n up to 17) into the fewest groups so no two enemies share a group and each group has at most c kids, then output one valid grouping. | Medium6 | Bit manipulationDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Domino PredictionGiven XORs of consecutive domino numbers, answer queries for the XOR of positions x and y, or for the value at y when x holds d. | Medium6 | Prefix sumBit manipulation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Binary Number GameGiven two binary strings, find the minimum number of single-bit flips (never the leading bit), increments, and decrements to turn the start number into the target. | Medium6 | BFSDynamic programming+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Automatic Control MachineGiven up to 15 binary strings of length n, pick the fewest strings whose bitwise OR covers every position, or report -1. | Medium6 | Bit manipulationBrute force+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| Game of Nim EverywhereCount N in [L, R] where the Nim position (N, 2N, 3N) is a first-player win, i.e. where N xor 2N xor 3N is nonzero. | Medium6 | Game theoryBit manipulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Delivering Problem SheetsGiven N points and Q query points in 11 dimensions, report for each query the maximum Manhattan distance to any of the N points. | Medium6 | MathBit manipulation+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| MafiaGiven guilt scores and a reaction matrix, the mafia Eunjin picks one night victim at a time and must survive as long as possible, returning the maximum number of nights. | Medium7 | Bit manipulationDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Twin VillagesSelect as many village pairs as possible with Manhattan distance at least D and degree at most P per village, then minimize the total distance among maximum selections. | Medium7 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Paper CuttingDecide whether five fixed-shape pieces can be translated without rotation to exactly tile an L x L grid, then print the lexicographically smallest piece-number layout or gg if impossible. | Medium7 | BacktrackingBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Number of Strings Matching Exactly K PatternsCount lowercase strings that match exactly K out of N given letter/question-mark patterns of equal length, modulo 1,000,003. | Medium7 | CombinatoricsBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| MarriageGiven up to 12 men and 12 women with mutual liking pairs, partition everyone into star-shaped marriages (one person of one gender with several of the other) to cover all people with the fewest marriages, or report impossibility. | Medium7 | Dynamic programmingBit manipulation+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Fixing an ArrayFor each array value, find the number within a given range that has the smallest Hamming distance in binary, breaking ties by choosing the smallest value. | Medium7 | Bit manipulationDynamic programming+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Box FillingGiven a length x width x height box and limited counts of power-of-two sized cubes, find the minimum number of cubes to fill it exactly, or -1 if impossible. | Medium7 | MathBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Finding Domino TilingsCount the ways to tile a fixed 8x7 numeric grid with all 28 distinct dominoes so that each domino's pair matches the covered cell values. | Medium7 | BacktrackingBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Stair NumbersCount N-digit numbers whose adjacent digits differ by exactly 1 and that contain every digit 0-9 at least once, modulo 1,000,000,000. | Medium7 | Dynamic programmingBit manipulation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Lighting FixtureGiven an N×M grid of colored lamps, find a sequence of row-flip and column-swap button presses that turns the initial grid into a target grid, or report impossibility. | Medium7 | Bit manipulationCombinatorics+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Security PanelFind the minimum set of button presses on an R by C panel so a fixed 3x3 toggle pattern turns every button on, breaking ties by a lexicographic rule. | Medium7 | MatrixBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Bungeoppang TycoonGiven an MxN grid where pressing a cell flips it and its four neighbors, find the minimum, lexicographically smallest set of presses to make every cell 0. | Medium7 | Brute forceBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |