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 results3,705 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Digit DivisionCount the ways to split a digit string into contiguous blocks so each block is divisible by m, modulo 1e9+7. | Medium7 | Dynamic programmingMath+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Amazing RaceChoose an order to visit task locations with service times, deadlines and travel times that fits in T minutes and earns the most points. | Medium7 | Dynamic programmingBit manipulation+1 | No attempts yet | 5s | 256 MB | Judgeable |
| Productivity improvementPartition all workers into exactly p nonempty lines to maximize the sum of each line's common overlapping work time. | Medium7 | Dynamic programmingSorting+1 | No attempts yet | 2s | 256 MB | Judgeable |
| DebuggingFind the single crashing line among n lines while balancing the cost of added print statements against the cost of each run. | Medium7 | Dynamic programmingBinary search | No attempts yet | 3s | 256 MB | Judgeable |
| Game of CardsDecide the winner of a turn-based card game where each move trims one of many piles by up to K cards plus the value shown on the new top card. | Medium7 | Game theoryDynamic programming | No attempts yet | 1s | 256 MB | Judgeable |
| AYBABTUYou cut k tree edges so each of the resulting k+1 regions holds a base and the total cut cost is smallest. | Medium7 | Dynamic programmingTree | No attempts yet | 10s | 512 MB | Judgeable |
| PLAY in BASICGiven a Music Macro Language score, find the character length of the shortest score with identical pitches, note lengths, volumes, and rests. | Medium7 | Dynamic programmingSimulation+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Three-way BranchCount three-way downward paths from (1,1) to (W,H) on a grid with up to 30 blocked cells, modulo 1000000009. | Medium7 | Dynamic programmingMatrix | No attempts yet | 7s | 64 MB | Judgeable |
| The Brothers GameEach turn the opponent picks a step count from three values and you walk exactly that many directed edges, racing to end a turn on node N in the fewest turns. | Medium7 | Game theoryGraph+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Bringing Order to DisorderCount the n-digit strings that come before the given string ordered by digit sum, then shifted-digit product, then numeric value. | Medium7 | Dynamic programmingCombinatorics+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Alpaca SentenceFind the K-th string in lexicographic order among the shortest palindromes that contain S as a subsequence, or report NONE. | Medium7 | Dynamic programmingString+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Jumping JoeyA frog visits pads in order, pulls ropes to drag upcoming pads closer, jumps gaps up to D, swims the rest, and needs the fewest swims. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Performance Assessment 2Find the shortest sequence over 1 to M that is not a subsequence of A and count such sequences modulo 1e9+7. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Mario and the Evil ToadPick K distinct non-root nodes of a weighted tree and order them to maximize the round trip from the root through them in order. | Medium7 | Dynamic programmingTree+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Martian KingAnswer rank, k-th, predecessor, and successor queries over the sorted binary color records of length-L routes from the capital to a regional center. | Medium7 | Dynamic programmingBinary search+1 | No attempts yet | 2s | 256 MB | Judgeable |
| CacheChoose which cached objects to evict for a known request sequence of sized objects with load costs to minimize total reload cost. | Medium7 | Dynamic programmingBit manipulation | No attempts yet | 1s | 256 MB | Judgeable |
| Energetic turtleCount right-and-down grid paths from (0,0) to (N,M) that step on at most T of the K trap cells, modulo Z. | Medium7 | CombinatoricsDynamic programming+1 | No attempts yet | 2s | 256 MB | Judgeable |
| K-th pathFind the K-th string in alphabetical order among all strings spelled by down-right paths from the top-left to the bottom-right of a letter grid. | Medium7 | GreedyDynamic programming | No attempts yet | 2s | 256 MB | Judgeable |
| Beautiful rowCount distinct arrangements of the given numbers where every neighboring pair shares the same binary or ternary one-count. | Medium7 | Dynamic programmingGraph+1 | No attempts yet | 3s | 256 MB | Judgeable |
| BiochipsPick exactly M nodes from a rooted tree with given values so no picked node is an ancestor of another and the sum is maximal. | Medium7 | Dynamic programmingTree | No attempts yet | 2s | 512 MB | Judgeable |
| K blocksSplit the array into exactly K contiguous blocks so the sum of each block's maximum is as small as possible. | Medium7 | Dynamic programmingStack+1 | No attempts yet | 1s | 256 MB | Judgeable |
| PinballThe program installs the cheapest set of row devices so every falling ball lands in one bottom cell. | Medium7 | Dynamic programmingSegment tree | No attempts yet | 1s | 512 MB | Judgeable |
| Angry CowsFind the smallest launch power whose chain of shrinking blast radii clears all hay bales on a line. | Medium7 | Binary searchDynamic programming+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Circular BarnChoose up to k outer doors on a ring of n rooms so the total clockwise walking distance to every cow room is minimized. | Medium7 | Dynamic programmingPrefix sum | No attempts yet | 2s | 512 MB | Judgeable |
| Circular Barn RevisitedFarmer John opens k doors on a ring of n rooms so cows walking clockwise to their assigned rooms travel the smallest total distance. | Medium7 | Dynamic programmingPrefix sum+1 | No attempts yet | 2s | 512 MB | Judgeable |
| LandscapingMove, buy, or remove dirt so each of N flowerbeds reaches its target amount at minimum total cost. | Medium7 | Dynamic programmingGraph | No attempts yet | 2s | 512 MB | Judgeable |
| Albocede DNA (Small)Count subsequences of S that split into blocks of the form a^i b^j c^i d^j with i and j at least 1, modulo 1e9+7. | Medium7 | Dynamic programmingString+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Divisor Erasing Game 2Given the board numbers, print for each possible first pick every reply that lets the second player force a win. | Medium7 | Game theoryDynamic programming+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Costly Binary Search (Small)Find the comparison order that minimizes the worst-case total cost of locating the insertion position when each array slot has its own comparison cost. | Medium7 | Dynamic programmingTree+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Runaway QuailCatch quails that flee in both directions on a line at given speeds by choosing the left-right chase order with the smallest total time. | Medium7 | Dynamic programmingMath | No attempts yet | 5s | 512 MB | Judgeable |
| Card GameBob repeatedly deletes three neighboring cards whose values form an arithmetic progression with difference K, and seeks the fewest cards that can remain. | Medium7 | Dynamic programmingIntervals | No attempts yet | 5s | 512 MB | Judgeable |
| Card Game (Large)Repeatedly delete neighboring triples in arithmetic progression with difference K to leave as few cards as possible. | Medium7 | Dynamic programmingIntervals | No attempts yet | 5s | 512 MB | Judgeable |
| Allergy Testing (Small)Kelly plans pooled food tests with different waits after negative and positive results to find her single allergy trigger in the fewest worst-case days. | Medium7 | Dynamic programming | No attempts yet | 5s | 512 MB | Judgeable |
| Allergy Testing (Large)Find the shortest worst-case schedule of pooled food tests with asymmetric wait times that identifies the single allergen. | Medium7 | Dynamic programmingBinary search+1 | No attempts yet | 90s | 512 MB | Judgeable |
| ARAM (Small)Decide when to spend a capped, regenerating reroll budget on fresh random champions to maximize the long-run share of games won. | Medium7 | Dynamic programmingProbability+1 | No attempts yet | 5s | 512 MB | Judgeable |
| New Lottery Game (Large)Count pairs x below A and y below B whose bitwise AND is below K for up to 100 test cases. | Medium7 | Dynamic programmingBit manipulation | No attempts yet | 5s | 512 MB | Judgeable |
| Full Binary Tree (Large)Delete as few vertices as possible from a given tree so the survivors form a full binary tree with a freely chosen root. | Medium7 | Dynamic programmingTree+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Let Me Tell You a Story (Small)Count the firing orders that delete ministers until the remaining pay sequence never rises down the ranks, modulo 10007. | Medium7 | Dynamic programmingCombinatorics | No attempts yet | 5s | 512 MB | Judgeable |
| Observation WheelRandom arrivals fill the free gondolas of a circular wheel, and you compute the expected total of the distance-based fares. | Medium7 | Dynamic programmingProbability+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Erdős and Szekeres Sequence ReconstructionRebuild the lexicographically smallest permutation of 1 to N whose increasing and decreasing subsequence lengths match the given arrays. | Medium7 | BacktrackingGreedy+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Garbled EmailSplit the garbled string into dictionary words with changed letters spaced at least 5 apart while changing as few letters as possible. | Medium7 | Dynamic programmingTrie+1 | No attempts yet | 60s | 512 MB | Judgeable |
| Swinging WildDecide if vine-to-vine swings with grip limits can carry you from the first vine to the far ledge. | Medium7 | GraphBFS+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Box Factory (Large)Match boxes and toys of equal type in order on run-length encoded lines to maximize the number of pairs. | Medium7 | Dynamic programmingString matching | No attempts yet | 5s | 512 MB | Judgeable |
| Breaking Windows (Small)M workers randomly reinforce K windows and N villains randomly throw one stone each, and the task asks for the probability that at least one window breaks. | Medium7 | ProbabilityCombinatorics+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Breaking Windows (Large)Compute the chance that random stone throws break at least one of K windows after random reinforcements raise their durability. | Medium7 | ProbabilityCombinatorics+1 | No attempts yet | 30s | 512 MB | Judgeable |
| Survivor (Large)Eat foods in expiry order so each meal starts before it spoils and the next meal follows after its satiation time to maximize total survival time. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 10s | 512 MB | Judgeable |
| Children Wearing Hats (Small)Given hat totals, child count, and which child first knew its hat color, count the matching colorings modulo 32749. | Medium7 | Game theoryDynamic programming+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Restoring the Erased Equation (Large)Fill every ? with a digit so the addition or subtraction holds without leading zeros and the whole equation is lexicographically smallest. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Permutations with Equal RunsCount distinct rearrangements of each string that keep the original number of maximal blocks of equal letters, modulo 1000003. | Medium7 | Dynamic programmingCombinatorics | No attempts yet | 5s | 512 MB | Judgeable |
| Letter Stamper (Small)Print a given string of A, B and C with push, pop and print on a letter stack using the fewest operations. | Medium7 | Dynamic programmingStack | No attempts yet | 5s | 512 MB | Judgeable |
| Letter Stamper (Large)Find the fewest stack pushes, pops, and prints needed to print each target string of A, B, and C grades in order. | Medium7 | Dynamic programmingStack | No attempts yet | 15s | 512 MB | Judgeable |
| City Tour (Small)Find the most vertices a single closed tour can visit when each street and point is used at most once in a city grown one triangle at a time. | Medium7 | Dynamic programmingGraph | No attempts yet | 5s | 512 MB | Judgeable |
| Candy Store (Small)Pick the fewest integer-weight boxes so up to k visitors, each asking 1 to C grams in unknown order, each receive an exact subset of the remaining boxes. | Medium7 | Dynamic programmingGreedy | No attempts yet | 5s | 512 MB | Judgeable |
| Travel PlanStarting from Earth, visit each of the N planets on a line exactly once, return to Earth, and burn the largest total distance within fuel F. | Medium7 | Dynamic programmingBrute force | No attempts yet | 5s | 512 MB | Judgeable |
| FencePick the fewest boards from the given lengths of at most 100 so they sum to exactly L up to 1e18, or report IMPOSSIBLE. | Medium7 | Dynamic programmingNumber theory+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Hot Dog Proliferation (Small)Vendors sharing a corner split one step east and one step west per move, and the task asks for the fewest moves that leave every vendor on a distinct corner. | Medium7 | Dynamic programmingSorting | No attempts yet | 5s | 512 MB | Judgeable |
| World Cup 2010 (Large)Pick the cheapest tickets in a knockout bracket so each team misses at most M[i] of the matches it plays, no matter who wins. | Medium7 | Dynamic programmingTree | No attempts yet | 5s | 512 MB | Judgeable |
| Bacteria (Large)Given initially filled rectangles on a grid evolving by a north-west neighbor rule, compute the seconds until no bacterium remains. | Medium7 | Dynamic programmingSimulation+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Load Testing (Small)For each case, compute the fewest adaptive load tests that guarantee bracketing the capacity within a factor of C in the worst case. | Medium7 | Dynamic programmingBinary search | No attempts yet | 5s | 512 MB | Judgeable |
| Making Chess Boards (Large)Repeatedly cut the largest alternating-color square, breaking ties by topmost then leftmost position, and report how many boards of each size result. | Medium7 | Dynamic programmingSimulation+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Your Rank is Pure (Small)Count subsets of 2 to n containing n whose repeated rank mapping stays inside the set until it reaches 1, modulo 100003. | Medium7 | Dynamic programmingCombinatorics | No attempts yet | 5s | 512 MB | Judgeable |
| Your Rank is Pure (Large)Count the subsets of 2 to n that contain n and whose repeated rank mapping from n reaches 1. | Medium7 | Dynamic programmingCombinatorics | No attempts yet | 5s | 512 MB | Judgeable |
| Make it Smooth (Large)Edit pixel values, delete pixels, or insert new ones at given costs so neighboring values differ by at most M for the lowest total price. | Medium7 | Dynamic programmingMath | No attempts yet | 5s | 512 MB | Judgeable |
| Doubly Sorted GridCount ways to fill a partially filled grid so rows and columns are non-decreasing, modulo 10007, with R and C at most 10. | Medium7 | Dynamic programmingCombinatorics+1 | No attempts yet | 40s | 512 MB | Judgeable |
| Alphabetomials (Large)Given a polynomial over 26 letter counts and a dictionary, sum its value over all phrases of 1 to K dictionary words, modulo 10009. | Medium7 | Dynamic programmingCombinatorics+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Bribe the Prisoners (Small)Choose the release order of Q prisoners out of P cells to minimize total bribes, where each release bribes every still-occupied prisoner reachable from it until a boundary or empty cell. | Medium7 | Dynamic programmingDivide and conquer+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Bribe the Prisoners (Large)Given prison cells in a row and a set of cells to release one per day, choose the release order that minimizes total bribes paid to prisoners who hear the news. | Medium7 | Dynamic programmingDivide and conquer+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Collecting CardsEach pack is a uniformly random N-subset of C card kinds; find the expected number of packs until all C kinds are collected. | Medium7 | Dynamic programmingProbability+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Collecting Every CardFind the expected number of booster packs to buy, each pack giving N distinct kinds, until all C kinds are collected. | Medium7 | ProbabilityDynamic programming+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Mine Layer (Large)Given a Minesweeper-style grid of neighbor counts, find the maximum number of mines the middle row can hold in any layout that matches all counts. | Medium7 | Dynamic programmingImplementation+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Rainbow TreesCount rainbow edge colorings of a tree where any two adjacent edges differ and any three consecutive edges all differ, modulo 1e9+9. | Medium7 | TreeGreedy+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Mixing Bowls (Large)Given a recipe where each mixture's ingredients are other mixtures, find the minimum number of bowls needed to prepare it. | Medium7 | TreeDFS+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Test Passing Probability (Small)With M submissions and Q questions of 4 choices each, find the maximum probability of answering every question correctly, learning only whether each submission passed. | Medium7 | Dynamic programmingProbability+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Endless Knight (Large)Count right-and-down knight paths from (1,1) to (H,W) on a board up to 1e8 wide, avoiding at most 10 rocks, modulo 10007. | Medium7 | Dynamic programmingCombinatorics+2 | No attempts yet | 5s | 512 MB | Judgeable |
| CitiesGiven a weighted undirected graph, pick a minimum-cost set of edges so that all k special cities (k at most 10) end up in one connected component. | Medium7 | Minimum spanning treeDynamic programming+2 | No attempts yet | 4s | 256 MB | Judgeable |
| Heavenly Dragon FlashCount sequences of nondecreasing cut heights where each cut divides the object's height, modulo 1000000007. | Medium7 | Dynamic programmingNumber theory | No attempts yet | 2s | 128 MB | Judgeable |
| My matrix multiplication travelogueGiven K, output dimension array a0..aN whose worst and best matrix-chain multiplication counts differ by exactly K, with the smallest lexicographic answer. | Medium7 | Dynamic programmingMatrix+2 | No attempts yet | 1s | 128 MB | Judgeable |
| AlchemyA product is a multiset of n ingredients chosen from m qualities; find the sum of the products of qualities over all such multisets, mod 1e9+7. | Medium7 | CombinatoricsMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| TorrentTwo computers start with a file in a tree; each minute, adjacent computers can copy in parallel subject to one copy per computer. Find the minimum minutes until all nodes have the file. | Medium7 | TreeBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Hide and Seek 2Find the minimum time for Subin to reach position K using steps of minus or plus 1 and doubling, plus the number of distinct shortest action sequences. | Medium7 | BFSGraph+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Bribing the PrisonersRelease Q prisoners from a row of P cells in the order that minimizes bribes paid to neighbors reached by the news. Find that minimum total cost. | Medium7 | Dynamic programmingIntervals+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Mutalisk 2Given up to 20 SCVs with health, each attack deals 9, 3, and 1 damage to three distinct SCVs; find the minimum number of attacks to destroy all of them. | Medium7 | Dynamic programmingBit manipulation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Distinct valid bracket subsequencesCount distinct non-empty balanced bracket strings that appear as subsequences of a given bracket string of length at most 100, modulo 1,000,000,007. | Medium7 | Dynamic programmingString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Coloring the BallsCount the sequences formed by drawing all balls from a box where the last ball of color 1 appears before the last of color 2, and so on. | Medium7 | Dynamic programmingCombinatorics+1 | No attempts yet | 2s | 512 MB | Judgeable |
| ZooCount assignments of N animals to two kinds so that the reported same-kind taller counts can be realized by some ordering of distinct heights. | Medium7 | CombinatoricsDynamic programming | No attempts yet | 2s | 512 MB | Judgeable |
| Two WeightsGiven an undirected graph with two weights per edge, find the path from 0 to 1 minimizing the product of the two total weight sums. | Medium7 | Shortest pathGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| KaraokeAssign each note of a sequence to one of two singers so that the total of the absolute pitch jumps within each singer's subsequence is minimized. | Medium7 | Dynamic programmingArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Palindrome WalkGiven an undirected labeled graph, find the length of the shortest walk from vertex 0 to vertex 1 whose edge-label string is a palindrome, or -1 if none exists. | Medium7 | BFSGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Tournament winner placementsCount, over all N! seatings of N players in a fixed bracket, how many make each player the champion given a full win/loss table. | Medium7 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Number lock 2Given two equal-length digit strings S and T, find the fewest moves to turn S into T where a move shifts any contiguous block of dials one step up or down modulo 10. | Medium7 | Dynamic programmingGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Cutting TreesCut at most M trees per evening with distinct machines to exactly D_i meters, and find the minimum total height after T days. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Scrooge Minho 2Given a tree with N cities, place the fewest police stations so that every city and every road is covered, where a station covers its city, its neighbors, and all incident roads. | Medium7 | TreeDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Splitting a StringChoose K non-overlapping substrings of A that also appear in B in the same non-overlapping order, maximizing their total length. | Medium7 | Dynamic programmingString+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Chains of MultiplesCount non-decreasing length-L sequences of values from 1 to N where in every pair one value divides the other, modulo 1e9+7. | Medium7 | CombinatoricsDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Secret MissionGiven n candidates with talkativeness values, use at most s adjacent swaps to make the sum of the first k values as small as possible. | Medium7 | Dynamic programmingGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Painting the BallsGiven M range-painting operations used in order with unknown colors, count how many distinct final black/white ball colorings are possible. | Medium7 | Dynamic programmingBit manipulation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Hongjun and AntimatterCount contiguous subarrays of length at least 2 that can be split into two disjoint nonempty parts with equal sums, modulo 1e9+7. | Medium7 | Dynamic programmingPrefix sum+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Hongjun and the Tree 2Count the ways to cut edges of a tree so every remaining component has exactly one black vertex, modulo 1e9+7. | Medium7 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Teams CreationCount the ways to partition n students into exactly k unnumbered teams so that any two teams are separated by a threshold on skill level. | Medium7 | CombinatoricsSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Maximal SumFor each query value b_j, find the maximum sum of a contiguous segment of a whose elements are all at least b_j, or 0 if none exists. | Medium7 | SortingDivide and conquer+2 | No attempts yet | 2s | 512 MB | Judgeable |