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,689 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Nowhere MoneyRepresent each amount as a sum of T(s) values (T(n) = Fibonacci-like count) with the fewest slots whose sizes differ by at least 2, and print the sizes and values. | Medium6 | GreedyDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Stacking BallsPick balls from a triangular pile, where each ball needs both balls above it picked first, to maximize the total score; stopping early is allowed. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Another CrisisGiven a company tree and a threshold T percent, find the minimum number of leaf workers who must petition so that a petition reaches the root. | Medium6 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Drop the TriplesPlayers alternate drawing cards from a stock and may drop valid triples; each maximizes perfect triples then common triples. Report the winner or a tie. | Medium6 | GreedyDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ICPC Strikes AgainGiven a DAG of task dependencies, basic significances, and which employees perform which tasks, compute each employee's salary as the sum of significances of tasks they perform that no other task they perform depends on. | Medium6 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Long Night of MuseumsWith at most 20 museums, viewing times, and travel times, find the largest number of distinct museums a 420-minute tour can include. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Duty Free ShopAssign each box entirely to one of two brands so both totals stay within limits, printing the greedy canonical assignment or Impossible to distribute. | Medium6 | GreedyDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Class PackingGiven enrollments for seven grades, find the fewest classes where each class holds one grade or two consecutive grades within the group size limits (20, 25, or 30). | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Wi-Fi SetupCover all cow positions on a line with base stations, where a station covering an interval of length 2r costs A + B*r; minimize total cost. | Medium6 | Dynamic programmingSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Balanced Cow BreedsCount the ways to 2-color the parentheses in a string so that each color class, read in order, forms a balanced parenthesis sequence. | Medium6 | Dynamic programmingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cows in a SkyscraperGiven up to 18 cow weights and an elevator capacity, find the minimum number of trips that carry every cow without exceeding the capacity. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| LandscapingEach flowerbed has a current and target dirt amount, and dirt can be bought, removed, or moved between beds at a per-unit distance cost; find the cheapest way to hit every target. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Nearby CowsOn a tree of N fields with C(i) cows at each field, report for every field the total cows within distance K, where K is at most 20. | Medium6 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Villain RobotsChoose a string of K characters over {A,B,C} maximizing the total number of substring occurrences of the given pattern strings. | Medium6 | Dynamic programmingString matching+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Umbrellas for CowsGiven cow positions on a line and a price for each umbrella width, find the cheapest set of umbrellas that covers every cow, allowing overlaps. | Medium6 | Dynamic programmingSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Visiting CowsGiven a tree with N vertices, choose the largest set of vertices with no two adjacent, which is the maximum independent set on a tree. | Medium6 | TreeDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Treasure ChestTwo players alternately take a coin from either end of a row of N coins; find the maximum total the first player can guarantee with optimal play. | Medium6 | Dynamic programmingGame theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Dividing the GoldGiven N coins with values, find the minimum difference between two piles and count the subsets forming the lighter pile, modulo 1,000,000. | Medium6 | Dynamic programmingCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Mowing the LawnGiven N cows in a row with efficiencies, pick a subset that never includes more than K adjacent cows and maximize the total efficiency. | Medium6 | Dynamic programmingSliding window+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Video Game TroublesGroup knapsack: buy at most one of each console, and only games whose console is already bought, maximizing total production value within budget V. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Great Cow GatheringPick a node of a weighted tree with node weights as the gathering point, and minimize the sum of cow count times distance to that node. | Medium6 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Driving Out the PiggiesA bomb starts at city 1 of an undirected graph, detonates at each visit with probability P/Q and otherwise moves to a random neighbor; find the detonation probability for every city. | Medium6 | ProbabilityGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Mixed Up CowsCount permutations of N serial numbers (N at most 16) where every adjacent pair differs by more than K. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Buying HayGiven N package types with unlimited supply, each weighing P_i and costing C_i, find the minimum total cost to buy at least H pounds of hay. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ChocolateFor C equally likely colors, after N draws where matching pairs are eaten, find the probability that exactly M colors remain on the table. | Medium6 | Dynamic programmingCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Bulls and CowsCount binary sequences of length N where every pair of bulls has at least K cows between them, modulo 5000011. | Medium6 | Dynamic programmingCombinatorics+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Cow Frisbee TeamCount the nonempty subsets of N cows whose rating sum is divisible by F, modulo 100000000. | Medium6 | Dynamic programmingMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| CakePartition the sequence of slice lengths into consecutive blocks, bottom to top, so each block's sum is at least the one above, and maximize the number of blocks. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Milking TimeChoose non-overlapping milking intervals, each separated by at least R rest hours, to maximize the total milk produced over N hours. | Medium6 | Dynamic programmingBinary search+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cell Phone NetworkGiven a tree of N pastures, choose the fewest vertices so that every vertex is chosen or adjacent to a chosen one. | Medium6 | TreeDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| River CrossingSplit N cows into consecutive groups, each crossing costs M plus the cumulative marginal cost, and add M for every return trip; minimize the total time. | Medium6 | Dynamic programmingPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Round NumbersCount integers in [Start, Finish] whose binary form has at least as many zeroes as ones. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cow Roller CoasterChoose components that tile [0, L] with no gaps or overlaps, maximizing total fun while keeping total cost within budget B. | Medium6 | Dynamic programmingSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cow TrafficIn a DAG where every edge goes from a lower to a higher numbered node, count how many source-to-barn paths cross each edge and output the maximum. | Medium6 | GraphDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cheapest PalindromeGiven a string and per-letter insertion and deletion costs, find the minimum cost to turn it into a palindrome by adding or removing characters anywhere. | Medium6 | Dynamic programmingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Party at Hali-BulaGiven a company hierarchy tree, find the largest set of employees with no boss and employee both chosen, and report whether that maximum set is unique. | Medium6 | TreeDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Xavier Is Learning to CountGiven m distinct positive integers and a size p (at most 5), count for every attainable sum the number of p-element subsets that add up to it, listing sums in increasing order. | Medium6 | Dynamic programmingCombinatorics+2 | No attempts yet | 5s | 512 MB | Judgeable |
| TrianglesIn each triangular grid of white and black cells, find the area of the largest all-white triangle, which may point up or down. | Medium6 | Dynamic programmingArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Always on the runFind the cheapest sequence of exactly k daily flights from city 1 to city n, where each ordered pair has a periodic price schedule over days. | Medium6 | Dynamic programmingGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| RobberyGiven time-stamped rectangular exclusions, find the robber's position at each time step where it is uniquely determined, moving at most one cell per step. | Medium6 | Dynamic programmingSimulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| DividingGiven counts of marbles worth 1 to 6, decide whether the collection can be split into two sets of equal total value. | Medium6 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Economic Phone CallsGiven a chronologically ordered call log with some entries marked important, keep the fewest entries so all important ones stay and the listed year-recovery rule still gives each kept call its original year. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Even a Kindergartner Could Solve ThisDecide whether each string over the alphabet {, }, and comma is a valid set by the given grammar, where brace characters can be either delimiters or atoms. | Medium6 | StringDynamic programming+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Fixed Partition Contest ManagementAssign up to 10 problems to at most 3 members and order each member's load to minimize the sum of completion times, where a problem's duration depends on the solver's brightness. | Medium6 | Brute forceDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Mondrian's DreamCount the number of ways to tile an h by w rectangle (up to 11 by 11) with 2 by 1 dominoes, for several test cases. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| ArbitrageGiven currencies and exchange rates, decide whether some cycle of conversions turns one unit of a currency into more than one unit. | Medium6 | Shortest pathGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Tower of BabylonGiven block types with unlimited copies, each reorientable, find the maximum height of a stack where each block's base is strictly smaller than the one below. | Medium6 | Dynamic programmingSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Ambiguous ResultGiven a parenthesis-free expression of numbers joined by + and *, restore parentheses to find the smallest and largest values it can evaluate to. | Medium6 | Dynamic programmingIntervals+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Collecting BeepersGiven Karel's start and up to 8 beepers on a grid, find the shortest Manhattan-distance round trip visiting every beeper. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Christmas PresentsChoose a subset of children whose total price is at most p, maximizing excitement of chosen minus frustration of unchosen, and output the lexicographically smallest optimal 0/1 string. | Medium6 | Dynamic programmingGreedy | No attempts yet | 1s | 128 MB | Judgeable |
| A Language for ConstantsFor each nonzero integer C, output the shortest sequence of C+1/C-1 to start, then INCR and DBL, that builds C, breaking ties by total runtime with DBL cost T and INCR cost 2T. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Hungary GamesGiven a directed weighted graph, find the second smallest distinct total length among all walks from node 1 to node N, or -1 if fewer than two exist. | Medium6 | Shortest pathGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Vampire TunnelsFind the shortest path from node 0 to N-1 where the total length of above-ground edges is at most S. | Medium6 | Shortest pathDynamic programming+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Tree PruningGiven a rooted binary tree with colored nodes, prune subtrees to make the whites minus blacks equal exactly D, minimizing the number of prunes. | Medium6 | TreeDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Computer Purchase ReturnChoose exactly one component of each of T types so the total cost stays within budget B and the total value is maximized. | Medium6 | Dynamic programmingArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| CandySplit multiset candies with counts and calorie values into two groups so the two calorie totals differ as little as possible. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Bowling for NumbersGiven a row of valued pins, pick up to k non-overlapping blocks of exactly w consecutive pins to maximize the total score. | Medium6 | Dynamic programmingPrefix sum | No attempts yet | 1s | 128 MB | Judgeable |
| Stepping on TilesGiven N distinct increasing numbers, find the maximum sum of a 3-or-more element arithmetic subsequence with any common difference, or 0 if none exists. | Medium6 | Dynamic programmingHash map+2 | No attempts yet | 1s | 256 MB | Judgeable |
| To bet, or not to betGiven a board of movement and skip instructions, compute the probability the chip reaches End within T turns and decide the bet. | Medium6 | Dynamic programmingProbability+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Little Shop of FlowersPlace F ordered bunches into a row of V vases to maximize total aesthetic value, then output the lexicographically smallest optimal assignment. | Medium6 | Dynamic programming | No attempts yet | 1s | 128 MB | Judgeable |
| FlattenDistribute chips between neighboring piles at a cost equal to the chips moved, and find the minimum total transferred to make all piles equal. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Recycling ProteinsGiven a source and target chain of amino acids, compute the minimum cost to convert one into the other using delete, insert, and replace with per-type costs. | Medium6 | Dynamic programmingString | No attempts yet | 1s | 128 MB | Judgeable |
| Grazing on the RunBessie starts at position L and walks a line to eat N grass clumps; minimize the sum of times at which each clump is eaten. | Medium6 | Dynamic programmingIntervals+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Dividing the PathPartition the segment [0, L] into consecutive pieces of even length between 2A and 2B so no cut lands strictly inside any cow's interval, and minimize the number of pieces, or report that no partition exists. | Medium6 | Dynamic programmingPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| A Decorative FenceGiven N and a rank C, output the C-th alternating (zigzag) permutation of 1..N in lexicographic order. | Medium6 | Dynamic programmingCombinatorics+1 | No attempts yet | 1s | 128 MB | Judgeable |
| TicketsSplit L pages of non-increasing popularity into D contiguous channel blocks to minimize the popularity-weighted sum of within-block delay positions, breaking ties by the lexicographically smallest block boundaries. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cutting Out of FactorialsGiven k from 2 to 500, remove the fewest of 1!, 2!, ..., k! so the remaining product is a perfect square, and report that count. | Medium6 | MathNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Algarvu-ScrabbleGiven up to 8 digit tiles, place them one by one at either end of a row to maximize prime-direction scoring minus penalties for unused tiles. | Medium6 | BacktrackingBrute force+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| BacteriaEach adult produces one young per second while young mature into adults; find the total population after T seconds modulo K, given initial counts. | Medium6 | MathCombinatorics+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Operator SignsInsert + or - between adjacent numbers so the left-to-right value equals the target, keeping every partial result within 10000, and print the lexicographically smallest expression. | Medium6 | Dynamic programmingBacktracking+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| DragonPick two disjoint blocks of at most K consecutive heads each in a row of N heads to maximize the total fire power removed. | Medium6 | Dynamic programmingPrefix sum+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| CourierDeliver parcels to cities on a line before their deadlines, minimizing the time to return to the warehouse, or report impossibility. | Medium6 | Dynamic programmingSorting | No attempts yet | 1s | 1024 MB | Judgeable |
| Unit TransformationFind the minimum cost to build a target number from 1 using only operations on the last digit. | Medium6 | Dynamic programmingBFS+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| The Cat of BitlandTwo rows of K (friendly) and A (allergic) students; the cat moves right in a row or jumps to any later room in the other row, and we want the most rooms it can visit. | Medium6 | Dynamic programmingArray+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| ConcertGive K spectators a +1 height boost so that the maximum number of people stand strictly taller than everyone in front of them. | Medium6 | Dynamic programmingGreedy | No attempts yet | 1s | 1024 MB | Judgeable |
| Word GroupingSplit N words into the fewest groups so that each group shares at least one common letter, with at most 15 distinct letters. | Medium6 | Bit manipulationDynamic programming+1 | No attempts yet | 1s | 1024 MB | Judgeable |
| Swimming CompetitionSplit a sorted list of N swimmer times into consecutive heats of size A to B, minimizing the largest within-heat gap between fastest and slowest. | Medium6 | Binary searchGreedy+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| PassengersGiven each request's row and earliest time, find the least total time for the attendant to serve all and return to row 1. | Medium6 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 1024 MB | Judgeable |
| Airplane PassengersGiven requests at row a made no earlier than minute b, find the minimum minutes for an attendant starting at row 1 to reach every request row on time. | Medium6 | Dynamic programmingSorting+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Optimal KeypadSplit a 30-character alphabet tape into 12 labeled pieces to minimize total keystrokes for a word dictionary, printing the lexicographically smallest optimal cut string. | Medium6 | Dynamic programmingPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Calendar GameOn a fixed 1900-2001 calendar, two players alternately advance a date by one day or to the same day next month; decide if the first player wins. | Medium6 | Game theoryDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Gene FunctionAlign two DNA sequences by inserting blanks to maximize the sum of position-wise match values from a given table. | Medium6 | Dynamic programmingString | No attempts yet | 1s | 128 MB | Judgeable |
| Joke with TurtlesEach turtle claims a count of turtles ahead and behind it; choose positions to maximize how many claims hold at once. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 2s | 128 MB | Judgeable |
| String FoldingFind the length of the shortest folded sequence, using repeat counts like 3(AB), that unfolds to the given uppercase string. | Medium6 | Dynamic programmingString | No attempts yet | 2s | 128 MB | Judgeable |
| The Dog TaskBob walks a polygonal path through N points; Ralph may leave each segment to visit at most one interesting place and never reuse a place. Maximize places visited. | Medium6 | GeometryGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| EmbassyOrder N people in a queue to minimize the total fee paid for those who finish after their train departure time. | Medium6 | GreedySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SoccerGiven 16 teams, a fixed bracket, and pairwise win probabilities, compute each team's probability of winning the single-elimination tournament. | Medium6 | Dynamic programmingProbability+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Pimp My RideGiven n jobs with base prices and pairwise surcharges paid when a later job follows an earlier one, find the cheapest order to finish all jobs. | Medium6 | Dynamic programmingBit manipulation | No attempts yet | 1s | 128 MB | Judgeable |
| Jamie's Contact GroupsAssign each of N friends to one of M allowed groups so that every friend lands in exactly one group and the largest group size is as small as possible. | Medium6 | Binary searchGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Lining Up in OrderGiven a permutation of 1..N, find the fewest children to move to either end so the line becomes increasing; the answer is N minus the longest run of consecutive values that already appears in increasing order. | Medium6 | ArrayDynamic programming+1 | No attempts yet | 1s | 256 MB | Judgeable |
| AppChoose a subset of active apps to deactivate whose freed memory is at least M while minimizing the total deactivation cost. | Medium6 | Dynamic programmingArray | No attempts yet | 1s | 128 MB | Judgeable |
| Infinite GameGiven sets A and B of positive steps taken alternately right and left, decide whether every integer can be reached. | Medium6 | Number theoryDynamic programming+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Four Gate PushGiven mineral and gas budgets and per-unit strengths, maximize total strength over non-negative counts of three unit types. | Medium6 | Dynamic programmingMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| BonsaiRoot a weighted tree and cut edges of minimum total weight so that no original leaf stays connected to the root. | Medium6 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Number GameWith Ellie's responses fixed by a1..a20, decide if the first player can force reaching 0 in a subtraction game. | Medium6 | Game theoryDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Leap FrogGiven sorted positions, Jack and Jill alternate hopping over each other within distance 10; find the minimum total jumps until one lands on the last position. | Medium6 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SpamCount how many plain-text messages encode to the same spam encoding as a given message. | Medium6 | Dynamic programmingString | No attempts yet | 1s | 128 MB | Judgeable |
| Colored StonesRemove the fewest stones so that in the remaining row every color appears in one contiguous block. | Medium6 | Dynamic programmingBit manipulation | No attempts yet | 1s | 128 MB | Judgeable |
| Cake CuttingSplit a w by h rectangle into m axis-aligned integer rectangles, each cut dividing one piece, to minimize the largest piece's area. | Medium6 | Dynamic programmingDivide and conquer+1 | No attempts yet | 1s | 128 MB | Judgeable |
| BracketsGiven a bracket string, find the maximum length of a regular bracket sequence obtainable as a subsequence. | Medium6 | Dynamic programmingIntervals+1 | No attempts yet | 1s | 128 MB | Judgeable |