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 |
|---|---|---|---|---|---|---|
| Space AntGiven N points with distinct x and y coordinates, output the order produced by repeatedly picking the most clockwise remaining point from the current one. | Medium5 | GeometrySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Wooden SticksGiven n sticks with length and weight, order them to minimize the number of setup steps, where a setup is needed unless both length and weight are nondecreasing from the previous stick. | Medium5 | SortingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Card Game CheaterEve knows Adam's card order and must permute her own cards to maximize the number of positions where her card beats his. | Medium5 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Bin PackingPack items into identical bins holding at most two items each so that the number of bins is minimized. | Medium5 | GreedyTwo pointers+2 | No attempts yet | 1s | 128 MB | Judgeable |
| DancersRepeatedly pair the two closest unpaired dancers, breaking ties by smaller indices, and output all pairs sorted. | Medium5 | SortingGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Olympic GamesGiven each event's date and start and end times in hhmm, find the maximum number of events a person can attend without overlap, moving freely between venues. | Medium5 | GreedySorting+2 | No attempts yet | 2s | 256 MB | Judgeable |
| CocktailsSimulate Angelo's cocktail mixing rules, track each cocktail's counts, and print the top ten by count then recipe-book order with computed prices. | Medium5 | SimulationHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| FactoryGiven two orderings of the same N numbers, count pairs of connecting cables that cross when drawn as straight lines. | Medium5 | SortingPrefix sum+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Saruman's ArmyPlace the fewest palantirs on troop positions so every troop lies within range R of one. | Medium5 | GreedySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| OutletsGiven power strips that swap between standard A and B outlets, find the maximum number of standard-A outlets that can end up powering computers. | Medium5 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Romantic DateGiven Wibowo's 26 cards, find the maximum number of rounds he can win by pairing his cards against his opponent's 26 cards in the best order. | Medium5 | GreedySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Random GapGiven a linear congruential generator, find the largest gap between neighboring distinct values the sequence produces. | Medium5 | SimulationHash map+2 | No attempts yet | 4s | 128 MB | Judgeable |
| SkyscrapersFor each queried day, count maximal blocks of adjacent skyscrapers whose heights exceed the rising sea level. | Medium5 | SortingArray+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Tiling VerificationGiven a floor and up to 100 rectangles, decide whether they overlap, stick out of the floor, or fail to cover it, printing which condition fails first. | Medium5 | GeometryImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SortingCount the swaps made by a given selection-style double loop on an array. | Medium5 | SortingArray+1 | No attempts yet | 1s | 128 MB | Judgeable |
| ChocolateFind the minimum total cost to split an m by n chocolate bar into unit squares, where each vertical or horizontal cut costs a fixed price regardless of the piece size. | Medium5 | GreedySorting | No attempts yet | 1s | 128 MB | Judgeable |
| InsulatorGiven n positive coefficients, reorder them so that the sum plus the total of positive rises between adjacent layers is as large as possible, and print that maximum. | Medium5 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| BalanceGiven weights, split some into two equal-sum disjoint groups; find the largest weight that can be the heaviest used one. | Medium5 | Dynamic programmingSorting+2 | No attempts yet | 3s | 128 MB | Judgeable |
| LollobrigidaGiven a multiset of block heights, decide whether the blocks can be arranged so the sequence alternates up and down at every position. | Medium5 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Building BlocksRemove blocks from a tower so the most remaining blocks sit at an altitude equal to their printed number. | Medium5 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Building BlocksFind the minimum number of add/remove block moves so that some k consecutive columns end up with equal height. | Medium5 | Sliding windowPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| MapCount the marked points that have at least one point strictly below-left, above-right, below-right, and above-left of them. | Medium5 | SortingArray | No attempts yet | 1s | 128 MB | Judgeable |
| Logarithmic PaprikaGiven counts of paprika weighing 1, 2, 4, ..., 2^k grams, find the smallest positive weight that cannot be formed from whole pieces. | Medium5 | GreedyMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Apples and Apple TreesGiven positions of n trees and m apples on a line, find the minimum distance from any apple to its nearest tree. | Medium5 | SortingBinary search+2 | No attempts yet | 1s | 128 MB | Judgeable |
| BalloonsGiven stock counts for n balloon colors and m orders, decide whether each child can receive the requested number of distinct-colored balloons. | Medium5 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ElectricityGiven k lines between n homes and m windmills on parallel lines, count subsets of non-crossing lines where every home and windmill has degree at most one, modulo r. | Medium5 | Dynamic programmingSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Crime at Piccadilly CircusFor each integer moment in [p, k], count how many people's inclusive intervals cover it, and report the minimum and maximum counts. | Medium5 | IntervalsSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Galactic Container ShipGiven M rails with height limits 1..M and N plates each worth its quality w and having height h, choose plates to maximize total quality so that each chosen plate fits some distinct rail. | Medium5 | GreedySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| BrothersChoose the largest set of families whose position spans never overlap so each kept family stands together. | Medium5 | GreedyIntervals+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Telephone ExchangePick an integer tower height so the fees from houses fully covered by the circle exceed the height-dependent maintenance cost by as much as possible. | Medium5 | GeometrySorting+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Planting PotatoesDistribute up to m potatoes over fields capped at b_i so the sum of squared counts is as large as possible. | Medium5 | GreedySorting | No attempts yet | 1s | 128 MB | Judgeable |
| Paper RollsSet every roll to one shared unrolled length within each total length using the fewest 1-cm moves. | Medium5 | SortingMath | No attempts yet | 1s | 128 MB | Judgeable |
| The CrossingPair at most two riders per shared boat within the weight limit or send each alone, and find the lowest total fare. | Medium5 | GreedySorting+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Word Translation LookupGiven pairs of directly translated words, list every target-language word linked to each query word through translation chains. | Medium5 | Union-findHash map+1 | No attempts yet | 12s | 128 MB | Judgeable |
| Portal KombatHektor absorbs the strength of each weaker opponent he beats, and the goal is the fewest wins that let him defeat the strongest opponent. | Medium5 | GreedySorting+1 | No attempts yet | 5s | 128 MB | Judgeable |
| MinersAssign each miner to a leaf chamber whose path from the entrance stays tall enough and fit as many miners as possible. | Medium5 | GreedySorting+1 | No attempts yet | 2s | 128 MB | Judgeable |
| MeteorThe task counts the largest number of meteors strictly inside a fixed rectangle at one moment as each meteor moves along a straight path. | Medium5 | IntervalsSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SymmetryDecide whether the given dots mirror exactly across some vertical line, printing YES or NO for each test case. | Medium5 | Hash mapGeometry+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Parcel DeliveryChoose how many boxes of each shipment to load onto a one-way truck of capacity C to maximize total delivered boxes. | Medium5 | GreedySorting | No attempts yet | 1s | 128 MB | Judgeable |
| TaekwondoSort both weight lists and pair players to minimize the total absolute weight difference across all matches. | Medium5 | Dynamic programmingSorting | No attempts yet | 1s | 128 MB | Judgeable |
| BridgeFind the bridge height that minimizes the total crossing distance over every pair of left and right houses. | Medium5 | SortingMath | No attempts yet | 3s | 128 MB | Judgeable |
| Canoe AthletesPick one weight from each of four lists so the total is closest to the target, preferring the smaller total on ties. | Medium5 | Binary searchSorting+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Sum of Two NumbersCount the pairs of distinct given integers whose sum has the smallest absolute difference from K. | Medium5 | Two pointersSorting | No attempts yet | 1s | 128 MB | Judgeable |
| Widest PathFind the path between two given nodes whose smallest edge weight is as large as possible. | Medium5 | Minimum spanning treeUnion-find+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Message BroadcastingCompute the fewest rounds to spread a message from the root when each informed node calls at most one child per round. | Medium5 | GreedyTree+2 | No attempts yet | 1s | 128 MB | Judgeable |
| RankingsPlayers accumulate points through updates and each query asks for the current rank of one player among up to 100000 players. | Medium5 | Segment treeSorting+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Wiring CostPay for wire pieces so every cheaper piece becomes free, then choose the price tier that reaches the required length at the lowest cost. | Medium5 | GreedySorting | No attempts yet | 1s | 128 MB | Judgeable |
| Shuttle BusFind the smallest fleet of buses that can run every scheduled trip between the school and the terminal given the one-way travel time. | Medium5 | GreedySorting | No attempts yet | 1s | 128 MB | Judgeable |
| Tiling Up BlocksFind the largest subset of blocks that stacks so both knob counts never decrease from bottom to top. | Medium5 | Dynamic programmingSorting | No attempts yet | 1s | 128 MB | Judgeable |
| Bonus WordFind every pair of dictionary words that joins to ten letters and matches each query fixed and shuffled letters, listed in order. | Medium5 | StringBrute force+1 | No attempts yet | 1s | 128 MB | Judgeable |
| The Tired Traveling SalesmanFind the integer point off all customer sites that minimizes total Manhattan distance and count how many such points tie. | Medium5 | SortingMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Nested Shrubbery BoxesChoose the largest subset of boxes that nest when every box is rotated to fit strictly inside the next box. | Medium5 | Dynamic programmingSorting | No attempts yet | 1s | 128 MB | Judgeable |
| Hierarchical DemocracyCompute the smallest popular vote total that wins the presidency through nested majority votes in districts. | Medium5 | TreeGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Pretty good numbersCount the integers in each interval whose absolute gap between the proper-divisor sum and the number is within the limit. | Medium5 | Number theorySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Property LinesGiven up to 100 claimed rectangles inside a W by H city, compute the area claimed twice or more, at least once, and never. | Medium5 | GeometryBrute force+1 | No attempts yet | 1s | 128 MB | Judgeable |
| MI6Given an integer, output its prime power components, one per prime factor, in increasing order. | Medium5 | Number theorySorting | No attempts yet | 1s | 128 MB | Judgeable |
| RoadDecide whether the road between p and q can belong to a cheapest network that connects all cities. | Medium5 | Minimum spanning treeUnion-find+1 | No attempts yet | 2s | 64 MB | Judgeable |
| Manhattan SortSort each sequence of distinct integers with swaps that cost the distance between positions and report the minimum total cost. | Medium5 | GreedySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Adding NumbersSplit the given digits into two numbers with no leading zero so their sum is as small as possible. | Medium5 | Brute forceSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Permutation GraphGiven two permutations of 1 to n drawn on two parallel lines, count the pairs of segments joining equal numbers that cross. | Medium5 | Divide and conquerSorting | No attempts yet | 5s | 256 MB | Judgeable |
| Farmer John has no large brown cowFind the Kth adjective combination in alphabetical order among all combinations except the N forbidden ones. | Medium5 | CombinatoricsSorting | No attempts yet | 1s | 128 MB | Judgeable |
| Crowded CowsCount cows that have a cow at least twice as tall within distance D on both the left and the right. | Medium5 | Sliding windowSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Trending TopicMaintain word counts over a rolling 7-day window and answer each top N query in frequency order with ties included. | Medium5 | Sliding windowHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Minimum Cost SortingFind the cheapest total of moved values needed to sort the array when moving one element to any position costs its value. | Medium5 | Dynamic programmingSorting | No attempts yet | 1s | 128 MB | Judgeable |
| Search SuggestionFor each typed prefix, print the three highest-scoring matching cities, or the match count when more than 1000 names match. | Medium5 | Binary searchString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Global WarmingGiven column heights, find the greatest number of maximal above-water runs over all real sea levels. | Medium5 | Union-findSorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Super PhyllisFind every direct reporting edge that has an alternate route through at least one other person and print those edges in sorted order. | Medium5 | GraphShortest path+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Milk SchedulingSchedule at most one cow per time unit before its deadline to maximize total gallons of milk. | Medium5 | GreedyHeap+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Cow BaseballCount triples of cows in increasing position whose second gap is at least the first gap and at most twice it. | Medium5 | Two pointersSorting | No attempts yet | 1s | 128 MB | Judgeable |
| Cross Country SkiingFind the smallest elevation gap D that keeps every waypoint mutually reachable through adjacent cells. | Medium5 | Minimum spanning treeUnion-find+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Recording the MoolympicsSelect the largest set of programs that two tuners can record when one tuner cannot record overlapping programs. | Medium5 | GreedySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Incomparable rectangle pairsCount the pairs of rectangles where neither fits inside the other after translation or a 90-degree rotation. | Medium5 | SortingGeometry+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Stacking BlocksReshape both towers into the V-shaped skyline with center height h at the lowest total cost of added and removed blocks. | Medium5 | SortingPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Fair PhotographyAfter sorting cows by position, find the widest interval with equal numbers of G and H cows, where single-breed intervals also count. | Medium5 | Prefix sumHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Gondola ReplacementGiven the n cars seen on a circular gondola line, find one possible order of breakdowns that explains the observed numbers. | Medium5 | SortingHash map | No attempts yet | 1s | 256 MB | Judgeable |
| Where's That Fuel?Starting with planet P's fuel, repeatedly visit affordable planets to maximize final fuel, then the number of visits. | Medium5 | GreedySorting+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Market ShoppingYou choose exactly k prices per query to maximize the odd total, printing -1 when no odd sum exists. | Medium5 | GreedySorting+1 | No attempts yet | 10s | 256 MB | Judgeable |
| Crossing the RiverPick a booster range and rock hops that cross the river with the lowest range-squared plus per-jump cost. | Medium5 | GreedySorting | No attempts yet | 1s | 256 MB | Judgeable |
| Opening CeremonyGiven each block height, find the fewest charges that clear all blocks with whole-block shots and level-wide shots. | Medium5 | SortingGreedy | No attempts yet | 1s | 256 MB | Judgeable |
| Clock PhotosDecide whether two sets of hand angles on a dial coincide after rotating one photo. | Medium5 | SortingString matching | No attempts yet | 1s | 256 MB | Judgeable |
| Hexagonal colonyChoose hexagonal cell blocks so the exposed wall windows house at least P people with the fewest blocks. | Medium5 | GreedyGeometry+2 | No attempts yet | 1s | 256 MB | Judgeable |
| StavitelA cube building on a square board must match given front and right skyline heights; find the minimum and maximum possible cube counts. | Medium5 | GreedySorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Rat TunnelPick the cheapest lanes for cameras so every closed running route holds one, and report the total cost and the longest chosen lane. | Medium5 | Minimum spanning treeUnion-find+1 | No attempts yet | 1s | 256 MB | Judgeable |
| DebtFor every group size M, choose M loans to minimize M times the largest chosen loan minus their sum, and output the total of these minima. | Medium5 | SortingPrefix sum | No attempts yet | 1s | 256 MB | Judgeable |
| Burrito KingChoose fractional amounts of capped ingredients to maximize joy without exceeding the unhappiness budget, and print every value as a reduced fraction. | Medium5 | GreedySorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Learning by ExampleCount how many integer weights from A to B the nearest-neighbor classifier labels as spotted from N labeled training weights. | Medium5 | SortingIntervals | No attempts yet | 1s | 256 MB | Judgeable |
| StampedeCount how many moving segments are ever the closest to the origin while crossing the positive y-axis. | Medium5 | IntervalsSorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Arctic Polar ExplorerWrite an APECODE program that makes a robot with two grippers sort a line of rocks by weight using only balance comparisons. | Medium5 | SortingSimulation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Color BallsFor each ball, add up the sizes of all strictly smaller balls with a different color. | Medium5 | SortingPrefix sum+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Maximize DifferencesReorder the given array so the sum of absolute differences between neighbors is as large as possible. | Medium5 | GreedySorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Museum wall constructionFind the shortest closed curve enclosing N disjoint equal circles of radius R. | Medium5 | GeometrySorting | No attempts yet | 1s | 256 MB | Judgeable |
| Butterfly BallotDecide whether the candidates can be ordered so candidate 1 finishes first when half of each ballot position's supporters spill to the next position. | Medium5 | GreedySorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| TV WarPick non-overlapping weekly TV programs to maximize the total preference score. | Medium5 | Dynamic programmingSorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Traffic VolumeCount how many cars came from the left from the unordered times in two boxes with offsets of 500, 1000, and 1500. | Medium5 | GreedySorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Guarding the BorderAdd up to M towers anywhere on a circular border of length L so the largest gap between neighboring towers is as small as possible. | Medium5 | Binary searchGreedy+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Bank QueuePick at most one person per minute before each deadline to maximize the total cash collected. | Medium5 | GreedyHeap+1 | No attempts yet | 1s | 256 MB | Judgeable |
| LineagePick a father and a mother from the given gene values so the nearest of the three pups' gene values to R is as close as possible. | Medium5 | SortingBinary search | No attempts yet | 1s | 256 MB | Judgeable |
| Entertainment BoxSchedule the most TV shows on k recorders so no recorder tapes overlapping shows. | Medium5 | GreedySorting+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Population MigrationResidents buy each job from the priciest affordable worker and leave when daily income falls below outside earnings; count who stays once departures stop. | Medium5 | SimulationSorting | No attempts yet | 5s | 256 MB | Judgeable |
| Number of distinct substringsCount how many different contiguous substrings appear in a lowercase string of length up to 1000. | Medium5 | String matchingHash map+1 | No attempts yet | 1s | 512 MB | Judgeable |