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,741 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Triangle SubsequenceGiven a sequence, find the longest subsequence where every triple of elements satisfies the triangle inequality. | Medium5 | SortingTwo pointers+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Counting Crossing EdgesGiven M cross edges between two labeled vertex sets of size N, count how many unordered pairs of edges cross each other. | Medium5 | SortingDivide and conquer+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Sungji's Birthday PartyGiven N students each requiring a minimum number of other attendees to be satisfied, find the smallest group of students that can be invited so every invited student's requirement is met. | Medium5 | GreedySorting+1 | No attempts yet | 2s | 128 MB | Judgeable |
| City Division PlanSplit a connected weighted graph into two connected subvillages by removing edges so that the total remaining maintenance cost is minimized. | Medium5 | Minimum spanning treeUnion-find+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Running MedianGiven integers one by one, output the running median (lower of the two middles when count is even) after each insertion. | Medium5 | HeapSorting+1 | No attempts yet | 0.1s | 128 MB | Judgeable |
| Dasom's Shoe StoreChoose which discount coupons to buy, given their price and 1-3% discount rate, to minimize the total cost paid for a shoe. | Medium5 | GreedySorting+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Convex HullCompute the convex hull of up to 100,000 points and count only the hull's true vertices, excluding collinear boundary points. | Medium5 | GeometrySorting+1 | No attempts yet | 2s | 128 MB | Judgeable |
| LaserGroup buildings by the ray from the origin, sort each group by distance, and find buildings whose laser is blocked by a closer, equally tall or taller building. | Medium5 | GeometrySorting+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Number GroupingGiven N integers, decide which pairs to multiply instead of add so that the resulting total sum is maximized. | Medium5 | GreedySorting+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Balanced LineupGiven fans sorted by x-coordinate with a gender bit each, find the longest contiguous segment that has an equal number of men and women. | Medium5 | Prefix sumHash map+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Designing a High-Speed Rail NetworkGiven a cost matrix where negative values mark already-built rail lines, compute the minimum spanning tree cost forcing existing lines and list the new lines to build. | Medium5 | Minimum spanning treeUnion-find+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Assigning RanksAssign each of N students a unique rank from 1 to N to minimize the total absolute difference from their expected ranks. | Medium5 | GreedySorting | No attempts yet | 2s | 256 MB | Judgeable |
| Covering a SegmentGiven up to 100,000 segments on a line, find the minimum number needed to fully cover [0, M], or output 0 if impossible. | Medium5 | GreedyIntervals+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Interval Containing the Most OthersGiven N intervals with unique endpoints, find the maximum number of intervals strictly contained inside a single interval. | Medium5 | SortingBinary search+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Super 12Simulate a rugby league by computing bonus points, sorting standings after every full round, and printing formatted tables. | Medium5 | SimulationSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Similar WordsGiven up to 20,000 distinct words, find the pair with the longest common prefix, breaking ties by input order. | Medium5 | StringSorting+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Sum of Three NumbersGiven up to 1000 distinct integers, find the largest set element expressible as a sum of three elements (repeats allowed). | Medium5 | Two pointersSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Placing a Basketball HoopFind the integer point minimizing the sum of weighted Manhattan distances to given weighted points, breaking ties by smallest x then smallest y. | Medium5 | MathSorting+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Pipe CuttingGiven M long pipes and N required short pipe lengths, compute the maximum number of short pipes that can be cut from the long pipes. | Medium5 | GreedySorting | No attempts yet | 2s | 128 MB | Judgeable |
| Three SolutionsGiven up to 5000 distinct integers, find three distinct values whose sum is closest to zero, using sorting and two-pointer scanning. | Medium5 | Two pointersSorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Electric WiresGiven wires connecting positions on two poles, find the minimum removals so remaining wires never cross, equivalent to n minus the longest increasing subsequence. | Medium5 | Dynamic programmingBinary search+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Minimum Cost for Restaurant OrdersGiven first-dish and later-dish prices for N dishes, compute for every k the minimum total cost of ordering exactly k dishes. | Medium5 | GreedySorting+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Number GameAfter each new pair of numbers arrives, pair sorted A values with reverse sorted B values and output the minimum possible maximum sum, updating online for each round. | Medium5 | GreedySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| AvogadroGiven a 3xN table where row 1 is a permutation of 1..N, find the minimum number of columns to delete so the three rows can be made identical after sorting each row. | Medium5 | GreedyArray+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Concert Rest ScheduleSchedule N members' fixed-length rest intervals within a T-minute concert so that at most two intervals overlap at any moment. | Medium5 | GreedyIntervals+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Non-Intersecting CirclesGiven N circles centered on the x-axis, find the minimum number to remove so no two remaining circles overlap, essentially an interval scheduling problem. | Medium5 | GreedyIntervals+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Cinema InvitationGiven each friend's minimum required number of other attending friends, find the smallest subset size satisfying everyone invited's threshold. | Medium5 | GreedySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| JANICAReconstruct running leader times from cumulative differences over two ski rounds to find the top three finishers by total time. | Medium5 | SimulationSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Safe LockGiven N positions on a circular ring of size 10,000,000, find the minimum total distance to move all points to a common position, minimizing sum of circular distances. | Medium5 | SortingPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Printed Circuit BoardGiven N wires each connecting a bottom-edge point to a top-edge point, find the minimum number of layers so that crossing wires never share a layer, which reduces to finding the maximum count of pairwise-crossing wires. | Medium5 | SortingBinary search+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Matching BinsGiven a sequence of bin sizes, find the largest K such that the first K bins can each be matched to a distinct larger bin among the following K bins. | Medium5 | Binary searchGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Hands of PokerGiven a five card poker hand, compute its unique rank value from 1 to 7462 that orders all possible hands consistently. | Medium5 | SortingHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Defense of a KingdomGiven tower positions that block whole rows and columns on a grid, find the area of the largest rectangle of cells left undefended. | Medium5 | SortingGreedy+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Key to SuccessGiven n existing coin values and m coins to add freely, choose the added values to maximize the smallest positive integer not representable as a subset sum. | Medium5 | GreedyMath+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Simple PolygonOrder given points into a specific simple polygon by picking a bottom-most anchor and sorting the rest by polar angle with a special tie-break for collinear groups. | Medium5 | GeometrySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Maximum SumGiven n boxes of numbered balls, pick at most one ball per box in order to form a non-decreasing sequence with maximum possible sum. | Medium5 | Dynamic programmingSorting | No attempts yet | 1s | 128 MB | Judgeable |
| Windmill AnimationSimulate a line rotating counter-clockwise about a pivot point, switching pivot whenever the line hits another of the given points, and report the first S pivots. Repeat for each dataset. | Medium5 | GeometrySimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Emma Loves PartiesGiven parties as hourly intervals, find the most Emma can attend if she stays at least 30 minutes at each one. | Medium5 | GreedySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| BalloonsAllocate balloons from two rooms to teams with given distances so total delivery distance is minimized. | Medium5 | GreedySorting | No attempts yet | 1s | 128 MB | Judgeable |
| Buying GasChoose the fewest gas stations to stop at so the car never runs out of gas over a trip of length d with tank range 10n. | Medium5 | GreedySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Frosh WeekGiven n distinct student numbers in a line, find the minimum number of adjacent swaps needed to sort them into increasing order. | Medium5 | SortingDivide and conquer+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Open SourceCount distinct students per project, drop any student who signed up for more than one project, then sort projects by count descending and name. | Medium5 | Hash mapSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Tour de FranceGiven front and rear sprocket tooth counts, find the maximum ratio between adjacent attainable drive ratios n/m across all pairs. | Medium5 | SortingMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Team RankingsGiven up to 100 rankings of five teams, find the ranking minimizing the sum of pairwise-order disagreements, breaking ties alphabetically. | Medium5 | Brute forceCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Genealogical ResearchProcess birth and death records, then answer ancestor and descendant queries by printing the family tree recursively with dates. | Medium5 | RecursionTree+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Hippity HopscotchOn an n by n grid of penny stacks, starting at (0,0) and jumping up to k cells in a row or column to a strictly larger stack, find the maximum total collected. | Medium5 | Dynamic programmingSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Games R UsGroup users into equivalence classes by identical directory access sets, then report classes of size 2 or more. | Medium5 | Hash mapSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Know When to Hold ThemRank a set of five-card poker hands from most to least valuable, using nine standard hand categories and their tie-breakers. | Medium5 | SortingImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Extent of the ProblemSimulate RADDD's two-step defragmentation passes over disk blocks and output the final extent layout of every file. | Medium5 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Blue JeansGiven up to 10 DNA strings of length 60, find the longest substring that appears in all of them, breaking ties alphabetically, or report none of length 3 or more. | Medium5 | StringBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Index GenerationParse markers in a multi-page document, collect page references for primary and secondary index entries, and print the index sorted case-insensitively. | Medium5 | StringSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Sum It UpGiven a target and up to 12 numbers, list every distinct subset sum equal to the target, sorted in decreasing lexicographic order. | Medium5 | BacktrackingSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| BalloonsAssign each team's balloons from rooms A and B, respecting supply limits, to minimize total travel distance. | Medium5 | GreedySorting | No attempts yet | 1s | 128 MB | Judgeable |
| Auctions R UsSimulate one day of auctions: process auctions by end time, deduct each winning bid from the bidder's balance, and report winners or unmet reserves. | Medium5 | SimulationSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Tangled in CablesCompute the minimum spanning tree of a town map and compare its total length against the available spool of cable. | Medium5 | Minimum spanning treeGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Emergency RoomSimulate an emergency room where doctors pick the waiting patient with the highest-priority next treatment, and report each patient's release time. | Medium5 | SimulationHeap+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Stock PricesFor each test case, report the days with the k1 lowest prices (days ascending) and the k2 highest prices (days descending), breaking ties by a stated rule. | Medium5 | SortingGreedy+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Dividing the LandFor each test case, split N cities with K-1 evenly spaced vertical or horizontal cuts, avoid cuts through cities, and print the minimum average |count - N/K| as a reduced fraction. | Medium5 | SortingMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Gift from the Goddess of ProgrammingEach log line records the entrance or exit of a visitor or the goddess (ID 000). Find the visitor who spends the most time at the altar while the goddess is present. | Medium5 | SimulationSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Analyzing Login/Logout RecordsGiven login and logout records on PCs, compute for each query how many minutes a student used at least one PC during a time interval. | Medium5 | IntervalsSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cut the CakeSimulate n vertical cuts on a rectangular cake, tracking each rectangular piece and reassigning ids by area, then print all final piece areas sorted. | Medium5 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Dirty DrivingGiven distances to n cars ahead and a constant p, find the minimum gap to the nearest car so every car x ahead is at least p*(k+1) away, where k counts cars between. | Medium5 | SortingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| ShopaholicGiven item prices, group them into triples so that the cheapest item in each triple is free, and maximize the total discount. | Medium5 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Foreclosure BoroughFor each polygon borough, compute the percentage of houses inside it that are in foreclosure, sort boroughs by rate, and print two-decimal rates with tie-breaking by borough number. | Medium5 | GeometrySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| The Perfect AlibiEach witness gives a suspect, a place, and a time interval; conflicting pairs are discarded, and we list suspects with no surviving witness covering the crime time. | Medium5 | ImplementationSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Problem-Free Problem SetGiven N problems, each covering some of M required algorithms, find the smallest subset of problems covering all M algorithms, breaking ties by lexicographic order of problem names. | Medium5 | Bit manipulationBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Overlap!Given each course's exam day and time slot and each student's course list, count students who have two or more finals that overlap in time. | Medium5 | ImplementationSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Study DaysDistribute H study hours among n courses, each with 10 grade thresholds, to maximize the average grade point, rounded to two decimals. | Medium5 | Dynamic programmingArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Yes or No?Pick between l and r questions to answer Yes, maximizing the sum of per-question expected correct probabilities, and report the maximum expectation to two decimals. | Medium5 | Dynamic programmingSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Throw a Party!!!Given friends' home regions with drunk/sober status and cars with capacity bound to regions, compute how many friends cannot be seated (each car needs a sober driver). | Medium5 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Time Is MoneyWe choose N-1 links forming a spanning tree minimizing SumTime*SumMoney, where each edge has a time and a money cost. | Medium5 | Minimum spanning treeGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Jumbled LettersFor each query, find the longest dictionary word that can be formed using the query letters at most once, breaking ties alphabetically, or report IMPOSSIBLE. | Medium5 | StringHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Northwest WindCount pairs of islands where one can sail to the other moving only east or south (both coordinates monotone between the two points). | Medium5 | SortingPrefix sum+2 | No attempts yet | 1s | 256 MB | Judgeable |
| FloodgatesEach gate drains Fi per hour at fixed cost Ci when opened. For each query (V, T), find the minimum total cost whose combined capacity Fi*T covers V. | Medium5 | Brute forceGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| JolloGiven the Princess's three cards and two of the Prince's, find the smallest unused third card that lets the Prince win at least two rounds against any order of play. | Medium5 | Brute forceGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Klingon Course LevelsPick a score threshold T that splits every division into basic and advanced groups, minimizing the sum over divisions of |basic - advanced|. Output that minimum. | Medium5 | SortingPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Pole PositionGiven the current race order of N cars with each car's position change from the start, reconstruct the starting grid or report that no valid grid exists. | Medium5 | ArraySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Child PlayGiven domino-like slabs, orient and order them so both rows sum equally, discarding one slab only if necessary and preferring the smallest minimum half. | Medium5 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| IslandsGiven heights along a line, find the maximum number of separate exposed segments at any single rising water level. | Medium5 | SortingArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Skewed SortingApply a recursive swap procedure on 2^N cows, comparing equal-length halves as base-2^N numbers, and report total distance moved plus final order. | Medium5 | Divide and conquerRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Buying Feed, IIPick up to K pounds of feed from stores along a line, paying each store's price plus transport cost of distance carried, and minimize the total. | Medium5 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Sand CastleGiven current merlon heights and a multiset of target heights in any order, pair them to minimize the total cost of raising and lowering, where raising costs X and lowering costs Y. | Medium5 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Privileged CowsGiven a sequence of 1s, 2s, and 3s, find the minimum number of arbitrary swaps needed to group all 1s first, then all 2s, then all 3s. | Medium5 | GreedyArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SunscreenEach cow accepts an SPF interval, each bottle has an SPF value and capacity; assign bottles to maximize the number of cows covered. | Medium5 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Radar InstallationEach island on the sea side of a line must be covered by radars of reach d placed on the line, so find the minimum number of placements or report -1 if some island is unreachable. | Medium5 | GreedyIntervals+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Pearl PairingGiven counts of each pearl color, output the canonical pairing that matches the pearl at position i with the pearl at position i + N/2 in sorted order. | Medium5 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Fence RepairSplit one board into N planks of given lengths; each cut costs the length of the piece being cut, so find the minimum total cost. | Medium5 | GreedyHeap+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Anagram GroupsGroup distinct words that are anagrams of each other, then print the five largest groups sorted by size and smallest word. | Medium5 | Hash mapSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Rhinoceros BeetleGiven shared community cards and each player's two hole cards, evaluate every player's best five-card poker hand and print the indices of all winners. | Medium5 | ImplementationSorting+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Peculiar PrimesList every integer in [X, Y] whose prime factors all belong to a given set of at most 10 primes, or print none. | Medium5 | BacktrackingMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Building a New DepotGiven the corner posts of an axis-aligned rectilinear polygon (listed in no particular order), reconstruct the polygon and compute its total perimeter. | Medium5 | GeometrySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Perfect SymmetryGiven a set of distinct integer points, decide whether it has a center of symmetry and, if so, print that center to one decimal place. | Medium5 | Hash mapGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SnowflakesGiven up to 100,000 snowflakes of six arm lengths each, find whether two are identical under cyclic rotation or reversal. | Medium5 | Hash mapString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| CN TowerGiven angles of landmarks around a rotating restaurant that turns 360 degrees every 72 minutes, find the shortest time window covering all distinct angles. | Medium5 | SortingTwo pointers+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Pinball RankingGiven scores in play order, compute each game's rank as one plus the number of earlier-or-later scores strictly above it, then output the average rank as a reduced fraction. | Medium5 | Binary searchSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| King Thrór's GoldCount the ways to choose exactly k distinct bar values summing to T, and list all solutions in lexicographic order when there are at most 20. | Medium5 | Dynamic programmingBacktracking+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Go-KartFind the smallest fuel-tank capacity that lets a kart refuel at given stations and travel at least K kilometers. | Medium5 | Binary searchGreedy+1 | No attempts yet | 1s | 1024 MB | Judgeable |
| Sawtooth SequenceGiven N distinct numbers, arrange all of them into a zigzag sequence and output the lexicographically smallest such arrangement. | Medium5 | GreedySorting+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| AnimalsGiven N daily active intervals, some crossing midnight, find whether all overlap at some moment and output the longest common sub-interval. | Medium5 | IntervalsImplementation+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Railway ConnectionGiven existing rail links and city flows, find the minimum cost to connect all cities, where an edge costs the product of its endpoint flows. | Medium5 | Minimum spanning treeUnion-find+2 | No attempts yet | 1s | 1024 MB | Judgeable |