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,732 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Era NameGiven partial records mapping Western years to era names and regnal years, determine the era name and year for each query, or report Unknown when no record covers it. | Medium4 | ArraySorting+2 | No attempts yet | 8s | 512 MB | Judgeable |
| Delete and Append SortEach operation moves one element to the end. Find the minimum number of such moves needed to sort the array. | Medium4 | GreedySorting | No attempts yet | 2s | 512 MB | Judgeable |
| Tandem BicyclePair each Dmojistan rider with a Pegland rider to minimize or maximize the sum of the larger speed in each pair. | Medium4 | GreedySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Wheat HarvestFind each connected block of 1s, order blocks by area, and label every cell with its block's rank. | Medium4 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Counting HaybalesGiven N distinct haybale positions and Q interval queries, count how many positions fall inside each inclusive range [A, B]. | Medium4 | SortingBinary search+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Merging SlimesMerge N slimes two at a time, scoring the product of merged sizes, and maximize the total score. | Medium4 | GreedySorting | No attempts yet | 2s | 512 MB | Judgeable |
| Point CardGiven M cards with A wins out of 2N cells, pay 1 yen per flipped stamp to make at least M-1 cards hold N or more wins; minimize total cost. | Medium4 | GreedySorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Ingenious Lottery TicketsCount how often each number 1 to 49 appears across n lottery entries, then pick the six most frequent, breaking ties by favoring 7 and then smaller numbers. | Medium4 | SortingArray | No attempts yet | 2s | 512 MB | Judgeable |
| Prime GameSimulate a two-player game where each spoken prime is recorded per player, duplicates cost 1000 points, and a non-prime gives the opponent their third largest prime or 1000. | Medium4 | SimulationImplementation+2 | No attempts yet | 2s | 256 MB | Judgeable |
| The TA is a sadist!!Given a permutation of 1 to N, find the minimum number of elements to remove so the remaining values increase from front to back. | Medium4 | Dynamic programmingBinary search+2 | No attempts yet | 2s | 256 MB | Judgeable |
| STOP USING MONEYSort N games by satisfaction-to-price ratio, then by lower price, then by game number, and print the first K game numbers. | Medium4 | SortingMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| The Seven WarlordsGiven up to ten million student grades, output the seven lowest grades in increasing order, one per line. Ties on the cut line still yield exactly seven grades. | Medium4 | SortingHeap+2 | No attempts yet | 10s | 256 MB | Judgeable |
| MultiMaxGiven n cards with values in [-1000, 1000], pick two or three so their product is maximized. | Medium4 | SortingGreedy+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Party GamesFor each test case, find the shortest string that splits the sorted guest names into two equal halves, choosing the alphabetically first if several have that length. | Medium4 | StringSorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Steed 2: Cruise Control (Small)Given horses ahead on a one-way road that slow to match slower horses they catch, find the fastest constant speed Annie can hold to her destination without ever passing one. | Medium4 | MathImplementation+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Ample Syrup (Small)Choose K pancakes from at most 10 to stack largest radius on the bottom, maximizing the exposed surface area divided by pi. | Medium4 | Brute forceSorting+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Taro's ShoppingGiven item prices and a budget, find the largest sum of two distinct items that does not exceed the budget. | Medium4 | Two pointersSorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Frosh WeekGiven task durations and quiet-interval lengths, each between 100000 and 199999, pair tasks with intervals that fit them and maximize the number of completed tasks. | Medium4 | GreedyTwo pointers+2 | No attempts yet | 4s | 512 MB | Judgeable |
| ZigZagGiven K words and N letters, output for each letter the word starting with it that has been used fewest times, breaking ties alphabetically. | Medium4 | SortingHash map+2 | No attempts yet | 2s | 64 MB | Judgeable |
| Street LightsGiven existing street lights that each cover K metres to both sides, find the minimum number of extra lights needed to light every metre from 1 to N. | Medium4 | GreedySorting+2 | No attempts yet | 1s | 64 MB | Judgeable |
| How to Eat at a BuffetGiven a plate area and items with value per area and available area, pick fractions to maximize total value on the plate. | Medium4 | GreedySorting | No attempts yet | 2s | 512 MB | Judgeable |
| Milk MeasurementThree cows start at 7 gallons; apply N dated changes in chronological order and count the days on which the set of cows holding the top output changes. | Medium4 | SimulationSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Coloring IntervalsGiven n closed intervals with distinct endpoints, find the minimum number of colors so that overlapping intervals get different colors. | Medium4 | SortingIntervals+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Best Matched PairGiven up to 1000 distinct integers, find the largest product of two whose product's decimal digits form a consecutive increasing run like 123; print -1 if none exists. | Medium4 | ImplementationBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Out of PlaceGiven a row that came from a sorted row with one cow moved, find the minimum number of arbitrary swaps to sort it. | Medium4 | SortingGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| N and M (7)Given N distinct numbers and a length M, print every length-M sequence drawn from the numbers with repetition allowed, deduplicated and in increasing lexicographic order. | Medium4 | BacktrackingRecursion+2 | No attempts yet | 1s | 512 MB | Judgeable |
| N and M (8)Given N distinct natural numbers and a length M, print all non-decreasing sequences of length M drawn from the numbers, in lexicographic order. | Medium4 | BacktrackingSorting+1 | No attempts yet | 1s | 512 MB | Judgeable |
| N and M (9)Given N numbers (with duplicates) and length M, print every distinct length-M selection in increasing lexicographic order, using each copy at most once. | Medium4 | BacktrackingSorting+1 | No attempts yet | 1s | 512 MB | Judgeable |
| N and M (11)Given N numbers and a length M, list every length-M sequence drawn from the numbers, allowing repeats, in increasing lexicographic order without duplicates. | Medium4 | BacktrackingRecursion+2 | No attempts yet | 1s | 512 MB | Judgeable |
| N and M (12)Given N numbers and a length M, list all non-decreasing length-M sequences drawn from the numbers with repetition, in lexicographic order. | Medium4 | BacktrackingSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| HoofballSort cows by position, then find the minimum number of starting balls so every cow receives the ball at least once under the nearest-cow passing rule. | Medium4 | SortingGraph+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Lemonade LineGiven each cow's maximum tolerated queue length, choose an arrival order that minimizes how many cows end up waiting in line. | Medium4 | GreedySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Hook or Be HookedEach polygon has a squared radius equal to its farthest vertex from the origin; find the K-th smallest such value and print it with two decimals. | Medium4 | GeometrySorting+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Au au ua ui ya!!Given N segments [x, y] already sorted by x, compute the total length covered by their union on the number line. | Medium4 | IntervalsSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Drawing ArrowsEach point shoots an arrow to the nearest same-colored point; find the total length of all N arrows. Points are given unsorted, so sort them by position first. | Medium4 | SortingHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Drawing ArrowsEach point shoots an arrow to the nearest same-colored point; compute the total length of all arrows. | Medium4 | SortingHash map+2 | No attempts yet | 1s | 256 MB | Judgeable |
| SunflowersGiven an N by N grid that is a 90-degree rotation of an unknown valid table, recover the original table. | Medium4 | ImplementationMatrix+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Voronoi VillagesGiven N village positions on a line, find the smallest finite Voronoi neighbourhood size and print it with one decimal digit. | Medium4 | SortingGeometry+2 | No attempts yet | 2s | 512 MB | Judgeable |
| You Are Fired!Pick at most k employees whose salaries sum to at least d, minimizing the number fired, or report that it cannot be done. | Medium4 | GreedySorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| HackathonPartition N students into the fewest teams so each student's team size does not exceed their limit Xi. | Medium4 | GreedySorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| SpaceshipReorder n enemy powers so that the last one equals the sum of all the others. | Medium4 | MathSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Very Important PersonsAssign guest numbers 1 to nm to an n by m hall so seat (1,1) holds nm and numbers decrease with Manhattan distance from that seat. | Medium4 | SortingMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Least Common MultipleGiven two irreducible fractions, find the smallest positive irreducible fraction divisible evenly by both, writing it in lowest terms. | Medium4 | MathNumber theory+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Drawing LinesGiven N segments on a number line, find the total length of their union, counting overlaps once and printing it as an integer. | Medium4 | SortingIntervals+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Planet ConnectionGiven a complete symmetric cost matrix, find a minimum spanning tree connecting all planets and output its total maintenance cost. | Medium4 | Minimum spanning treeGraph+2 | No attempts yet | 1s | 256 MB | Judgeable |
| SnakebirdGiven N fruits at heights h_i and a snake of length L, grow by eating any fruit of height at most the current length and output the maximum length reached. | Medium4 | GreedySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Function to Find the K-th NumberGiven an array of up to 5,000,000 integers and 1-based K, return the element at position K after sorting the array ascending. | Medium4 | SortingBrute force | No attempts yet | 0.2s | 512 MB | Judgeable |
| Make the Largest NumberGiven up to 1000 non-negative integers, order the pieces so their concatenation is the largest possible number, and print it without leading zeros. | Medium4 | GreedySorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Heroes of the Storm ProgamerGiven N character levels and a total increase K, raise levels to maximize the minimum of the chosen sequence. | Medium4 | GreedySorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| A Study on GroupsSplit the N integers into M groups whose sizes differ by at most one, then compute the smallest and largest possible sums of the group minima. | Medium4 | ArrayGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| InflationPair canister amounts with balloon sizes 1 to n so the minimum fill fraction is as large as possible without exceeding any capacity. | Medium4 | GreedySorting | No attempts yet | 2s | 512 MB | Judgeable |
| Judging DivisionalsGiven ranked teams with a division and university, apply two selection steps with university limits and output the 12 advancing teams by rank. | Medium4 | SimulationImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| LazylandEach of n workers wants one of k jobs and costs b_i to reassign. Keep one worker per chosen job and reassign the cheapest extras to cover every missing job. Return the minimum total cost. | Medium4 | GreedySorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Contest SettingCount the ways to choose k problems whose difficulties are all distinct, given n problems and their difficulty values, modulo 998,244,353. | Medium4 | MathCombinatorics+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Finding LoveSimulate sliding contests of M people, each eliminating one person at rank V, then print the last M-1 skills sorted ascending. | Medium4 | SimulationSorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Digits Are Not Just CharactersCompare each name with s0 by splitting into letter and number items, then output "-" if it sorts before s0 or "+" otherwise. | Medium4 | StringSorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| PismoGiven an array of N integers, find two positions L < R minimizing the difference between the maximum and minimum of the subarray A[L..R]. | Medium4 | ArraySorting+1 | No attempts yet | 1s | 512 MB | Judgeable |
| The Bucket ListGiven N milking intervals, each needing a fixed number of buckets, find the smallest labels FJ's greedy allocation ends up using across all cows. | Medium4 | SimulationSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Are You Listening?Given your point and n listening circles, find the largest radius centered there overlapping at most two of them; output the floor of it, or 0 if three already cover you. | Medium4 | GeometryMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Two ArraysFor each element of A, find the element of B closest in value (smallest on ties) and print the sum of these chosen values. | Medium4 | Binary searchSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Cipher DecoderCheck whether the multiset of integers in the ciphertext matches the multiset of character codes of the given plaintext. | Medium4 | Hash mapSorting+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Lining UpGiven N lines of 5 people each, decide whether everyone can pass through a single LIFO waiting area in increasing ticket order. | Medium4 | StackSimulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Overflowing FandomGiven N intervals during which fans are at school, find the minimum length of a single visit window that meets every interval. | Medium4 | IntervalsGreedy+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Badugi PokerGiven six distinct cards, each with a number 1 to 15 and a color, sort all 15 pairs by the ranking rules and print the winner first. | Medium4 | SortingImplementation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| StreetlightsGiven N integer points, decide whether for every pair (xi,yi), (xj,yj) the two reflected points (xi,yj) and (xj,yi) are also present. | Medium4 | Hash mapSorting+2 | No attempts yet | 0.5s | 256 MB | Judgeable |
| And the Winner Is... Ourselves!Given 11 problems that are all solved, choose the solving order that minimizes total penalty, where each problem contributes its finish time plus 20 times its wrong submissions. | Medium4 | GreedySorting+2 | No attempts yet | 4s | 1024 MB | Judgeable |
| Cap SizeGiven cap sizes tried on with fit feedback, count how many untried sizes could still fit, or report inconsistent feedback. | Medium4 | ImplementationSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Pocket MoneyChoose banknotes from the wallet so the total is even and as large as possible, using any subset; print NIESTETY if only odd totals are reachable. | Medium4 | GreedyMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Dome ConstructionGiven n points in 3D with non-negative y, find the minimum radius of a dome (hemisphere on the xz-plane) that contains at least k of them. | Medium4 | Binary searchGeometry+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Feeding SealsEach volunteer can carry one or two buckets as long as their combined weight stays within capacity c. Find the minimum number of volunteers needed to move all buckets. | Medium4 | GreedyTwo pointers+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 222-PoolingRepeatedly replace each 2x2 block of an NxN matrix with its second largest value until one number remains, and print it. | Medium4 | ImplementationSimulation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Baba is RabbitGiven commands of the form p is q, find all objects reachable from Baba by applying one or more commands, printed in lexicographic order. | Medium4 | GraphDFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Hardware SalesGiven three lists of (item ID, units) purchases, count items whose total units reach 20 or more in all three stores, printing IDs in first-appearance order. | Medium4 | Hash mapImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Problem ClassificationCount exact whole-word occurrences of each category's keywords in a statement, then print the categories with the highest total count in lexicographic order. | Medium4 | Hash mapString+2 | No attempts yet | 1s | 512 MB | Judgeable |
| The New Year's BellGiven an N by M grid of who heard each bell ring, decide whether some distance thresholds R can produce exactly this pattern. | Medium4 | SortingGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| AntsGiven N integers, some negative or very large, find the smallest nonnegative integer that does not appear among the valid nonnegative values. | Medium4 | ArrayHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Hiding NutsGiven N grid points, pick the one minimizing the sum of Manhattan distances to all other points, breaking ties by smallest X then smallest Y. | Medium4 | MathBrute force+2 | No attempts yet | 1s | 512 MB | Judgeable |
| AntennaGiven positions of houses on a line, pick the house position that minimizes the total distance to all houses, choosing the smallest such position on ties. | Medium4 | SortingMath+2 | No attempts yet | 1s | 256 MB | Judgeable |
| LTBLRead match results between two teams, accumulate points, wins, draws, losses, and goals, then print the league table sorted by the six tiebreak rules. | Medium4 | ImplementationSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Multiverse IITwo universes are equal when their planet sizes give the same ordering and tie pattern; count pairs of the M universes that match. | Medium4 | SortingHash map+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Coordinate CompressionFor each of N coordinates, output the number of distinct values smaller than it, which is its rank under coordinate compression. | Medium4 | SortingHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| LadderGiven n sticks that can only be shortened, decide whether two can become length x and k others length y. | Medium4 | GreedySorting+2 | No attempts yet | 2s | 64 MB | Judgeable |
| On Becoming the Strongest Competitive Programmer After 200 Years of SeclusionGiven contests in fixed order, each with a prize cap and a prize amount, decide whether Yeondu can skip at most one contest while never exceeding the running cap. | Medium4 | GreedyImplementation+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Cyber Opening CeremonyGiven start, end, and stream-end times plus chat logs, count members who chatted at or before the start and again between the end and stream-end. | Medium4 | Hash mapImplementation+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| BeadmanGiven counts of N bead types, repeatedly remove one bead of each of two different types; find the minimum number of beads that can remain. | Medium4 | GreedyMath+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Cow-abunga!Given at most 9 cow weights, choose M of them and print every prime number that appears as a subset sum, in increasing order. | Medium4 | Brute forceCombinatorics+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Best PlaceGiven N points, find integer coordinates (X, Y) that minimize the sum of Manhattan distances from the point to every participant. | Medium4 | SortingMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| FractificationGiven four positive integers, arrange them into two fractions a/b + c/d so the sum is as small as possible, and print the arrangement. | Medium4 | GreedySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| DunesEach gust adds +x to l and then alternates signs up to r; answer m queries for the final height at given positions. | Medium4 | ArrayPrefix sum+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sleep PatternGiven weekday sleep intervals on a Mon-Fri timeline, compute the minimum weekend hours needed so total weekly sleep reaches T, or report that even 48 hours is not enough. | Medium4 | ImplementationMath+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Base-36 NumberPick K base-36 digit symbols to replace with Z across N numbers so their sum is maximized, then output that sum in base 36. | Medium5 | GreedyMath+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Cargo LoadingGiven crane weight limits and box weights, find the minimum minutes to load all boxes with one box per crane per minute, or -1 if impossible. | Medium5 | GreedySorting+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Maximum SumAssign digits 0-9 to letters A-J that encode N numbers so that the sum of the numbers is maximized while no number has a leading zero. | Medium5 | GreedyMath+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Four PrimesWrite a program that finds four prime numbers whose sum equals a given natural number N, or reports -1 if impossible. | Medium5 | Number theoryMath+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Tablature TranspositionConvert a fretted-instrument tablature to a different instrument's tuning, transposing each note and picking the highest-pitched available string for it. | Medium5 | GreedySimulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Yogurt Expiration DatePick k yogurts with maximum total amount, break ties by minimizing the chance at least one is defective, and print that incident probability as a percentage. | Medium5 | GreedySorting+2 | No attempts yet | 2s | 128 MB | Judgeable |
| LibraryFind the minimum total steps for a librarian starting at 0 to deliver books to their positive or negative integer positions while carrying at most M books per trip. | Medium5 | GreedySorting+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Collecting GemsGiven N gem weights and M bags of capacity C, determine the maximum number of gems that can be packed into the bags without exceeding capacity. | Medium5 | GreedySorting | No attempts yet | 2s | 128 MB | Judgeable |
| DuelMatch N Team A fighters against N Team B fighters to maximize points, where a win scores 2, a tie scores 1, and a loss scores 0. | Medium5 | GreedySorting+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Sejun and Sebi's WarGiven two armies whose weakest soldier dies each round (ties killing Sebi's soldier first), determine which side's soldier survives last. | Medium5 | GreedySimulation+2 | No attempts yet | 2s | 128 MB | Judgeable |