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
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Election TimeEach cow has first round votes A and second round votes B; the top K by A advance, then the one with the largest B among them wins. Output the winner's index. | Medium4 | SortingArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Hungry CowsGiven a sequence of N cow brands, find the length of the longest strictly increasing subsequence in the given order. | Medium4 | Dynamic programmingBinary search+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Bale TowerGiven up to 20 bales with distinct widths and breadths, find the longest chain where each bale is strictly smaller than the one below it. | Medium4 | Dynamic programmingSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Buy One Get One FreeBuy all N high quality bales, then pair as many of the M low quality bales as possible so each free bale is strictly smaller than its distinct high quality partner. Output N plus the maximum number of pairs. | Medium4 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ArgusGiven queries that each fire every Period seconds starting at time Period, output the Q_num of the first K results, breaking ties by smaller Q_num. | Medium4 | HeapSimulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Team ArrangementPick the lowest-numbered players for each role to match a formation, then name the selected player with the most years served as captain. | Medium4 | SortingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Scramble SortSort words case-insensitively and integers numerically within each comma-separated list while keeping each element's original type position. | Medium4 | SortingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Inventory MaintenanceProcess new, delete, buy, sell, and report commands over a small inventory, printing sorted item tables with exact dollar amounts and profit since the last report. | Medium4 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Making the GradeCompute each student's average after dropping the lowest test if more than two tests exist, then derive class mean and standard deviation, apply bonus and attendance letter-grade rules, and print the class GPA. | Medium4 | ImplementationMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Etaoin ShrdluConcatenate each sample's lines, count overlapping adjacent character pairs, then print the five most frequent digrams with their counts and rounded relative frequencies. | Medium4 | StringHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Stock ExchangeFor each issuer, for every bid output the agents on the opposite side whose price could match it, in input order. | Medium4 | ArrayImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Calendar of EventsGiven old and new schedules of N meetings, simulate prefix reversals that place each target day and list the request sizes. | Medium4 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Happy WormCount maximal horizontal and vertical runs of empty cells that are at least 2 long in a field with stones. | Medium4 | SortingImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Keep on Truckin'Given fixed and added motel distances, count overnight stop sequences where each day covers between A and B km. | Medium4 | Dynamic programmingArray+1 | No attempts yet | 1s | 128 MB | Judgeable |
| BoxesFor each item, find the standard box with the smallest volume that can contain it after 90-degree rotations, or report that none fits. | Medium4 | SortingImplementation | No attempts yet | 1s | 128 MB | Judgeable |
| Floor PlanGiven a grid of walls and floor cells, count connected rooms, sort them by size, floor as many of the largest rooms as the wood supply allows, and report how many rooms got flooring plus the leftover wood. | Medium4 | DFSSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Common WordsFor each data set, count word frequencies, find the k-th most common words, and print them alphabetically after a title line. | Medium4 | Hash mapSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Maximum DistanceGiven two non-increasing arrays, find the largest j - i such that j >= i and Y[j] >= X[i]. | Medium4 | ArrayTwo pointers+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Bad CowtractorsGiven an undirected weighted graph, find a spanning tree of maximum total edge cost, or report -1 if no spanning tree exists. | Medium4 | Minimum spanning treeGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Similar TrianglesGiven two triangles by integer vertex coordinates, decide whether they are similar and if so print the squared similarity coefficient as a reduced fraction p/q, else print -1. | Medium4 | GeometryMath+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Geocaching CoordinatesGiven a coordinate formula with placeholder letters and each letter's allowed digit values, print every distinct resulting coordinate in lexicographic order. | Medium4 | Brute forceImplementation+1 | No attempts yet | 1s | 1024 MB | Judgeable |
| Paper StripsStrips are glued on a black strip in order, each hiding what lies below; print the visible color and length of each final segment, merging equal neighbors. | Medium4 | ImplementationArray+2 | No attempts yet | 6s | 1024 MB | Judgeable |
| Cosmic AssemblyFind integer coordinates (x, y, z) minimizing the sum of Manhattan distances to N given points, breaking ties lexicographically. | Medium4 | MathSorting+1 | No attempts yet | 1s | 1024 MB | Judgeable |
| BossesGiven a graph of projects where the lower-numbered endpoint is the boss, find the max number of edges so every vertex has at most one boss, minimizing cancellations. | Medium4 | GraphGreedy+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Rotten RopesGiven the tear-off weights of n ropes, find the maximum object weight that a chosen subset can carry so that no rope in the subset breaks. | Medium4 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Grandpa's Other EstateGiven up to 100 points and a square side length r, place the axis-aligned square to cover as many points as possible, counting border points as inside. | Medium4 | ArraySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Ancient CipherGiven two equal-length strings of capital letters, decide whether the first can be obtained from the second by a substitution cipher followed by a permutation. | Medium4 | StringSorting+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Disk TreeGiven full directory paths, rebuild the tree and print every directory name on its own line, indented by depth, with siblings in ASCII order. | Medium4 | TrieSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| RatingMerge two contest result tables into one ordering by the rules: teams present in both contests are ranked by the sum of their two places, and single-contest teams are placed where the rules allow. | Medium4 | ImplementationSorting | No attempts yet | 1s | 128 MB | Judgeable |
| Acid TextParse a simplified CSS style sheet, resolve each graphic's absolute or relative position, then composite the graphics by layer order into one canvas with a black background. | Medium4 | ImplementationSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| BrainmanGiven a sequence, find the minimum number of adjacent swaps needed to sort it in non-decreasing order; this equals the number of inversions. | Medium4 | Divide and conquerSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Ranking ListBuild a contest scoreboard: rank teams by solved problems then total time, with ties sharing a rank and listed alphabetically. | Medium4 | SortingImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Gathering PointsGiven M points on an N by N grid, find a cell minimizing the sum of Manhattan distances from all points to it. | Medium4 | MathSorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Dreadful DeadlinesGiven n jobs with durations and deadlines, find the latest start time from which all jobs can still be finished by their deadlines. | Medium4 | GreedySorting | No attempts yet | 1s | 128 MB | Judgeable |
| People in the CompanyGiven access-card records of enter and leave events, list the names of employees who are currently inside the office, sorted in reverse alphabetical order. | Medium4 | Hash mapSorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| To Eat or Be EatenCount pairs where an A creature is strictly larger than a B creature, given two lists of sizes. | Medium4 | SortingTwo pointers+2 | No attempts yet | 1s | 256 MB | Judgeable |
| HotelFor each team, pick the cheapest hotel in its bed-size category that can hold the team, breaking ties by larger bed size and then input order. | Medium4 | ImplementationBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Minimum SwapsFor each string of distinct lowercase letters, find the minimum number of arbitrary swaps needed to sort it into alphabetical order. | Medium4 | SortingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Sales ReportGiven N sale records of item, salespoint, and quantity, print a table of totals with items as columns and salespoints as rows. | Medium4 | SortingHash map+2 | No attempts yet | 4s | 128 MB | Judgeable |
| CanoesGiven a canoe weight limit and each participant's weight, find the minimum number of two-person canoes needed to carry everyone. | Medium4 | GreedyTwo pointers+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TrianglesGiven a list of segment lengths, find the largest perimeter of a non-degenerate triangle formed by three of them, or print NIE if none exists. | Medium4 | SortingGreedy | No attempts yet | 1s | 128 MB | Judgeable |
| Grid Shading PuzzleGiven per-row and per-column shaded counts for an n by n board, decide whether a valid 0/1 board exists. | Medium4 | GreedySorting | No attempts yet | 1s | 128 MB | Judgeable |
| CoinsCount the ways to place coins of sizes 1 to n into slots with capacities a_i so every coin fits, modulo 1000000007. | Medium4 | SortingCombinatorics+1 | No attempts yet | 1s | 512 MB | Judgeable |
| SoldiersCount the monotonic lineups of n distinguishable soldiers by height and output the last four digits of the count. | Medium4 | CombinatoricsMath+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Dollars and EurosSelect n of 2n-1 wallets with the fixed dollar-sorted rule so dollars and euros each reach half the totals. | Medium4 | SortingSimulation | No attempts yet | 1s | 128 MB | Judgeable |
| Indiana Jones Among the ZombiesEvery turn each zombie steps toward chamber 1 along a shortest path, and you find the first turn with more than K arrivals or confirm Indiana survives. | Medium4 | BFSShortest path+1 | No attempts yet | 6s | 128 MB | Judgeable |
| Exam PreparationSchedule preparation days before each exam day and find how many days before the earliest exam study must start. | Medium4 | GreedySorting | No attempts yet | 1s | 128 MB | Judgeable |
| Guess the WordGiven each uppercase word, output the next distinct arrangement of its letters in dictionary order, or the word itself when it is already last. | Medium4 | StringSorting | No attempts yet | 1s | 128 MB | Judgeable |
| Lucky LightCount the lighted regions on the x-axis that lie outside the shadows a point light casts from the given segments. | Medium4 | GeometryIntervals+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Starship Hakodate-maruGiven a limit up to 151200, find the largest amount that splits into a cube plus a tetrahedral number. | Medium4 | Brute forceSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Hotel ReservationsFind the fewest rooms that fit all reservations when a room freed at checkout needs C more minutes of cleaning. | Medium4 | IntervalsSorting+2 | No attempts yet | 2s | 128 MB | Judgeable |
| A Voting ProtocolSimulate ranked-ballot rounds where each voter backs the top unpicked candidate and the top vote getters fill k seats with alphabetical tie breaks. | Medium4 | SimulationSorting | No attempts yet | 1s | 128 MB | Judgeable |
| Network PlanningPick M cities for new stations to maximize total supply, where each station covers 70 percent of its own demand plus 10 percent of each neighbor's. | Medium4 | GreedySorting+1 | No attempts yet | 2s | 64 MB | Judgeable |
| Rental car management troubleProcess each spy's rental events in order and print spies by name with the total bill or INCONSISTENT for a broken record. | Medium4 | SimulationImplementation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| A site just for programming contestsBuy each plot in decreasing price order, one per year, and report the total cost or Too expensive when it exceeds the budget. | Medium4 | GreedySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Handing Out BooksAssign each applicant at most one distinct book numbered within their requested interval to maximize the number of satisfied applicants. | Medium4 | GreedyIntervals+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Area Between Outer Hull and Inner HullCompute the convex hull of up to 1000 points twice, removing corner vertices after the first pass, and print the difference of the two polygon areas. | Medium4 | GeometrySorting | No attempts yet | 5s | 128 MB | Judgeable |
| uHuntProcess judge submissions in order and after each one report the leader's time and the submitter's rank by personal best, ignoring non-improving resubmissions. | Medium4 | SortingHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| WalkingWalkers start at distinct times with fixed speeds, and a later starter who arrives earlier befriends the other; find the largest group where every pair meets. | Medium4 | Dynamic programmingSorting | No attempts yet | 1s | 128 MB | Judgeable |
| Bessie Slows DownBessie runs 1000 metres with speed 1/(k+1) after k slowdowns triggered by time or distance events, and the total time is rounded to the nearest second. | Medium4 | SimulationSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Word ExtractionClean each input line by lowercasing it, joining or splitting words at punctuation by neighbor rules, then print the sorted unique words per line. | Medium4 | StringSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Auto-CompleteThe app prints the original index of the K-th dictionary word with each query prefix in alphabetical order, or -1. | Medium4 | TrieSorting | No attempts yet | 1s | 128 MB | Judgeable |
| Watering the FieldsConnect all fields with pipes costing at least C while minimizing total squared distance, or report -1 when impossible. | Medium4 | Minimum spanning treeUnion-find+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Lazy Polar BearChoose a point on the line so the buckets within distance K of it hold the most ice in total. | Medium4 | Sliding windowSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Counting InversionsCount the pairs in a permutation of 1 to n where a larger number stands before a smaller one. | Medium4 | Divide and conquerSorting | No attempts yet | 1s | 256 MB | Judgeable |
| RummikubFrom 14 tiles, find the highest scoring group or run, break ties by sorted tile order, and print it with its score. | Medium4 | Brute forceSorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| UnitsGiven N-1 pairwise conversion relations, sort the units from largest to smallest and print the chain with the largest unit set to 1. | Medium4 | GraphSorting+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Pangaea 1After each added road, compute the cheapest total length connecting all cities and XOR the m totals per test case. | Medium4 | Minimum spanning treeUnion-find+1 | No attempts yet | 20s | 256 MB | Judgeable |
| Classroom assignmentGiven N class time intervals, find the smallest number of rooms so overlapping classes never share a room. | Medium4 | GreedySorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Troop MovementFind the route between two cities whose narrowest road is as wide as possible and report that width. | Medium4 | Minimum spanning treeUnion-find+1 | No attempts yet | 2s | 256 MB | Judgeable |
| City PlanningRebuild the smallest one-way road network matching a given reachability matrix, with cycles inside mutually reachable groups and cover edges between groups. | Medium4 | GraphMatrix+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Kindergarten ExcursionCount the minimum adjacent swaps needed to reorder a string of 0s, 1s, and 2s into sorted order. | Medium4 | SortingPrefix sum | No attempts yet | 1s | 256 MB | Judgeable |
| Dr Who's BanquetBuild a chat graph whose vertex degrees equal the given wishes with the stated greedy construction, or print fail. | Medium4 | GraphGreedy+1 | No attempts yet | 1s | 256 MB | Judgeable |
| CompetitionFind the fewest seat changes that let Alice and Bob solve every solvable problem in contest order. | Medium4 | GreedySorting | No attempts yet | 1s | 256 MB | Judgeable |
| TriangleDecide whether two given integer-sided triangles are congruent right triangles that can form a rectangle split along its diagonal. | Medium4 | GeometryMath+1 | No attempts yet | 2s | 256 MB | Judgeable |
| ExcellencePair all students into teams of two so the smallest team rating sum is as large as possible. | Medium4 | GreedySorting+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Points on a SegmentCount how many of N distinct points fall inside each of M closed intervals on a line. | Medium4 | Binary searchSorting | No attempts yet | 1s | 256 MB | Judgeable |
| High Card WinsAssign each of Bessie's N cards to a round against Elsie's fixed play order to win the most rounds with the higher card. | Medium4 | GreedySorting | No attempts yet | 2s | 512 MB | Judgeable |
| Angry Cows (Silver)Find the smallest integer blast radius R so K intervals of length 2R cover all N hay bale positions on a line. | Medium4 | Binary searchGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Mileage Course RegistrationGiven each course rival bids and capacity, bid 1 to 36 points per chosen course, winning ties, to take the most courses with m points. | Medium4 | GreedySorting | No attempts yet | 1s | 128 MB | Judgeable |
| Sums of Sums (Small)You sort every contiguous subarray sum of an array and answer range sums over the sorted list. | Medium4 | SortingPrefix sum | No attempts yet | 5s | 512 MB | Judgeable |
| Packing Files onto DiscsPack all files onto the fewest discs of capacity X with at most two files per disc. | Medium4 | GreedyTwo pointers+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Data PackingPack files onto discs holding at most two files of total size X using the fewest discs. | Medium4 | GreedyTwo pointers+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Closing the Loop (Small)Pick equal numbers of red and blue segments with the largest lengths and subtract one centimeter per knot to get the longest alternating loop. | Medium4 | GreedySorting | No attempts yet | 5s | 512 MB | Judgeable |
| Minimum Keypresses for Text EntryAssign each letter to a key and a position so that total presses, the frequency times the position, is minimized. | Medium4 | GreedySorting+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Minimum Scalar Product (Small)Permute two vectors to minimize their dot product and print the minimum. | Medium4 | SortingGreedy+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Minimum Scalar Product (Large)Reorder the coordinates of two equal-length integer vectors so their scalar product is as small as possible, and report that minimum for each test case. | Medium4 | SortingGreedy+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Train Timetable (Small)Given a day's timetable and a turnaround time, find the minimum number of trains that must start the day parked at each of the two stations. | Medium4 | GreedySorting+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Train Timetable (Large)Given each train's departure and arrival times plus a turnaround time, find the minimum trainsets needed at stations A and B to run the timetable. | Medium4 | GreedySorting+1 | No attempts yet | 5s | 512 MB | Judgeable |
| A Restaurant for BearsEach arriving bear takes the smallest empty chair at or above its wanted number that is at least d away from every seated bear. | Medium4 | ImplementationGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Correcting CheeseburgersGiven a permutation of 1 to n, find the minimum number of four-part shuffles (c,a,d,b) needed to sort it into 1,2,...,n. | Medium4 | BFSBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| HoneyGiven N hives with honey amounts, a pot of capacity M, and at most K trips, maximize the total honey collected. | Medium4 | GreedySorting+1 | No attempts yet | 1s | 64 MB | Judgeable |
| Prefix ArraySort all prefixes of a string lexicographically and print the end index of each prefix in that order. | Medium4 | SortingString+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Q-indexGiven n citation counts, find the largest k such that at least k papers have k or more citations and the rest have at most k. | Medium4 | SortingArray | No attempts yet | 1s | 512 MB | Judgeable |
| RearrangeChoose an ordering of the array, subtract elements from n in that order until n drops to 0 or below, and report the smallest achievable result. | Medium4 | GreedySorting | No attempts yet | 1s | 512 MB | Judgeable |
| Justice Rains from Above!Given each robot's coordinates and missile speed, output the robot indices sorted by hit time (distance divided by speed), breaking ties by smaller index. | Medium4 | SortingMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Sticky SituationGiven N stick lengths, decide whether some three of them can form a triangle with positive area. | Medium4 | SortingGreedy | No attempts yet | 2s | 512 MB | Judgeable |
| Stick GameGiven counts of sticks of distinct lengths, find the maximum number of rectangles (squares allowed) that can be built using each stick at most once. | Medium4 | GreedySorting | No attempts yet | 2s | 512 MB | Judgeable |
| Minimum overtakesGiven a starting order and a finishing order of up to 24 cars, print the minimum number of adjacent swaps that turn the start into the finish. | Medium4 | SortingArray+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Mismatched SocksGiven counts of socks per color, find the maximum number of pairs where each pair uses two different colors and every sock is in at most one pair. | Medium4 | GreedyMath+1 | No attempts yet | 2s | 512 MB | Judgeable |