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 results2,743 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Jumping Across LogsArrange the given log heights in a circle to minimize the largest height gap between neighbors. | Medium5 | GreedySorting | No attempts yet | 1s | 256 MB | Judgeable |
| PokerCompare two five-card poker hands by standard rankings and kicker tiebreakers and print the winning hand or Tie. | Medium5 | ImplementationSorting | 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 |
| Workstation assignmentSeat each arriving researcher at a freed workstation that stayed unlocked to save the most unlocks. | Medium5 | GreedyHeap+1 | No attempts yet | 10s | 256 MB | Judgeable |
| Perica's PianoSort the N key values and add each value multiplied by the number of K-sets where it is the largest, modulo 1000000007. | Medium5 | CombinatoricsSorting+1 | No attempts yet | 1s | 64 MB | Judgeable |
| Preserving the GridPlace d partitions between cells of a 1 by n board holding k horses to maximize cells no horse can reach. | Medium5 | GreedySorting | No attempts yet | 1s | 32 MB | Judgeable |
| Load BalancingPlace one vertical and one horizontal fence between the odd-coordinate cow positions to minimize the largest cow count in any of the four regions. | Medium5 | SortingPrefix sum+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Load BalancingJohn places one vertical and one horizontal fence to minimize the largest cow count in the four regions. | Medium5 | Brute forceSorting | No attempts yet | 1s | 512 MB | Judgeable |
| Diamond CollectorSort the diamond sizes and pick two disjoint groups with spread at most K to maximize the total count. | Medium5 | SortingTwo pointers | No attempts yet | 2s | 512 MB | Judgeable |
| Mr. Kim's Grocery Store (Small)Given the sorted pile of 2N mixed normal and discounted price tags, recover the N sale prices. | Medium5 | GreedyHash map+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Kim Incheon's Grocery Store (Large)Given 2N sorted tags that pair N sale prices with regular prices at 4/3 of each sale price, recover the N sale tags. | Medium5 | GreedyHash map+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Lunch MenuCount the menus whose spiciness falls in [u, v] and whose sweetness falls in [x, y] for each query. | Medium5 | Segment treeSorting+1 | No attempts yet | 1s | 512 MB | Judgeable |
| TournamentWith free seeding of 2^N numbers in a knockout bracket, find the best level each number can reach. | Medium5 | SortingMath | No attempts yet | 3s | 64 MB | Judgeable |
| Fairland (Small)Marie keeps the largest manager-closed team containing herself whose salaries span at most D. | Medium5 | TreeDFS+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Up and Down SequenceCount the fewest adjacent swaps that turn distinct numbers into a sequence that rises to one peak and then falls. | Medium5 | Brute forceSorting | No attempts yet | 5s | 512 MB | Judgeable |
| The RepeaterEqualize N lowercase strings using only adjacent duplicate insertions and deletions with the fewest moves, or report impossibility. | Medium5 | StringSorting+1 | No attempts yet | 5s | 512 MB | Judgeable |
| The Repeater (Large)Decide whether N lowercase strings can be made identical by duplicating or deleting adjacent equal letters, and report the fewest moves. | Medium5 | StringSorting+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Rural PlanningArrange every post into a simple polygon larger than half the convex hull area by building the two specified hull-chain orders and keeping the larger one. | Medium5 | GeometrySorting+1 | No attempts yet | 5s | 512 MB | Judgeable |
| The Great Wall (Small)Count the interval attacks that breach a wall which rises to each successful attack's strength, judging attacks on the same day against the unchanged wall. | Medium5 | SimulationIntervals+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Osmos (Small)Starting from size A, sort the other motes and absorb each smaller one, adding helper motes or deleting blockers for the fewest operations. | Medium5 | GreedySorting | No attempts yet | 5s | 512 MB | Judgeable |
| Osmos (Large)Starting from size A, absorb the sorted motes in order and use the fewest added or removed motes to clear each blocker. | Medium5 | GreedySorting | No attempts yet | 5s | 512 MB | Judgeable |
| Safety in NumbersCompute for each contestant the smallest vote percentage that guarantees another contestant ties or trails them no matter how the remaining votes split. | Medium5 | MathBinary search+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Equal SumsGiven up to 20 distinct numbers, print the two lexicographically smallest distinct subsets that share the smallest repeated sum, or Impossible. | Medium5 | Brute forceHash map+1 | No attempts yet | 20s | 512 MB | Judgeable |
| Kingdom RushEarn one-star and two-star clears with star thresholds in an order that finishes every level with two stars in the fewest plays. | Medium5 | GreedySorting | No attempts yet | 5s | 512 MB | Judgeable |
| Kingdom Rush (Large)Find the fewest level completions that earn a 2-star rating on every level when each level needs minimum star counts for its 1-star and 2-star plays. | Medium5 | GreedySorting | No attempts yet | 5s | 512 MB | Judgeable |
| Best coffee (Small)Pick one coffee cup per day from kinds with limited cups and expiry days to maximize total satisfaction over K days. | Medium5 | GreedySorting | No attempts yet | 5s | 512 MB | Judgeable |
| Morning Coffee (Large)Choose one cup per day from day 1 to K so no kind is drunk past its deadline and total satisfaction is largest. | Medium5 | GreedyHeap+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Dire Straights (Small)Split the hand into groups of consecutive values to make the shortest group as long as possible. | Medium5 | BacktrackingSorting | No attempts yet | 5s | 512 MB | Judgeable |
| Airport Walkways (Small)Spend up to t seconds running, choosing walkway and plain sections, to minimize travel time over a corridor of length X. | Medium5 | GreedySorting | No attempts yet | 5s | 512 MB | Judgeable |
| Music Collection SearchFor each song name, find the shortest case-insensitive substring that appears in that name alone, breaking ties by a custom lexicographic order. | Medium5 | String matchingBrute force+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Vanishing Numbers (Small)Sort each decimal by the round it is removed from the Cantor middle-third process, placing numbers that never vanish last. | Medium5 | MathSorting | No attempts yet | 5s | 512 MB | Judgeable |
| Closing the Loop (Large)Pick equal numbers of red and blue rope segments to maximize total length minus one centimeter per knot. | Medium5 | GreedySorting | No attempts yet | 5s | 512 MB | Judgeable |
| Crazy Rows (Small)Given an N by N binary matrix, reorder the rows using adjacent swaps so each row's rightmost 1 is at or left of its position, minimizing swaps. | Medium5 | GreedySorting+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Crazy Rows (Large)Given a binary N x N matrix, swap adjacent rows to move every 1 to or below the main diagonal, and output the minimum number of swaps. | Medium5 | GreedySorting+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Legendary JBNUMaintain a set of integer keys with values, supporting insert, update-by-nearest-key, and query that prints the nearest key's value, -1, or ?. | Medium5 | ArraySorting+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Branch AssignmentPartition b branches into s nonempty groups to minimize total round-trip courier distance, where a message from branch i to j costs dist(i,hq)+dist(hq,j). | Medium5 | GraphShortest path+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Seat AssignmentAssign seats left to right, each time giving the seat to the still-unseated request with the smallest right endpoint that covers it. | Medium5 | GreedySorting+1 | No attempts yet | 0.8s | 32 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 |
| Birthday PresentsPick a subset of presents whose price range is below D, maximizing total satisfaction. | Medium5 | SortingSliding window+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Centipede legsGiven n and m notes, choose left and right leg counts summing to n, both at least 1, maximizing how many notes have l_i <= left and r_i <= right, breaking ties by smallest left count. | Medium5 | MathPrefix sum+2 | No attempts yet | 2s | 512 MB | Judgeable |
| DNA SequencingEach printed line can be trimmed to any prefix; pick prefixes of length at least M so the number of distinct resulting strings is maximized. | Medium5 | TrieString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Change a PasswordGiven an old N-digit password, find the length-N permutation of distinct digits that maximizes the cyclic distance from the old value, breaking ties by smallest number. | Medium5 | Brute forceSorting+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Minimum SwapsGiven permutations A and B, find the minimum number of swaps within A that turn it into B. | Medium5 | ArrayHash map+2 | No attempts yet | 1s | 64 MB | Judgeable |
| Presidential ElectionsGiven per-state delegates, fixed votes, and undecided voters, find the minimum number of undecided voters to convince so the Constituents win a delegate majority, with ties going to the Federals. | Medium5 | GreedySorting | No attempts yet | 5s | 512 MB | Judgeable |
| Soccer GameGiven n teams and their reported win counts in a round-robin with no ties, decide if some set of match results produces exactly those scores. | Medium5 | GreedySorting | No attempts yet | 2s | 512 MB | Judgeable |
| Mário's LockersGiven the positions of L free lockers, find the minimum number of swaps to gather N of them into consecutive positions. | Medium5 | Sliding windowPrefix sum+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Shuffled DeckFor a deck of P distinct cards, find how many times the given interleaving shuffle must be repeated until the deck returns to its sorted order. | Medium5 | MathSorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Grandpa Pepe's PizzaGiven N olive positions on a circle of circumference C, decide whether equal sectors of length C/N can each contain exactly one olive. | Medium5 | MathImplementation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| FocusGiven N closed intervals, find the minimum number of points needed so that every interval contains at least one chosen point. | Medium5 | GreedyIntervals+2 | No attempts yet | 2s | 512 MB | Judgeable |
| University CourseSimulate course selection each semester: from courses whose prerequisites are done, take up to M with highest priority, and report the schedule. | Medium5 | Topological sortGreedy+2 | 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 |
| Postal DeliveryGiven delivery counts at coordinates on a line and a truck capacity K, find the minimum total distance to deliver all letters and return to the origin. | Medium5 | GreedySorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| AssignmentsGiven deadlines and scores for N assignments, pick a subset schedulable within their deadlines to maximize total score. | Medium5 | GreedySorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| TaxFind the shortest path from S to D in a weighted undirected graph, then report it again after each tax rise adds p to every edge. | Medium5 | Shortest pathGraph+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Reading ListTotal lifted books over a sequence of assignments, where each assigned book moves to the top of the tower. | Medium5 | ArraySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| HNLGiven N clubs with points and one final round of matches, list every club that can still finish first under some set of results. | Medium5 | Brute forceSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| HackerBuild the minimal list of URLs that covers every known parameter with every malicious value, packing pairs into queries of at most P parameters by the given grouping rule. | Medium5 | ImplementationString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ĆevapiEach day a new raft joins; simulate Goran's run across both banks under L meters and report meters on each bank and the portions eaten. | Medium5 | SimulationSorting+1 | No attempts yet | 3s | 128 MB | Judgeable |
| MoocastGiven N cow coordinates, find the smallest integer X such that the graph connecting pairs whose squared distance is at most X is connected. | Medium5 | GraphUnion-find+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Smallest sum no subsequence can makeGiven N ≤ 20 numbers, find the smallest natural number that is not the sum of any non-empty subsequence. | Medium5 | BacktrackingBrute force+1 | No attempts yet | 2s | 512 MB | Judgeable |
| The Ruthless BossGiven n distinct deadlines, find the largest integer k so that scheduling all jobs, each taking exactly k hours back to back, meets every deadline. | Medium5 | GreedySorting+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 |
| Watson and Intervals (Small)Generate N intervals from a recurrence, then remove exactly one interval so the number of integers covered by the rest is minimized. | Medium5 | IntervalsSorting+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Convenience Store 2Given n customer points, place one store anywhere to minimize the total Manhattan distance to all customers and print that minimum sum. | Medium5 | MathSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| SprinklersPlace two fixed sprinklers and choose radii so every flower is covered, minimizing the sum of squared radii; print that minimum as an integer. | Medium5 | SortingGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| ParetoChoose k accounts maximizing B minus A, where A = 100k/N and B is their share of all money as a percent. | Medium5 | GreedySorting+2 | No attempts yet | 1s | 64 MB | Judgeable |
| Junoh Lives for Lunch!!Given each friend's starting position and running speed, decide whether all N friends can meet at one point within time T. | Medium5 | Binary searchSorting+2 | No attempts yet | 2s | 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 |
| Shoemaker's Job OrderOrder N jobs to minimize the total fine paid while each job waits, using the shortest processing time per fine ratio first, with lexicographically smallest ties. | Medium5 | GreedySorting | No attempts yet | 2s | 512 MB | Judgeable |
| Mixing two solutionsGiven a sorted array of N integers, choose two different elements whose sum is closest to 0, breaking ties toward the smaller (negative) sum. | Medium5 | Two pointersSorting+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Best Relay TeamChoose four runners from n, assign one to leg 1 and three to the other legs, minimizing the total time with a lexicographic tie-break. | Medium5 | GreedySorting+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Deranging HatGiven a string, find a sorting network that turns its sorted letters back into the original string, following a specified rule. | Medium5 | SimulationSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| EducationAssign departments to buildings by a deterministic greedy rule after sorting students descending, matching each to the cheapest available building that fits. | Medium5 | GreedySorting+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Robot Energy Source OrderReorder n energy sources, each with acceleration a_i and duration s_i, to maximize total distance, and print the gain over the given order. | Medium5 | SortingGreedy+2 | No attempts yet | 0.2s | 128 MB | Judgeable |
| The StoveEach visitor stays for one time unit at a distinct arrival time; with at most K lights, minimize total stove-on time by skipping the largest idle gaps. | Medium5 | GreedySorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Art ExhibitionChoose a subset of artworks maximizing the sum of values minus the difference between the largest and smallest sizes in the subset. | Medium5 | SortingPrefix sum+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Signal 1Choose a subset of points with distinct x-coordinates; maximize the total Euclidean length of the polyline joining them in increasing x order. | Medium5 | Dynamic programmingSorting+2 | No attempts yet | 1.5s | 128 MB | Judgeable |
| Largest averageGiven N grades, repeatedly replace any two numbers with their average until one remains; find the largest possible final value. | Medium5 | GreedyMath+2 | No attempts yet | 1s | 64 MB | Judgeable |
| The LawyerFor each day, decide whether two of that day's meetings are disjoint and, if so, output the pair with the smallest earlier-meeting index, then smallest later index. | Medium5 | SortingGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Cowburger set discountGiven prices for burgers, sides, and drinks, report the undiscounted total and the minimum total after forming disjoint triples where each item in a set is sold at 10% off. | Medium5 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Rest StopsBessie rests at grass stops along a trail and must never fall behind Farmer John; maximize total tastiness of eaten grass. | Medium5 | GreedySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Counting the closest pair sumsGiven n integers and a target v, count how many index pairs have a sum whose distance from v is as small as possible. | Medium5 | SortingTwo pointers+2 | No attempts yet | 2s | 512 MB | Judgeable |
| *Light*Young*Woo*Given N lights that each illuminate a 90-degree upward sector, count for each query point how many sectors contain it. | Medium5 | GeometryPrefix sum+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Warring StatesProcess alliance and war records between groups, merging by sum for alliances and subtracting troops for wars, then report surviving groups sorted by troop count. | Medium5 | Union-findImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Missing GnomesGiven a subsequence of 1..n, find the lexicographically smallest permutation of 1..n that contains it as a subsequence. | Medium5 | GreedyImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 5th Job AdvancementOrder n quests and toggle at most k active Arcane Stones to split each quest reward among run lengths, maximizing total collected experience. | Medium5 | SortingPrefix sum+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Non-Violent ProtestsGiven each person's threshold, find how many riot if someone riots once that many others already do. | Medium5 | GreedySorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| RectanglesChoose pairs of sticks (each possibly shortened by at most 1) as opposite sides of rectangles, maximizing the total area. | Medium5 | GreedySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| DSHS BankPick the branch minimizing the total taxicab distance to all others, breaking ties by smallest branch number. | Medium5 | MathSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| A Prize No One Can WinPick a largest subset of item prices such that no pair has a sum strictly greater than X, and print its size. | Medium5 | ArraySorting+2 | No attempts yet | 1.5s | 512 MB | Judgeable |
| FishermenCount for each fisherman how many fish satisfy |x - a| + y <= l, given fish and fishermen positions on a line. | Medium5 | ArraySorting+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Amusement ParkCitizens at various blocks must reach block 0 by taxi (A per block, one rider) or by sharing a bus (B won, up to 40 riders, one pick-up point). Find the minimum total cost. | Medium5 | Dynamic programmingSorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Sheep Rescue OperationGiven a tree rooted at 1 with sheep or wolf counts per node, find the maximum number of sheep that can reach node 1 along unique paths while each wolf eats at most one entering sheep. | Medium5 | TreeGreedy+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Small PenaltyPick one card from each of three players so the max minus min of the chosen numbers is as small as possible, and report that range. | Medium5 | SortingTwo pointers+1 | No attempts yet | 1s | 512 MB | Judgeable |
| PokegeneCount, for each query, how many string prefixes occur in exactly L of the K listed genomes. | Medium5 | StringString matching+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Lipschitz ConstantGiven N points (x, f(x)), the Lipschitz constant is the maximum slope between adjacent points after sorting by x. | Medium5 | GeometrySorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Japan SinksRaise the sea level through the section heights and track how maximal runs of above-level sections merge; report the largest island count seen. | Medium5 | SortingUnion-find+2 | No attempts yet | 2s | 512 MB | Judgeable |
| SiblingsGiven each woman's mother as an index, count pairs of women who share the same mother across several data sets. | Medium5 | Hash mapSorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Mountain ViewCount how many mountain peaks are not covered by any other 45-degree right-triangle mountain with its base on the x-axis. | Medium5 | GeometrySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sleepy Cow SortingGiven a permutation of 1..N, repeatedly move the front cow any number of paces back; find the minimum number of steps to reach sorted order. | Medium5 | GreedyArray+2 | No attempts yet | 2s | 512 MB | Judgeable |