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,683 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Marathon 2Run checkpoints 1 to N in order while skipping at most K middle checkpoints to minimize total Manhattan distance. | Medium5 | Dynamic programming | No attempts yet | 1s | 256 MB | Judgeable |
| Meeting TimeFind the smallest total travel time that both cows can achieve on separate downhill paths from field 1 to field N. | Medium5 | Dynamic programmingGraph | No attempts yet | 1s | 256 MB | Judgeable |
| Restore CalculationCount ways to fill each ? in equal-length strings A, B, and C with digits, leading digits nonzero, so A plus B equals C, modulo 1,000,000,007. | Medium5 | Dynamic programmingMath | No attempts yet | 8s | 512 MB | Judgeable |
| Two-Area DatabaseRead a fixed sequence of data kinds using a one-slot cache that loads at cost c and serves hits for free, and minimize total read cost. | Medium5 | Dynamic programming | No attempts yet | 1s | 256 MB | Judgeable |
| Pi Day Pie DistributionCount the nondecreasing distributions of n pie pieces among k people with each person getting at least one piece. | Medium5 | Dynamic programmingCombinatorics | No attempts yet | 1s | 256 MB | Judgeable |
| EmpireFind the fastest route from A to B whose total hull damage stays strictly below K. | Medium5 | Shortest pathDynamic programming | No attempts yet | 1s | 256 MB | Judgeable |
| Honey Butter ChipArrange the M extra bags within the N fixed bags and pick no two adjacent bags to maximize the chip total. | Medium5 | Dynamic programmingArray | No attempts yet | 5s | 256 MB | Judgeable |
| Square Piece CutCut an n by m integer-sided rectangle with guillotine cuts into the fewest integer-sided squares. | Medium5 | Dynamic programming | No attempts yet | 2s | 256 MB | Judgeable |
| Card GameTwo piles of N cards are compared from the top, and the program finds the largest score earned by discarding a smaller right card. | Medium5 | Dynamic programming | No attempts yet | 1s | 256 MB | Judgeable |
| Sequence ArtisanFind the largest product of any contiguous block in an array with values from -2 to 2, then report it modulo 1000000007. | Medium5 | GreedyDynamic programming+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Traveling Salesman Tour 2Find the cheapest tour that starts at one city, visits each of N cities exactly once, and returns to the start using the given directed costs. | Medium5 | Dynamic programmingBit manipulation+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Lucky Cookie BakeryAssign each dough ball to one of two ovens with different baking times to minimize the time the slower oven finishes. | Medium5 | Dynamic programming | No attempts yet | 5s | 128 MB | Judgeable |
| Explosive MaterialsSplit conflicting materials into two safe boxes and minimize the fuller box size. | Medium5 | GraphBFS+1 | No attempts yet | 3s | 256 MB | Judgeable |
| The Missing PermutationFill the zeros with the missing values to maximize the length of the longest increasing subsequence. | Medium5 | GreedyDynamic programming+1 | No attempts yet | 15s | 256 MB | Judgeable |
| Attendance AwardCount length-N strings over L, O and A with at most one L and no three consecutive As for each N up to 3000. | Medium5 | Dynamic programmingCombinatorics | No attempts yet | 1s | 256 MB | Judgeable |
| Longest Bitonic SubsequenceGiven a sequence of up to 1000 numbers, find the length of its longest subsequence that strictly rises then strictly falls. | Medium5 | Dynamic programming | No attempts yet | 1s | 256 MB | Judgeable |
| Criboard Max APress A, select all, copy, and paste within N keystrokes to show the most As possible. | Medium5 | Dynamic programming | No attempts yet | 1s | 256 MB | Judgeable |
| Football scorelinesCount the ordered scoring sequences by both teams that reach the given final score under the listed play values, modulo 1000000009. | Medium5 | Dynamic programmingCombinatorics | No attempts yet | 2s | 256 MB | Judgeable |
| Vampire DiceCompute the success probability of scoring at least y points from x exploding ten-sided dice where 8 to 10 score and 10 grants an extra roll. | Medium5 | ProbabilityDynamic programming | No attempts yet | 1s | 256 MB | Judgeable |
| TV WarPick non-overlapping weekly TV programs to maximize the total preference score. | Medium5 | Dynamic programmingSorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| RobberiesPick a subset of banks that maximizes the stolen money while the combined capture probability stays strictly below the given limit. | Medium5 | Dynamic programmingProbability | No attempts yet | 1s | 256 MB | Judgeable |
| Combat OddsGiven N independent battles with win chance p, compute the chance that a losing run of at least L occurs. | Medium5 | ProbabilityDynamic programming | No attempts yet | 1s | 256 MB | Judgeable |
| CarrotFor each N, count the steps to reach zero by subtracting one when the pile splits into equal piles of at least two and subtracting two otherwise. | Medium5 | Number theoryDynamic programming | No attempts yet | 1s | 256 MB | Judgeable |
| Atomic ComputerCount the length-y signed-binary strings over -1, 0 and 1 whose digits weighted by powers of two sum to x. | Medium5 | Dynamic programmingBit manipulation | No attempts yet | 1s | 256 MB | Judgeable |
| Gimli's GulletPack unlimited servings of M foods into capacity C for the most calories, breaking ties by the lexicographically smallest serving counts. | Medium5 | Dynamic programming | No attempts yet | 1s | 256 MB | Judgeable |
| SurfPick waves with no wait-time overlap so the sum of fun points is as large as possible. | Medium5 | Dynamic programmingSorting+1 | No attempts yet | 4s | 256 MB | Judgeable |
| Feast CoinsCount ways to reach total S with owned coins so that every chosen coin value appears the same number of times. | Medium5 | Dynamic programmingCombinatorics | No attempts yet | 3s | 256 MB | Judgeable |
| King's WalkMove a king n cells over a letter grid to match the motto in as many positions as possible, breaking ties by the smallest coordinate sequence. | Medium5 | Dynamic programmingMatrix | No attempts yet | 1s | 256 MB | Judgeable |
| Fruit FeastEat unlimited fruits that add A or B without passing T, using at most one halving, to reach the largest fullness. | Medium5 | Dynamic programming | No attempts yet | 2s | 512 MB | Judgeable |
| Radio ContactJohn and Bessie each walk or wait along their fixed routes to minimize the summed squared distance until both reach their final points. | Medium5 | Dynamic programming | No attempts yet | 2s | 512 MB | Judgeable |
| Circular Barn (Silver)Cows waiting at ring doors walk clockwise to fill each room with one cow at the smallest total squared walking distance. | Medium5 | Dynamic programmingBrute force | No attempts yet | 2s | 512 MB | Judgeable |
| Cleaning the Club Room!Pick exactly M evenings to reset dirt to zero so the sum of daily visitors times dirt since the last cleaning is smallest. | Medium5 | Dynamic programmingPrefix sum | No attempts yet | 1s | 128 MB | Judgeable |
| Not So RandomFeed X through N stages that each apply bitwise AND, OR, or XOR with K at given probabilities and report the expected final value. | Medium5 | ProbabilityBit manipulation+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Cube IV (Large)Find the longest run of consecutive room numbers placed in neighboring cells and report its starting number and length. | Medium5 | Dynamic programmingGraph+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Broken Calculator (Small)Split X into factors typed with working digits only, minimizing the total of digit, multiply, and equals presses. | Medium5 | Dynamic programmingRecursion+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Parentheses Order (Small)Print the k-th valid parentheses string of n pairs in lexicographic order for each test case, or report that it does not exist. | Medium5 | Dynamic programmingCombinatorics | No attempts yet | 5s | 512 MB | Judgeable |
| Parentheses Order (Large)Given n and k, output the k-th valid parentheses string of n pairs in lexicographic order, or Doesn't Exist! when fewer than k exist. | Medium5 | Dynamic programmingCombinatorics+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Full Binary TreeGiven a tree with up to 15 nodes, delete as few nodes as possible so the remaining nodes form a full binary tree for some choice of root. | Medium5 | TreeDynamic programming+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Dragon Maze (Small)Find the fewest-step walk from the entrance to the exit of a cell grid and report the most power gathered on such a route. | Medium5 | BFSShortest path+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Dragon Maze (Large)In a grid with blocked cells, walk from the entrance to the exit in the fewest moves and collect the most power among such walks. | Medium5 | BFSDynamic programming | No attempts yet | 5s | 512 MB | Judgeable |
| Diamond Inheritance (Large)Decide whether any pair of classes in each inheritance DAG has two different inheritance paths between them. | Medium5 | GraphTopological sort+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Survivor (Small)Pick which foods to eat and in what order, respecting each shelf life, to maximize total survival time. | Medium5 | BacktrackingDynamic programming | No attempts yet | 5s | 512 MB | Judgeable |
| Bit Count (Small)Given N, split it into nonnegative a and b with a plus b equal to N to maximize the total count of 1 bits in a and b. | Medium5 | Bit manipulationDynamic programming | No attempts yet | 5s | 512 MB | Judgeable |
| Doubly-sorted grid (small)Given a partially filled R by C letter grid with R and C at most 4, count the completions whose rows and columns are non-decreasing modulo 10007. | Medium5 | BacktrackingDynamic programming | No attempts yet | 5s | 512 MB | Judgeable |
| Counting welcome to code jam subsequencesCount subsequences of each input text that spell the 19-character target string, printed as the last four digits. | Medium5 | Dynamic programmingString | No attempts yet | 5s | 512 MB | Judgeable |
| Cheating a Boolean Tree (Small)Given a complete boolean tree with switchable gates, find the minimum number of gate flips so the root evaluates to V. | Medium5 | TreeDynamic programming | No attempts yet | 5s | 512 MB | Judgeable |
| Cheating a Boolean Tree (Large)Given a complete binary tree of AND/OR gates with fixed leaf values, find the fewest changeable gates to flip so the root equals V, or report IMPOSSIBLE. | Medium5 | Dynamic programmingTree+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Longest Increasing Subsequence 3Given a sequence of up to 10^6 integers, find the length of the longest strictly increasing subsequence. | Medium5 | Dynamic programmingBinary search | No attempts yet | 3s | 512 MB | Judgeable |
| Roller CoasterFrom a sequence of column heights, delete columns so the survivors strictly decrease then strictly increase (either part may be empty); output the maximum number of survivors. | Medium5 | Dynamic programmingArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| String TheoryGiven alternating runs of quote characters, find the largest k for which the whole string is a k-quotation. | Medium5 | Dynamic programmingString+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Inha SuitStarting at height 1, choose one of five moves before each tree so the height lands on a hole, minimizing teleport (T) uses within limit K. | Medium5 | Dynamic programmingGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| A Walk Around the Main CampusCount closed walks of exactly D minutes from the Information Science Building in a fixed eight-building graph, modulo 1e9+7. | Medium5 | Dynamic programmingGraph+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Make It One 2Find the fewest operations (divide by 3, divide by 2, or subtract 1) turning N into 1, and print the lexicographically smallest shortest path. | Medium5 | Dynamic programmingBFS+1 | No attempts yet | 0.5s | 512 MB | Judgeable |
| Junseo the Librarian KingGiven book numbers and weights, move the lightest total weight of books so the numbers end up in non-decreasing order. | Medium5 | Dynamic programmingSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Cheating a Boolean TreeIn a tournament-style Boolean tree, flip the fewest changeable AND/OR gates so the root evaluates to V, or report it impossible. | Medium5 | TreeDynamic programming | No attempts yet | 2s | 512 MB | Judgeable |
| Handing out candiesFor every K, count the ways to choose one candy of each brand 1 through K, and print the total over all K. | Medium5 | Dynamic programmingCombinatorics | No attempts yet | 2s | 512 MB | Judgeable |
| Magic PotionGiven a complete graph with edge weights and K potions that halve one trip's time, find the shortest time from city 0 to city 1. | Medium5 | Shortest pathGraph+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Counting Music ScoresCount scores over two pitches and two durations with n seconds total, balanced pitch counts, at least as many long notes as short, and alternating pitches starting low. | Medium5 | CombinatoricsDynamic programming+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Selling CPUsSell up to c CPUs across m ordered merchants, each paying p_i for exactly i CPUs in one deal, to maximize total money. | Medium5 | Dynamic programmingGreedy | No attempts yet | 2s | 512 MB | Judgeable |
| MazeBob moves through a multi-graph where each letter opens doors with that label; given the letter sequence, compute the probability he reaches room n, choosing uniformly among available matching doors. | Medium5 | ProbabilityDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Spontaneous TripGiven flight counts between airports, find the most likely airport reached after exactly K random flights starting from ICN. | Medium5 | ProbabilityDynamic programming+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Train Line ConstructionOn an N by N grid with resident counts and blocked cells, find a 4-direction path between two stations minimizing the sum of cell weights along it. | Medium5 | GraphShortest path+2 | No attempts yet | 1s | 64 MB | Judgeable |
| Lucky TicketsCount digit strings of length 2N whose first N digits sum to the same value as the last N digits, modulo 1e9+7. | Medium5 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| EcologyCompute the probability that exactly M of N birds wear a tracker after D days of catching C random birds each day. | Medium5 | Dynamic programmingProbability+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Fibonacci ChickenGiven N, split it into Fibonacci-derived (people, chicken) pairs whose people counts sum to N, and report the minimum and maximum total chickens. | Medium5 | Dynamic programmingMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ResortChoose one-day, 3-day, and 5-day passes over a vacation with blocked days so every open day is covered at minimum cost, where 3 coupons buy a free one-day pass. | Medium5 | Dynamic programmingGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Equal leaf distancesRaise edge weights in a weighted perfect binary tree so every root-to-leaf path has equal length, minimizing the total weight. | Medium5 | TreeGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Contiguous Sum 2Find the maximum contiguous subarray sum after optionally deleting at most one element from the sequence. | Medium5 | Dynamic programmingArray | No attempts yet | 2s | 512 MB | Judgeable |
| Hard CutsFor each w by h rectangle, find the minimum number of integer-sided squares that tile it exactly. | Medium5 | Dynamic programmingImplementation | No attempts yet | 2s | 256 MB | Judgeable |
| Jewelry StoreWith unlimited gems of each of N kinds, list all total values obtainable by choosing exactly K gems. | Medium5 | Dynamic programmingCombinatorics | No attempts yet | 5s | 512 MB | Judgeable |
| Stock exchangeGiven daily prices and a fixed fee per buy, find the maximum total profit when holding at most one share at a time and each share must be sold later. | Medium5 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Sum of FactorialsGiven N up to 100000, find the fewest factorials (repeats allowed) whose sum equals N. | Medium5 | Dynamic programmingMath+1 | No attempts yet | 1s | 512 MB | Judgeable |
| VampiresGiven two life totals, a hit threshold and a fixed damage, find the probability that vampire 1 wins a turn-based drain fight. | Medium5 | ProbabilityDynamic programming+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Sentence ReductionGiven tasks with weekday, start and end times, and point values, pick a non-overlapping set that maximizes total points, and report the per-day breakdown. | Medium5 | Dynamic programmingSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sum Decomposition 2Count ordered K-tuples of integers between 0 and N whose sum is N, modulo 1,000,000,000. | Medium5 | Dynamic programmingCombinatorics+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Good Positions in a PermutationCount permutations of 1..N whose number of positions i with |P_i - i| = 1 equals a given K, modulo 1e9+7. | Medium5 | CombinatoricsDynamic programming+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Alphabet StringInsert the fewest lowercase letters into s so that deleting some letters leaves exactly a through z in order. | Medium5 | Dynamic programmingString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Gather on the ClockCards sit on a ring; repeatedly stack a card onto its clockwise neighbor for the value difference, and maximize the total score when one card remains. | Medium5 | Dynamic programmingIntervals | No attempts yet | 8s | 512 MB | Judgeable |
| m-ary PartitionsCount the partitions of n into powers of m, for up to 1000 queries with n up to 10000. | Medium5 | Dynamic programmingMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Opening Day 2Given wok sizes, each cooking uses one or two distinct woks and produces the sum of their sizes; find the minimum number of cookings summing to exactly N. | Medium5 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Grand OpeningGiven N bowls to produce and a multiset of wok sizes, each round uses one wok or two distinct woks of equal size, and you must reach exactly N bowls with the fewest rounds. | Medium5 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Banknotes and RouletteSplit banknotes so the two equal-sum groups leave the smallest leftover, then add half of twice that leftover to each person's total. | Medium5 | Dynamic programmingArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| EmoticonsStarting from one emoticon on screen with an empty clipboard, find the minimum seconds to reach exactly S using copy, paste, and delete-one operations. | Medium5 | BFSGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Score of a SubsequenceFind the maximum over all contiguous subarrays of the weighted sum where the k-th element from the subarray start contributes k times its value. | Medium5 | Dynamic programmingArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Connecting Edges 2Given a weighted edge list, pick the order of adding edges that makes the total weight added up to the moment s and t first become connected as small as possible. | Medium5 | GraphSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Vote (Large)Given N supporters of A and M of B in random arrival order, find the probability A leads after every vote; a ballot-problem computation. | Medium5 | CombinatoricsProbability+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Codejamon Cipher (Small)For each enciphered string, count the sentences of vocabulary words whose letter multisets concatenate to it, modulo 1e9+7. | Medium5 | Dynamic programmingHash map+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Slides! (Small)Given B up to 6 and M up to 20, decide if exactly M paths from building 1 to B exist, and print the fixed-rule matrix when possible. | Medium5 | CombinatoricsDynamic programming+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Integer SequenceGiven x, y, the last two digits of A0 and A1, and a large index n, print the last two digits of An where An = x*An-1 + y*An-2. | Medium5 | MathDynamic programming+2 | No attempts yet | 0.25s | 512 MB | Judgeable |
| What Is Dynamic Programming?Count paths from the top-left cell to the bottom-right cell of an n by m grid when each step moves right, down, or diagonally down-right, printed modulo 1e9+7. | Medium5 | Dynamic programmingMatrix+1 | No attempts yet | 2s | 512 MB | Judgeable |
| ResignationGiven each day's consultation length and payment, pick a non-overlapping set of jobs that all finish before day N+1 to maximize total payment. | Medium5 | Dynamic programmingBrute force+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Mario PartyGiven a row of coin values and a die roll range, find the maximum total coins collected on any route that reaches past the star within T turns. | Medium5 | Dynamic programming | No attempts yet | 2s | 512 MB | Judgeable |
| The Other WayCount the number of distinct shortest paths between two towns in a weighted undirected multigraph, modulo 10^9+9. | Medium5 | GraphShortest path+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Image Quilting (Small)Given two H by W grayscale images, choose one pixel per row forming a connected seam (rows shift by at most one column) minimizing the sum of squared pixel differences, and output that minimum. | Medium5 | Dynamic programmingImplementation | No attempts yet | 1s | 512 MB | Judgeable |
| Voter DepressionPick non-overlapping story intervals to multiply exposed voters' propensities and maximize the right-minus-left propensity gap. | Medium5 | Dynamic programmingIntervals+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Pony Express (Small)Cities lie on a line with a horse in each; find the minimum time from city 1 to city N, switching horses at intermediate cities, subject to each horse's endurance limit. | Medium5 | Dynamic programmingShortest path+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Tiling a 2 by N wallCount the ways to tile a 2 by N wall with 2x1, 1x2, and 1x1 tiles, modulo 1e9+7. | Medium5 | Dynamic programmingCombinatorics | No attempts yet | 2s | 512 MB | Judgeable |
| From Seoul to GyeongsanChoose walking or cycling for each of N legs so the total time is at most K and the total donation is maximal. | Medium5 | Dynamic programmingBrute force+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Project SchedulingGiven each task's duration and its prerequisite tasks, find the minimum total time to finish the whole project. | Medium5 | Topological sortDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Building a ranchGiven an M by N grid with trees and rocks as obstacles, find the side length of the largest square subgrid that contains no obstacle. | Medium5 | Dynamic programmingMatrix+2 | No attempts yet | 1s | 512 MB | Judgeable |