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,730 problems
TitleLevelTopicsSolvedTime limitMemory limitJudge
Word MathAssign distinct digits 0-9 to letters so that the sum of several words, read as base-10 numbers, is as large as possible.Medium4GreedyMath+1No attempts yet2s256 MBJudgeable
Lecture RoomsGiven N lecture intervals, compute the minimum number of rooms needed so no room hosts overlapping lectures, treating touching endpoints as non-overlapping.Medium4GreedySorting+1No attempts yet2s128 MBJudgeable
Highway ShortcutsCompute the minimum driving distance from position 0 to D on a highway with up to 12 one-way shortcuts that skip forward sections.Medium4Shortest pathGraph+2No attempts yet2s128 MBJudgeable
Triangle BuilderGiven N straw lengths, pick three that form a triangle with the largest possible perimeter, or report -1 if none exist.Medium4SortingGreedy+1No attempts yet2s128 MBJudgeable
Selling GoodsGiven each buyer's max price and delivery cost, choose a sale price (ties broken by lowest) that maximizes total profit summed over buyers who purchase profitably.Medium4Brute forceSorting+2No attempts yet2s128 MBJudgeable
English ReadingCount how many dictionary-word combinations match each scrambled sentence when each word's middle letters can be permuted freely.Medium4Hash mapString+2No attempts yet2s128 MBJudgeable
Bubble Sort Swap CountCount the number of adjacent swaps bubble sort performs to sort an array, equivalent to counting inversions efficiently.Medium4SortingDivide and conquer+1No attempts yet1s512 MBJudgeable
Lee Dongho's TruckGiven pillar coordinates in a square warehouse, find the widest integer-width straight lane from west to east that touches no pillar or wall.Medium4SortingGeometry+2No attempts yet2s128 MBJudgeable
Minsik Language Word SortingSort Minsik language words using a custom 20-letter alphabet where the digraph 'ng' counts as a single letter between 'n' and 'o'.Medium4StringSorting+1No attempts yet2s128 MBJudgeable
Overlapping SegmentsGiven N line segments on a number line, compute the maximum number of segments that overlap at any single point, not counting endpoint-only contacts.Medium4IntervalsSorting+2No attempts yet2s256 MBJudgeable
New EmployeesGiven N applicants ranked by two criteria, count applicants not dominated in both ranks by any other applicant (classic sort plus max-suffix pattern).Medium4SortingGreedyNo attempts yet2s256 MBJudgeable
Router InstallationGiven house coordinates, place C routers among them to maximize the minimum pairwise distance between chosen routers.Medium4Binary searchGreedy+1No attempts yet2s128 MBJudgeable
Post OfficeGiven villages with positions and populations on a line, find the point minimizing total weighted distance, choosing the smallest position on ties.Medium4SortingPrefix sum+1No attempts yet2s128 MBJudgeable
Cipher DecryptionGiven a key and ciphertext produced by a columnar transposition cipher, reconstruct the original plaintext.Medium4StringSimulation+1No attempts yet2s128 MBJudgeable
Kimchi DeliveryGiven N cities on a line and a starting point, find the order of visiting all cities minimizing the sum of arrival times.Medium4GreedyDynamic programming+1No attempts yet2s128 MBJudgeable
Custom Table SorterRead tables and per-line sort specifications, then output the table rows stably sorted by given field/direction keys for each specification, grouped and formatted with blank lines.Medium4SortingString+1No attempts yet1s128 MBJudgeable
SensorsGiven N sensor coordinates and up to K interval-shaped concentrators, find the minimum total interval length needed to cover all sensors.Medium4SortingGreedyNo attempts yet2s128 MBJudgeable
Proving PropositionsGiven directed edges between letters, compute the transitive closure and print all reachable pairs excluding self-loops, sorted by letter order.Medium4GraphDFS+1No attempts yet2s128 MBJudgeable
Choose Two Numbers With Minimum DifferenceGiven N integers and threshold M, find the minimum absolute difference between two elements that is still at least M.Medium4SortingTwo pointers+1No attempts yet2s128 MBJudgeable
Choosing CondosCount condos that are Pareto-optimal, having no other condo that is both closer to the beach and cheaper.Medium4SortingGreedyNo attempts yet2s128 MBJudgeable
Symmetric DrawingGiven N marked points, decide if there is a vertical line x=c so that folding the plane along it maps the point set onto itself, and output that x-coordinate or NO.Medium4MathHash map+1No attempts yet2s128 MBJudgeable
Post OfficeGiven village coordinates and resident counts, find the smallest position minimizing total weighted distance to all residents (weighted median).Medium4SortingPrefix sum+1No attempts yet2s128 MBJudgeable
Keyword MatchingGiven weighted keyword lists for pages and queries, compute matching scores and output up to 5 top-scoring pages per query.Medium4SortingHash map+1No attempts yet2s128 MBJudgeable
Sum of DistancesGiven n points on a line, compute the sum of absolute distances over all ordered pairs efficiently using sorting and prefix sums.Medium4SortingPrefix sum+1No attempts yet1s128 MBJudgeable
Three Numbers, Two MsGiven n integers, pick three to maximize 3 times (median minus mean), which reduces to sorting and checking min/max extremes.Medium4SortingGreedy+1No attempts yet2s128 MBJudgeable
File Similarity ChecksGiven N file sizes, count pairs where the smaller size is at least 0.9 times the larger size.Medium4SortingTwo pointers+1No attempts yet1s128 MBJudgeable
Smallest Unmeasurable WeightGiven N integer weights usable only on one pan, find the smallest positive integer amount that cannot be formed as a subset sum.Medium4GreedySorting+1No attempts yet1s128 MBJudgeable
Two LiquidsGiven N distinct integers, sort them and use two pointers to find the pair whose sum is closest to zero.Medium4Two pointersSorting+1No attempts yet1s128 MBJudgeable
Amusement ParkGiven ride schedules with 10-minute buffers before and after each, find the longest free interval within 10:00-22:00 where no ride's blocked window overlaps.Medium4IntervalsSorting+1No attempts yet1s128 MBJudgeable
Music ProgramMerge several partial orderings of singers into one total order using topological sort, or report impossibility if a cycle exists.Medium4Topological sortGraph+1No attempts yet1s128 MBJudgeable
Stacking Colored PaperGiven N rectangles with allowed 90-degree rotation, find the longest chain where each sheet fits entirely inside the previous one.Medium4Dynamic programmingSorting+1No attempts yet1s128 MBJudgeable
Clock Card RankGiven four clockwise digits on a card, compute the minimal rotation (clock number) and find its rank among all distinct clock numbers from digits 1-9.Medium4Brute forceSimulation+1No attempts yet1s128 MBJudgeable
ChainsGiven lengths of N chains, find the minimum number of links to open and close so that all chains merge into a single chain.Medium4GreedySorting+1No attempts yet1s256 MBJudgeable
ALPS-Style VotingSimulate a D'Hondt-style seat allocation: filter staff by a 5% vote threshold, generate divided scores, pick the top 14, and count chips per staff sorted by name.Medium4SimulationSorting+1No attempts yet1s128 MBJudgeable
Basketball Lead TimeGiven timestamped scoring events over a 48 minute game, compute the total time each team held the lead.Medium4SimulationSorting+1No attempts yet1s128 MBJudgeable
Frequency SortSort a sequence of up to 1000 integers by descending frequency, breaking ties by the value's first appearance order in the input.Medium4Hash mapSorting+1No attempts yet1s128 MBJudgeable
Choosing a NameGiven even integers and a range [A,B], find an odd integer in that range maximizing the minimum distance to all given even values.Medium4ArrayGreedy+1No attempts yet1s128 MBJudgeable
Battle Order ScoreCount pairs of items whose relative order matches between a reference sequence and a given permutation, and print as a fraction over N(N-1)/2.Medium4ArrayBrute force+1No attempts yet1s128 MBJudgeable
Teams with Sum ZeroCount the number of index triples among N students whose skill values sum to exactly zero.Medium4ArrayTwo pointers+1No attempts yet4s128 MBJudgeable
Race RankingSimulate M checkpoint messages in order, keep only valid sequential checkpoint passes per driver, and print final ranking by progress and recency.Medium4SimulationImplementation+1No attempts yet1s128 MBJudgeable
Robot ProjectGiven a target length and up to a million rod lengths, find two rods summing exactly to the target with the maximum length difference, or report impossibility.Medium4Two pointersSorting+1No attempts yet5s256 MBJudgeable
Double QueueProcess a stream of add/serve commands maintaining a dynamic set to pop and remove either the maximum or minimum priority client each query.Medium4HeapSorting+1No attempts yet1s128 MBJudgeable
KCPCFrom a submission log, compute each team's best-per-problem total score, break ties by submission count then last submission time, and output a given team's rank.Medium4SimulationHash map+1No attempts yet1s128 MBJudgeable
Republic of KoreaCount crossing pairs among K straight highways linking numbered east and west coast cities, using inversion counting.Medium4SortingDivide and conquer+1No attempts yet1s128 MBJudgeable
SongsGiven songs with lengths and play frequencies, sort them by length-to-frequency ratio (stable on ties) to minimize expected access time and report the song at a queried position.Medium4GreedySortingNo attempts yet1s128 MBJudgeable
BookletsGiven booklets sorted by page count split among schools using floor/ceiling division with a strict serving order, find the first booklet's page count given to a specified school.Medium4SortingMath+1No attempts yet1s128 MBJudgeable
Happy Phone CallFor each query time window, count how many given phone-call intervals overlap it by at least one second, across multiple test cases.Medium4IntervalsSorting+1No attempts yet2s128 MBJudgeable
Slim SpanGiven a weighted graph, find the spanning tree that minimizes the difference between its largest and smallest edge weight, or report -1 if disconnected.Medium4Union-findSorting+1No attempts yet2s128 MBJudgeable
Pizza HawaiiFor each local ingredient and native ingredient, output the pair when the two words appear on exactly the same set of pizza names.Medium4Hash mapSorting+2No attempts yet1s128 MBJudgeable
Touchscreen KeyboardGiven a typed word and a list of same-length dictionary words, print each with its keyboard Manhattan distance, sorted by distance then lexicographically.Medium4StringSorting+2No attempts yet1s128 MBJudgeable
Babs’ Box BoutiqueGiven up to 10 boxes, each orientable in 3 ways, find the largest subset that can be stacked with each base fitting inside the one below.Medium4Dynamic programmingSorting+2No attempts yet1s128 MBJudgeable
Flash MobGiven n grid points, find the intersection minimizing the total Manhattan distance, breaking ties by smallest x then smallest y.Medium4SortingMath+2No attempts yet1s128 MBJudgeable
Shoring Up the LeveesGiven a convex quadrilateral, order its four corner triangles by area and print each triangle's area and perimeter rounded to three decimals.Medium4GeometrySorting+2No attempts yet1s128 MBJudgeable
Room PaintingGiven n can sizes and m paint requirements, sum the waste from picking for each colour the smallest can whose size is at least the requirement.Medium4SortingBinary searchNo attempts yet1s128 MBJudgeable
Course SchedulingGiven n course requests as (first name, last name, course) triples, count the distinct students per course and print courses in ASCII order.Medium4Hash mapSortingNo attempts yet1s128 MBJudgeable
CDGiven two sorted lists of distinct CD numbers, count how many numbers appear in both lists.Medium4Two pointersSorting+1No attempts yet1s256 MBJudgeable
AlaskaGiven charging station positions along a 1422-mile highway and a 200-mile range, decide whether the round trip Dawson Creek to Delta Junction and back is possible.Medium4GreedySorting+2No attempts yet1s128 MBJudgeable
Convex HullGiven points already labeled as hull or non-hull, output only the hull points in counterclockwise order starting from the lexicographically smallest one.Medium4GeometrySorting+2No attempts yet1s128 MBJudgeable
The Dragon of LoowaterMatch the smallest knight to each dragon head so that every head is cut by a tall enough knight, minimizing total height paid; report failure if impossible.Medium4GreedySorting+2No attempts yet1s128 MBJudgeable
The TripGiven what each student spent, find the minimum total money that must change hands so every student ends up paying the same amount within one cent.Medium4GreedyMath+2No attempts yet1s128 MBJudgeable
CDVIIPair each vehicle's enter records with the immediately following exit, charge per-kilometre tolls by start hour plus fees, and print sorted totals in dollars.Medium4SimulationSorting+2No attempts yet1s128 MBJudgeable
Contest ScoreboardGiven judging queue entries, compute each contestant's solved count and penalty time, then print the standings in rank order.Medium4ImplementationSorting+2No attempts yet1s128 MBJudgeable
Poker HandsCompare two five-card poker hands and decide which ranks higher, handling all standard categories and tie-breaks.Medium4ImplementationSorting+1No attempts yet1s128 MBJudgeable
Is Bigger Smarter?Given pairs of weight and IQ for up to 1000 elephants, find the largest subset whose weights strictly increase while IQs strictly decrease.Medium4Dynamic programmingSortingNo attempts yet1s128 MBJudgeable
The History of the Sith RulersGiven up to 50 rulers with the start and end months of each reign, report which rulers held power during each queried year, in order.Medium4SortingImplementation+2No attempts yet1s128 MBJudgeable
Relative RelativesGiven Ted's age of 100 and each descendant's father name plus the father's age at the child's birth, compute every descendant's age and list them oldest first, ties broken by name.Medium4TreeDFS+2No attempts yet1s128 MBJudgeable
Electronic Document SecurityProcess a log of ACL +, -, = entries in order and print the final rights for each entity, merging entities with identical rights.Medium4ImplementationSimulation+2No attempts yet1s128 MBJudgeable
Frugal SearchGiven a word list and queries of bar-separated terms with unsigned, plus, and minus letters, output the lexicographically smallest matching word or NONE for each query.Medium4StringImplementation+2No attempts yet1s128 MBJudgeable
Programmer, Rank ThyselfRank teams by problems solved, total time, and rounded geometric mean, then print aligned result tables.Medium4SortingMath+2No attempts yet1s128 MBJudgeable
Finding RectanglesList every axis-aligned rectangle that can be formed from up to 26 labeled points, printing the four vertex labels in clockwise order.Medium4Brute forceGeometry+2No attempts yet1s128 MBJudgeable
Perfect CubesFind all quadruples a, b, c, d with 2 <= a <= N, b < c < d, and a^3 = b^3 + c^3 + d^3, printed in sorted order.Medium4Brute forceMath+2No attempts yet1s128 MBJudgeable
Letter Sequence AnalysisRead a text block to EOF and, for each sequence length 1 to 5, list the five most frequent letter sequences with alphabetized ties.Medium4StringHash map+2No attempts yet1s128 MBJudgeable
Underground CablesGiven up to 1000 points, connect them all with straight line segments of minimum total length, with no two segments crossing.Medium4Minimum spanning treeGraph+2No attempts yet1s128 MBJudgeable
Shrew-ologyGiven per-trait dominance rules and adult shrews with sex and trait bits, list every mother-father pair that could produce each juvenile.Medium4Brute forceImplementation+2No attempts yet1s128 MBJudgeable
NineFor each desired microwave time, pick the four-digit MM:SS entry with the most 9s, then the least error under 10%, then lexicographically smallest.Medium4Brute forceImplementation+2No attempts yet1s128 MBJudgeable
A Day at the RacesRead a season of Grand Prix results and print final standings for drivers and teams, breaking ties by countback and then lexicographically.Medium4SimulationSorting+2No attempts yet1s128 MBJudgeable
Phone ListGiven a list of distinct phone numbers, decide whether any number is a prefix of another.Medium4TrieString+1No attempts yet1s256 MBJudgeable
Who Is the Winner?Given a log of contest submissions with verdicts and times, compute each contestant's solved count and ICPC-style penalty score, then output them ranked.Medium4ImplementationSorting+2No attempts yet1s128 MBJudgeable
Pythagorean TriplesGiven up to 50 distinct positive integers, list all Pythagorean triples x<y<z present in the set, sorted lexicographically, or report that none exist.Medium4Hash mapMath+2No attempts yet1s128 MBJudgeable
Shut the Box IGiven a target sum and a sorted list of open card values, choose the subset summing to the target that is lexicographically largest when sorted.Medium4BacktrackingArray+2No attempts yet1s128 MBJudgeable
Open IntervalsGiven up to 50 open intervals per test case, pick the largest subset where no two intervals overlap, counting touching endpoints as compatible.Medium4GreedySorting+2No attempts yet1s128 MBJudgeable
Stacking BooksGiven a stack of book sizes, find the fewest moves that pull one book to the top (only when the part above it is non-decreasing) to sort the stack.Medium4GreedySorting+2No attempts yet1s128 MBJudgeable
The Best PizzaChoose any subset of toppings, each costing B, to maximize total calories divided by total price, and print the floor of that ratio.Medium4GreedySorting+2No attempts yet1s128 MBJudgeable
PizzaGiven store positions on a circular road and delivery points, sum the distance from each point to its nearest store.Medium4Binary searchArray+1No attempts yet2s128 MBJudgeable
The Longest StaircaseGiven k cards with distinct values 1 to n plus one blank card (0) you can set to any value, find the longest run of consecutive integers formable.Medium4SortingTwo pointers+1No attempts yet1s128 MBJudgeable
Product Order TotalsSum the order quantities for each distinct product name, then print each product with its total sorted by name length, then alphabetically.Medium4Hash mapSorting+2No attempts yet1s128 MBJudgeable
King's PokerGiven a three-card poker hand, print the weakest set or pair that beats it, or * if none exists.Medium4ImplementationSorting+2No attempts yet1s128 MBJudgeable
Average and MedianFor each pair A and B, find the smallest integer C so that the average and the median of A, B, C are equal.Medium4MathSorting+2No attempts yet1s128 MBJudgeable
Soccer LeagueRead a list of soccer match results and output the league table sorted by points, then goal difference, then first appearance in the input.Medium4Hash mapSorting+2No attempts yet1s128 MBJudgeable
Cow CrossingsCount cows whose straight crossing paths intersect no other cow, where two paths cross exactly when the start and end left-to-right orders differ.Medium4SortingArray+2No attempts yet1s128 MBJudgeable
GiftGiven each friend's item price and shipping cost and one coupon that halves a single item price, find the most gifts buyable within budget B.Medium4SortingGreedy+2No attempts yet1s128 MBJudgeable
Haybale StackingAdd one bale to every stack in each given range, then report the median height among all N stacks.Medium4Prefix sumArray+2No attempts yet1s128 MBJudgeable
Moo SickFind every window of C consecutive notes whose sorted, min-subtracted shape matches the given chord's shape.Medium4ArraySorting+2No attempts yet1s128 MBJudgeable
Music NotesGiven note durations that divide a timeline into consecutive intervals, answer queries asking which 1-based note covers a given time. Use prefix sums and binary search.Medium4Prefix sumBinary search+2No attempts yet1s128 MBJudgeable
Selfish GrazingGiven N intervals, find the maximum number of intervals that can be chosen so that no two of them overlap.Medium4GreedySorting+2No attempts yet1s128 MBJudgeable
Find the Playing NoteGiven note durations that partition a timeline, answer queries asking which note covers a given beat by locating the prefix sum that brackets it.Medium4Prefix sumBinary search+2No attempts yet1s128 MBJudgeable
Chocolate BuyingGiven N chocolate types with a cost per piece and a number of cows wanting each, spend a budget B to satisfy as many cows as possible.Medium4GreedySorting+2No attempts yet1s128 MBJudgeable
Time ManagementGiven each chore's duration and deadline, find the latest start time that lets John finish all chores before their deadlines, or print -1.Medium4GreedySorting+2No attempts yet1s128 MBJudgeable
ScrabbleGiven a tray of T letters (some blanks that score 0) and an alphabetized dictionary, pick the highest-scoring dictionary word formable from the tray, breaking ties alphabetically.Medium4StringGreedy+2No attempts yet1s128 MBJudgeable
O Those FadsCows join a fad when its attractiveness L reaches their resistance; each joiner raises L by K. Count the final number of participants.Medium4SortingGreedy+2No attempts yet1s128 MBJudgeable