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,688 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| HistogramsGiven histogram H and point set S, build a valid histogram from S points that minimizes diffcount or abserror against H. | Hard8 | Dynamic programmingPrefix sum | No attempts yet | 1s | 256 MB | Judgeable |
| Buffed BuffetFill a plate of weight exactly w from discrete pieces and divisible dishes with linearly fading tastiness to maximize total tastiness. | Hard8 | Dynamic programmingBinary search+2 | No attempts yet | 4s | 128 MB | Judgeable |
| Beads and WiresYou choose append and insert orders that build the given weighted tree to maximize the total length of insert-created edges. | Hard8 | Dynamic programmingTree+2 | No attempts yet | 1s | 128 MB | Judgeable |
| CardsThe program decides after each swap of two two-sided cards whether one face per card can show numbers that never decrease left to right. | Hard8 | Segment treeDynamic programming | No attempts yet | 3s | 256 MB | Judgeable |
| RallyFind the vertex whose removal minimizes the longest directed path in a DAG and report that minimum length. | Hard8 | Topological sortDynamic programming+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Tourist Information PointsChoose minimum-cost towns so every town holds a point or borders one. | Hard8 | Dynamic programmingGraph | No attempts yet | 1s | 256 MB | Judgeable |
| Persuading the AdvisersTwo rivals take turns claiming undecided experts for opposite sides, and the first asks whether he can force the majority-vote tree to favor him. | Hard8 | Game theoryTree+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Doubling gameGiven a binary grid, compute for each cell the largest token pile reachable by repeatedly merging equal adjacent piles. | Hard8 | Dynamic programmingBFS+1 | No attempts yet | 10s | 256 MB | Judgeable |
| Test Data AnalysisCount bounded arrays of length N whose maximum contiguous subarray sum equals D, modulo 1,000,000,007. | Hard8 | Dynamic programmingPrefix sum+1 | No attempts yet | 2s | 256 MB | Judgeable |
| CheatsCount the completion orders of a tree of prerequisites when up to k parent edges can be skipped to grandparents, with no two skipped edges adjacent. | Hard8 | Dynamic programmingTree+1 | No attempts yet | 10s | 256 MB | Judgeable |
| Super Mario 169Choose the switch order and the coin pickup routes in 3D so Mario collects every coin with the least total swim distance. | Hard8 | Dynamic programmingGeometry+1 | No attempts yet | 3s | 256 MB | Judgeable |
| PawnsDecide whether White or Black wins a pawn race where each side moves only its own pawns forward until every column is blocked. | Hard8 | Game theoryDynamic programming | No attempts yet | 1s | 256 MB | Judgeable |
| Sweet WarTwo players alternate passing at one energy each or eating the next ball for its nutrition and taste, and each maximizes total taste eaten. | Hard8 | Game theoryDynamic programming | No attempts yet | 1s | 256 MB | Judgeable |
| Shrine MaintenanceSplit the shrines on a circle of radius 1000 among W workers leaving from the center so the longest round trip is as short as possible. | Hard8 | Dynamic programmingGeometry+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Hari MerdekaChoose a string over priced letters with total cost within the budget to maximize the summed scores of all occurrences of the given words. | Hard8 | Dynamic programmingString matching | No attempts yet | 3s | 256 MB | Judgeable |
| Galaxy collisionYou split the points into two groups whose internal distances exceed 5 and minimize the smaller group. | Hard8 | GraphBFS+2 | No attempts yet | 3s | 256 MB | Judgeable |
| Road RepairFind a tree path with total cost at most C that maximizes total benefit. | Hard8 | TreeDivide and conquer+1 | No attempts yet | 1s | 256 MB | Judgeable |
| How Does Your Garden Grow?Place up to 50 one-metre plants on a 10 cm grid so the squared gap between each plant water need and the sprinkler water its interval collects is minimal. | Hard8 | Dynamic programmingMath+1 | No attempts yet | 30s | 256 MB | Judgeable |
| Out of contextFor each text line, print the longest substring the given grammar generates, breaking ties by earliest position, or NONE. | Hard8 | Dynamic programmingString matching | No attempts yet | 10s | 256 MB | Judgeable |
| ParadesPick the most parade routes between pairs of junctions in a tree so no street is shared by two parades. | Hard8 | Dynamic programmingTree+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Virus synthesisBuild each DNA string over A, C, G, and T from empty using single-letter attachments or mirrored duplication in the fewest operations. | Hard8 | Dynamic programmingString matching | No attempts yet | 20s | 256 MB | Judgeable |
| The ImpPick boxes in some order while an adversary voids up to k of them, and maximize the kept item value minus all purchase costs under optimal play. | Hard8 | Game theoryDynamic programming+1 | No attempts yet | 15s | 256 MB | Judgeable |
| Volunteer CampStarting from each house in a weighted tree, find the shortest truck route that visits K marked houses without driving back. | Hard8 | TreeDynamic programming+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Transmutation CirclesFind the activation order of nested circles that maximizes total energy from element flips in already active circles. | Hard8 | Dynamic programmingTree+1 | No attempts yet | 10s | 256 MB | Judgeable |
| Integer GamePlayers alternately remove a number with no larger remaining neighbor from a row permutation, and whoever takes 1 wins, so decide the winner under optimal play. | Hard8 | Game theoryDynamic programming | No attempts yet | 5s | 256 MB | Judgeable |
| Stamp StampFind the fewest inked cells in a stamp whose two unrotated presses produce the given paper. | Hard8 | Dynamic programmingGraph+2 | No attempts yet | 10s | 256 MB | Judgeable |
| ImprovementsReposition ships on a line from a station so no two ropes joining consecutive ships cross, keeping as many ships as possible in place. | Hard8 | Dynamic programmingCombinatorics+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Integer in IntegerCount how many times C appears as a (possibly overlapping) substring in the decimal writings of all integers from A to B, modulo 1000000007. | Hard8 | Dynamic programmingString matching+1 | No attempts yet | 10s | 128 MB | Judgeable |
| Fallen Apples and the Nearest TreeFor each yearly apple drop on a grid, output the squared Euclidean distance to the nearest existing tree, counting the new tree only from the next year. | Hard8 | GeometryDynamic programming+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Stack MazeYou move only right or down through the grid, pick up lettered jewels, and drop them into matching holes in last-in-first-out order for the most matches. | Hard8 | Dynamic programmingStack+1 | No attempts yet | 8s | 256 MB | Judgeable |
| Floating IslandsFind the cheapest connected bridge network where each bridge costs the position difference and each island has a degree limit, or report -1 when impossible. | Hard8 | Dynamic programmingMinimum spanning tree+1 | No attempts yet | 8s | 512 MB | Judgeable |
| The Light King and the Mirror Maze 2Count the ways to fill each ? with /, \ or empty on an N by M board so the beam entering border port x leaves at port y, modulo 10007. | Hard8 | Dynamic programmingGraph+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Slave to Achievements 3Starting from M scraps, repeated crafting and dismantling ends with fewer than N scraps, and you must report each final remainder probability modulo 1e9+7. | Hard8 | ProbabilityDynamic programming+2 | No attempts yet | 3s | 256 MB | Judgeable |
| HackerChoose a start on a valued ring and spread to neighboring computers each turn to maximize hacked value against an optimal blocker. | Hard8 | Game theoryDynamic programming+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Queen BeeEach day border cells grow by given amounts and each inner cell copies one of three neighbors by its rule table, and you report every cell size after N days. | Hard8 | Dynamic programmingSimulation+1 | No attempts yet | 5s | 256 MB | Judgeable |
| Bali SculpturesSplit N sculptures in order into between A and B consecutive groups to minimize the bitwise OR of the group age sums. | Hard8 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 64 MB | Judgeable |
| Hexagon travelCount the orders of L left turns, R right turns and M moves that leave a hex-grid robot on a red, green, or blue tile, modulo 1,000,000,007. | Hard8 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 32 MB | Judgeable |
| Actually visible pointsCount the nondecreasing integer chains ending at the given values with no other chain point on the segment from the origin, modulo 1000000007. | Hard8 | Number theoryCombinatorics+1 | No attempts yet | 1s | 256 MB | Judgeable |
| The last wizardTen counters start at 1 and grow through T random additive updates; output their expected product scaled by A to the T modulo 1000000007. | Hard8 | ProbabilityCombinatorics+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Wouldn't it be better to just earn garnets?Find the second-fastest travel time from island 1 to island N over walks that may repeat bridges, and the largest garnet total among walks with that time. | Hard8 | Shortest pathDynamic programming | No attempts yet | 10s | 128 MB | Judgeable |
| Reducing Network DiameterPay per unit of reduction on tree edge weights so the longest path between any two nodes is at most D at minimum total cost. | Hard8 | GreedyTree+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Tree of PainDecide for each small pattern tree whether it embeds into the organization tree with matching labels and ancestry preserved both ways. | Hard8 | TreeDynamic programming+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Absurdistan Roads IIN cities each build a road to one random other city; compute the probability that the N roads connect all cities. | Hard8 | CombinatoricsProbability+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Shibuya CrossingGiven the list of crossing path pairs, find the size of the largest group of people whose paths all cross each other. | Hard8 | GraphDynamic programming+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Extensive OrCount n-element subsets of numbers below the huge binary bound formed by repeating s k times whose xor is zero, modulo 1e9+7. | Hard8 | Dynamic programmingCombinatorics+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Primal PartitionsSplit the array into k consecutive segments to maximize the smallest segment score, where each segment scores its largest common prime factor or zero. | Hard8 | Binary searchDynamic programming+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Marble MadnessMove marbles between adjacent bins to maximize the total absolute difference of neighbor counts, and report that maximum plus the fewest moves achieving it. | Hard8 | Dynamic programmingMath+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Just a QuizTeresa interrupts randomly drawn known questions at chosen words to maximize expected correct answers within t seconds. | Hard8 | Dynamic programmingTrie+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Train of ThreesYou repeatedly merge adjacent matching pairs in an array of 1s, 2s and numbers of the form 3 times a power of two to form the largest tile possible. | Hard8 | Dynamic programmingIntervals | No attempts yet | 5s | 256 MB | Judgeable |
| Splitting into PrimesStarting from N, repeatedly split every composite into a random divisor pair and report the expected number of rounds until all parts are prime. | Hard8 | ProbabilityDynamic programming+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Feeding the HerringsCount ordered triples summing to N with each part at least L and no digit 3 in any part, modulo 12345647. | Hard8 | Dynamic programmingCombinatorics+1 | No attempts yet | 5s | 256 MB | Judgeable |
| Kingdom TripFind the shortest subsequence from the first to the last point so every skipped point lies within distance d of its shortcut segment. | Hard8 | Dynamic programmingGeometry | No attempts yet | 2s | 256 MB | Judgeable |
| Call a CabPartition the ordered points into the fewest rides where each ride meets one type's minimum total distance and heading range limit. | Hard8 | Dynamic programmingSegment tree+2 | No attempts yet | 5s | 256 MB | Judgeable |
| Colored painting salesEach client buys a_i colored or b_i black-and-white paintings, and after each update count the sales with at least C colored buyers modulo 10007. | Hard8 | Dynamic programmingSegment tree+1 | No attempts yet | 4s | 32 MB | Judgeable |
| Party joke setsCount distinct joke-type sets from root-connected guest groups with unique values where each subtree below a guest forms consecutive numbers. | Hard8 | Dynamic programmingTree+1 | No attempts yet | 1s | 32 MB | Judgeable |
| Just a bit sortedFor each query bound K, count length-N lists with values 1 to K where each value above 1 has its predecessor before its last occurrence. | Hard8 | CombinatoricsDynamic programming+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Butterfly EffectDecide adaptively where to spend up to k double-die rolls across n chained chance events to maximize the chance the last event ends positive. | Hard8 | Dynamic programmingProbability | No attempts yet | 5s | 256 MB | Judgeable |
| OlympicsWith each successful or failed lift draining energy, guarantee a successful lift within d of an unknown strength from 25 to 225 kg and minimize d. | Hard8 | Dynamic programmingMath | No attempts yet | 2s | 256 MB | Judgeable |
| Wooden SignsCount the arrow stacks that match the given permutation, with each board screwed to the prior board so neighbors overlap, modulo 2147483647. | Hard8 | Dynamic programmingCombinatorics | No attempts yet | 1s | 256 MB | Judgeable |
| Tree AllocationPartition the nodes into blocks of at most B to minimize the worst root-to-leaf block count, for every choice of root. | Hard8 | Dynamic programmingTree+1 | No attempts yet | 10s | 64 MB | Judgeable |
| Content DeliveryPick an item and destination for each of m deliveries on a weighted tree with path caching to maximize total size times travel distance. | Hard8 | Dynamic programmingTree+1 | No attempts yet | 5s | 256 MB | Judgeable |
| Queue of SoldiersCount distinct lineups of soldiers with given heights where exactly K soldiers have a strictly shorter soldier ahead of them. | Hard8 | CombinatoricsDynamic programming+1 | No attempts yet | 5s | 256 MB | Judgeable |
| Round wordsGiven two words of length up to 2000, pick a rotation or reversal of each to maximize the LCS length and print that maximum. | Hard8 | Dynamic programmingString | No attempts yet | 2s | 128 MB | Judgeable |
| Guessing GameIdentify a hidden integer from 1 to n with adaptive subset questions where each NO costs a and each YES costs b while minimizing the worst-case total. | Hard8 | Dynamic programmingBinary search+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Find the missing rankCount score assignments within given ranges where no person receives rank R under tied ranking. | Hard8 | Dynamic programmingCombinatorics+1 | No attempts yet | 2s | 32 MB | Judgeable |
| GuardsCount the subsets of at least two applicants with pairwise coprime favorite numbers, modulo 1,000,000,007. | Hard8 | Dynamic programmingNumber theory+1 | No attempts yet | 2s | 32 MB | Judgeable |
| ShoppingChoose a right-and-down path from (1,1) to (H,W) that minimizes the price of visited and neighboring shops when one neighbor shop can be skipped at each step. | Hard8 | Dynamic programmingShortest path | No attempts yet | 2s | 512 MB | Judgeable |
| Balloon RecoveryDistribute a shared energy budget across height changes so every balloon riding layered winds reaches position zero as early as possible. | Hard8 | Binary searchDynamic programming | No attempts yet | 5s | 512 MB | Judgeable |
| Albocede DNA (Large)Count subsequences of S that split into one or more blocks of the form a^i b^j c^i d^j with i and j at least 1, modulo 1000000007. | Hard8 | Dynamic programmingCombinatorics | No attempts yet | 5s | 512 MB | Judgeable |
| Costly Binary Search (Large)Given the cost of comparing against each array position, find the smallest worst-case total cost of an adaptive binary search for the insertion point. | Hard8 | Dynamic programmingDivide and conquer+1 | No attempts yet | 60s | 1536 MB | Judgeable |
| Merlin QA (Large)Cast every spell once in the order that leaves the most valuable leftovers, since free storehouse stock covers only inputs the current stock cannot. | Hard8 | Dynamic programmingGreedy+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Runaway QuailStarting at zero on a line, catch every quail that flees outward at a speed below yours in the smallest possible total time. | Hard8 | Dynamic programmingMath+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Drum Decorator (Small)Count cylindrical grid fillings where each cell holding K has exactly K equal neighbours, up to rotation, modulo 1e9+7. | Hard8 | CombinatoricsDynamic programming+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Googlander (Large)Count the distinct self-avoiding walks on an R by C grid that start at the bottom left facing up and at each step go straight or turn right. | Hard8 | Dynamic programmingRecursion+1 | No attempts yet | 5s | 512 MB | Judgeable |
| ARAM (Large)Decide when to spend reroll currency on random champions to maximize the long-run win rate over many games. | Hard8 | Dynamic programmingProbability+2 | No attempts yet | 120s | 512 MB | Judgeable |
| Willow (Large)Two players pick starts on a coin tree and alternately take city coins while each used road closes for both, and the first player maximizes the score gap. | Hard8 | Game theoryTree+1 | No attempts yet | 120s | 512 MB | Judgeable |
| Trie ShardingSplit the strings among N labeled non-empty servers to maximize the total trie node count and report the maximum and the count of optimal splits modulo 1e9+7. | Hard8 | Dynamic programmingTrie+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Let Me Tell You a Story (Large)Count the orders in which ministers can be fired while a salary complaint remains possible until the survivors are non-increasing, modulo 10007. | Hard8 | CombinatoricsDynamic programming | No attempts yet | 30s | 512 MB | Judgeable |
| Observation Wheel (Large)Compute the expected total fare collected as visitors starting at uniform random gondolas fill all free spots on a circular wheel. | Hard8 | ProbabilityDynamic programming+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Upstairs and DownstairsKonstantin chooses and orders at least K activities from limited copies to minimize the chance Ilia wakes after falling asleep. | Hard8 | ProbabilityDynamic programming+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Lost PasswordGiven k = 2 and a string S, find the length of the shortest string containing every l33tspeak variant of each length-1 and length-2 substring of S. | Hard8 | GraphShortest path+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Commute War (Large)Choose connecting services to minimize expected travel time when departures leave hourly and each ride faces repeated random inspection delays. | Hard8 | Shortest pathProbability+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Wildcard (Large)Given two filenames A and B, find the shortest star pattern that matches A but not B, breaking ties by fewer stars then lexicographic order. | Hard8 | Dynamic programmingString matching+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Closet Room (Large)Place the maximum number of 2-cell closets, each needing an empty door tile, on a grid with pillars so every door tile stays connected to the entrance. | Hard8 | Dynamic programmingGraph+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Runs (Large)Count distinct rearrangements of the letters of S whose number of maximal equal-character blocks equals that of S, modulo 1000003. | Hard8 | CombinatoricsDynamic programming | No attempts yet | 5s | 512 MB | Judgeable |
| Google RoyalePick starting and doubling coin-flip bets to maximize the chance of growing A dollars into V dollars before going broke. | Hard8 | Dynamic programmingProbability+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Extreme Escalator Pogo (Large)Pick a starting blue step and a sequence of jump heights that change by at most one each time to maximize the tallest jump before a red landing. | Hard8 | GraphDynamic programming+1 | No attempts yet | 5s | 512 MB | Judgeable |
| City TourFind the longest simple cycle in a graph grown from a triangle by joining each new vertex to both ends of an existing edge. | Hard8 | Dynamic programmingGraph | No attempts yet | 5s | 512 MB | Judgeable |
| Travel Plan (Large)Visit every planet on a line exactly once and return to Earth, maximizing total travel distance without exceeding the fuel limit. | Hard8 | Dynamic programmingSorting+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Fence BoardsPick the fewest boards from N unlimited lengths to total exactly L for a fence up to 1e18 long, or report IMPOSSIBLE. | Hard8 | Shortest pathDynamic programming+1 | No attempts yet | 20s | 512 MB | Judgeable |
| Sums with Distinct Column DigitsCount unordered additions that sum to N in base B where digits in each column are pairwise distinct, modulo 1000000007. | Hard8 | Dynamic programmingCombinatorics+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Counting Cryptarithm EquationsCount unordered base-B summand sets with distinct digits in each column that sum to N. | Hard8 | Dynamic programmingCombinatorics+1 | No attempts yet | 60s | 512 MB | Judgeable |
| BacteriaRectangular colonies on a grid evolve each second by a north-and-west neighbor rule, and the task asks when every cell becomes empty. | Hard8 | Dynamic programmingMatrix | No attempts yet | 5s | 512 MB | Judgeable |
| MarblesGiven 2n marbles of n colors in a row, find the minimum height of non-crossing paths pairing each color, or -1 if impossible. | Hard8 | Dynamic programmingImplementation+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Interesting RangesCount subranges of [L, R] containing an even number of decimal palindromes, for L and R up to 10^100, modulo 1e9+7. | Hard8 | MathCombinatorics+1 | No attempts yet | 45s | 512 MB | Judgeable |
| Stock ChartsPartition n stock price sequences into the fewest groups so that within each group no two polylines cross or touch at any time point. | Hard8 | Dynamic programmingGreedy+1 | No attempts yet | 5s | 512 MB | Judgeable |
| The Year of Code Jam (Small)Assign each '?' day blue or white to maximize total blue-day value, where a blue day starts at 4 and loses 1 for each blue neighbor above, below, left, or right in a grid of N months by M days. | Hard8 | Dynamic programmingGraph+2 | No attempts yet | 5s | 512 MB | Judgeable |
| The Year of Code Jam (Large)On a grid of N months by M days, choose white or blue for each '?' cell to maximize total happiness, where each blue day scores 4 minus its blue neighbors. | Hard8 | Dynamic programmingGraph+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Painting a Fence (Large)Pick the fewest offers from N interval-and-color proposals so every one of 10000 fence sections is covered using at most 3 distinct colors. | Hard8 | IntervalsGreedy+2 | No attempts yet | 10s | 512 MB | Judgeable |
| Bus Stops (Small)Count the ways K buses starting at the first K stops can cover all N stops and end at the last K, with gaps of at most P. | Hard8 | Dynamic programmingBit manipulation+1 | No attempts yet | 5s | 512 MB | Judgeable |