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 |
|---|---|---|---|---|---|---|
| TribesRepeatedly merge axis-aligned rectangles whose overlap has positive area into their bounding box, then print the remaining boxes in lexicographic order. | Hard8 | Union-findSegment tree+2 | No attempts yet | 3s | 1024 MB | Judgeable |
| FertilizingEach day the C_i shortest of N trees grow by the day number and the K_i-th shortest height is recorded; report the sum over all days. | Hard8 | Segment treeSorting+1 | No attempts yet | 3s | 256 MB | Judgeable |
| How Does Your Garden Grow?Place up to 50 one-metre plants on a 10 cm grid so the squared gap between each plant water need and the sprinkler water its interval collects is minimal. | Hard8 | Dynamic programmingMath+1 | No attempts yet | 30s | 256 MB | Judgeable |
| Line SweepFind the tallest vertical broom that still reaches every empty cell by sliding sideways, then the fewest sideways sweeps that clean them all. | Hard8 | GreedyIntervals+2 | No attempts yet | 10s | 256 MB | Judgeable |
| The ImpPick boxes in some order while an adversary voids up to k of them, and maximize the kept item value minus all purchase costs under optimal play. | Hard8 | Game theoryDynamic programming+1 | No attempts yet | 15s | 256 MB | Judgeable |
| Enchanted ForestGiven initial heights and growth rates on an N by N grid, find the largest edge-connected group sharing one height at some present or future real time. | Hard8 | Union-findSorting+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Truck EncountersCount how many times each queried pair of trucks, moving at equal speed along zigzag city routes, occupy the same position. | Hard8 | IntervalsSorting+1 | No attempts yet | 3s | 64 MB | Judgeable |
| Cactus GeneratorParse the SCGL definition, build the cactus it describes with merged vertices renumbered, and print the counts, path cover number, and sorted edges. | Hard8 | GraphUnion-find+2 | No attempts yet | 1s | 256 MB | Judgeable |
| The j-th NumberAfter copying each insert value into every array of its interval, each query asks for the j-th smallest value collected from an interval of arrays. | Hard8 | Binary searchSegment tree+2 | No attempts yet | 10s | 512 MB | Judgeable |
| Floating IslandsFind the cheapest connected bridge network where each bridge costs the position difference and each island has a degree limit, or report -1 when impossible. | Hard8 | Dynamic programmingMinimum spanning tree+1 | No attempts yet | 8s | 512 MB | Judgeable |
| Revenge of the ants 2Labeled ants walk both ways on a circular rail and bounce on collision; compute when each ant is back at its start with its initial direction. | Hard8 | String matchingSorting+2 | No attempts yet | 5s | 256 MB | Judgeable |
| Maximize the matrix sumReorder entries by rotating rows and columns and flipping row and column signs to maximize the sum of all cells. | Hard8 | MathGreedy+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Forming TeamsFor each planned day, decide whether students with accepted size ranges can fill all requested teams of the given sizes. | Hard8 | GreedyIntervals+2 | No attempts yet | 4s | 512 MB | Judgeable |
| Sorting 2Choose one swap per round after the fixed rival swap to sort the permutation in the fewest rounds, with the lexicographically smallest choice list on ties. | Hard8 | BFSShortest path+1 | No attempts yet | 1s | 512 MB | Judgeable |
| ExchangeCount the swaps performed by running the first M passes of selection sort on each array. | Hard8 | Segment treeSorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Reducing Network DiameterPay per unit of reduction on tree edge weights so the longest path between any two nodes is at most D at minimum total cost. | Hard8 | GreedyTree+2 | No attempts yet | 2s | 256 MB | Judgeable |
| HiveEach rabbit walks a right-or-down path from the top-left cell to the bottom-right cell, and the goal is the fewest paths covering every flower. | Hard8 | GraphCombinatorics+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Ants in a CorridorAnts join a corridor over time and bounce off each other and both walls, and each query asks for the position of one numbered ant. | Hard8 | MathSorting | No attempts yet | 3s | 512 MB | Judgeable |
| Pyramid BaseFind the side length of the largest axis-aligned square on a grid that avoids all given rectangular obstacles. | Hard8 | Binary searchGeometry+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Cow ConfinementEach cow moves only down or right across a large grid and cannot cross rectangular fences, and the task asks how many flowers each cow can reach. | Hard8 | Segment treeSorting+1 | No attempts yet | 10s | 512 MB | Judgeable |
| Export EstimateFor each threshold query, count the vertices and edges left after deleting low-priority streets and contracting degree-two vertices in index order. | Hard8 | GraphUnion-find+1 | No attempts yet | 4s | 512 MB | Judgeable |
| Min-Max Distance GameStarting from the given first player, both sides alternately remove one stone until two remain, with Alice maximizing and Bob minimizing the final distance. | Hard8 | Game theoryGreedy+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Niya's HappinessTrack insertions and deletions in a banknote multiset and report after each update whether every amount up to the total is payable exactly. | Hard8 | Segment treeSorting+1 | No attempts yet | 3s | 512 MB | Judgeable |
| Queue of SoldiersCount distinct lineups of soldiers with given heights where exactly K soldiers have a strictly shorter soldier ahead of them. | Hard8 | CombinatoricsDynamic programming+1 | No attempts yet | 5s | 256 MB | Judgeable |
| Stop Making SenseFor each input point in turn, remove it and report the area of the smallest convex polygon enclosing the rest. | Hard8 | GeometrySorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| SubstringsOrder all given strings as the consecutive length-L windows of one string of length L+N-1 and print the lexicographically smallest such string. | Hard8 | GraphDFS+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Subsequence HashesPrint the polynomial hashes of the K lexicographically smallest non-empty subsequences of the given array. | Hard8 | HeapSorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Counting palindromesCount the palindromic substrings fully contained in each query interval of a lowercase string. | Hard8 | String matchingSegment tree+2 | No attempts yet | 2s | 64 MB | Judgeable |
| K-th smallest weight on a tree pathAnswer each query with the K-th smallest vertex weight on the path between two vertices in a tree. | Hard8 | Segment treeTree+1 | No attempts yet | 1.5s | 512 MB | Judgeable |
| Fortune Telling 2N two-sided cards start showing A_i and each threshold T_j flips every card whose visible number is at most T_j; compute the final visible sum. | Hard8 | Segment treeSorting+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Fairland (Large)Keep the largest rooted connected subtree containing the CEO so all kept salaries fit within a range of width D. | Hard8 | TreeSliding window+2 | No attempts yet | 10s | 512 MB | Judgeable |
| Log Set (Large)Recover the original integer multiset from the frequency table of all its subset sums, breaking ties by lexicographic order. | Hard8 | GreedySorting+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Hiking DeerChoose speeds, including full stops, for one clockwise loop of a circular trail to minimize meetings with hikers who walk at constant speeds. | Hard8 | MathSorting+1 | No attempts yet | 5s | 512 MB | Judgeable |
| ARAM (Large)Decide when to spend reroll currency on random champions to maximize the long-run win rate over many games. | Hard8 | Dynamic programmingProbability+2 | No attempts yet | 120s | 512 MB | Judgeable |
| Ticket SwappingPassengers riding one direction on a line pay a decreasing per-stop fare and may swap entry cards where trips overlap, so compute the maximum total fare loss. | Hard8 | GreedySorting+2 | No attempts yet | 5s | 512 MB | Judgeable |
| The Great Wall (Large)Count how many moving interval attacks pierce a wall that rises after each success to the strength that would have stopped it. | Hard8 | Segment treeIntervals+1 | No attempts yet | 15s | 512 MB | Judgeable |
| Upstairs and DownstairsKonstantin chooses and orders at least K activities from limited copies to minimize the chance Ilia wakes after falling asleep. | Hard8 | ProbabilityDynamic programming+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Upstairs and DownstairsKonstantin must order at least K activities with capped repeats to minimize the chance Ilia falls asleep and later wakes. | Hard8 | ProbabilityGreedy+1 | No attempts yet | 100s | 512 MB | Judgeable |
| Travel Plan (Large)Visit every planet on a line exactly once and return to Earth, maximizing total travel distance without exceeding the fuel limit. | Hard8 | Dynamic programmingSorting+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Minimum Triangle PerimeterGiven up to 10000 points, find three whose triangle has the smallest total perimeter, with collinear triples allowed. | Hard8 | GeometryDivide and conquer+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Minimum Triangle PerimeterGiven up to a million integer points, pick three that form the triangle of smallest perimeter and report that perimeter. | Hard8 | GeometryDivide and conquer+1 | No attempts yet | 90s | 512 MB | Judgeable |
| Stock ChartsPartition n stock price sequences into the fewest groups so that within each group no two polylines cross or touch at any time point. | Hard8 | Dynamic programmingGreedy+1 | No attempts yet | 5s | 512 MB | Judgeable |
| BoatCount subsets of schools with an assigned boat count in [a_i, b_i], strictly increasing in school order, excluding the empty setup, modulo 1e9+7. | Hard8 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Relay SignalCount boats reachable within one relay hop from boat 1, where visibility means the connecting segment never enters the convex island interior; every coordinate is a lattice point. | Hard8 | GeometrySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Wall RepairA robot on a line must visit every point; each point's repair cost grows linearly with the time it waits, so find the visiting order of minimum total cost. | Hard8 | Dynamic programmingIntervals+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| First Pair to MeetGiven people at vertices of a weighted undirected graph, find the minimum over all pairs of half their shortest-path distance; roads are traversed at 10 km/h and the time prints in minutes. | Hard8 | GraphShortest path+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Maximum substring costGiven a string T, find the maximum of length times number of occurrences over all substrings S of T. | Hard8 | StringSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Hongjun's IntersectionSum the lengths of the intersections of all k-subsets of given segments, modulo 1e9+7. | Hard8 | SortingCombinatorics+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Run and Swim RaceGiven each runner's running and swimming speeds, find every participant who can finish first for some positive choice of the leg lengths R and S. | Hard8 | GeometrySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Fewest letters for a suffix arrayGiven a permutation that is a suffix array, find the minimum number of distinct letters needed for a string that realizes exactly this suffix array. | Hard8 | StringGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Minho's WishFor each of Q range queries on an array, count how many distinct values occur at least three times within the queried index range. | Hard8 | Segment treePrefix sum+2 | No attempts yet | 2s | 512 MB | Judgeable |
| ChaosStarting from n numbers, repeatedly replace three numbers a, b, c by two copies of floor((sum of a chosen pair)/2); find the maximum equal value that can remain. | Hard8 | GreedyMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Jewel ThiefFor each knapsack capacity 1 through k, compute the maximum total value of a subset of n jewels whose sizes sum to at most the capacity. | Hard8 | Dynamic programmingGreedy+1 | No attempts yet | 10s | 512 MB | Judgeable |
| FenceGiven points on grid corners, find the shortest closed fence along cell edges and diagonals that encloses all of them, output as a + b*sqrt(2). | Hard8 | GeometrySorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Optimal TournamentPlace N contestants with given strengths at the leaves of a knockout bracket of height at most K so that the total strength difference over all matches is minimized. | Hard8 | Dynamic programmingSorting+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Scorpion Test for Permutation GraphsAfter each swap in a permutation A, decide whether the permutation graph (edges between crossing chords) is scorpion-like. | Hard8 | GraphSorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Counting Bow TiesCount 4-cycles in a bipartite graph defined by M rectangles over vertex ranges, with N up to 1e9. | Hard8 | GeometryCombinatorics+2 | No attempts yet | 2s | 256 MB | Judgeable |
| King of ChairsArrange N ladies, each sitting or standing with probability 1/2, to maximize the expected number of ordered pairs where the person behind is strictly taller. | Hard8 | SortingGreedy+2 | No attempts yet | 1s | 32 MB | Judgeable |
| PasswordGiven a length-N string, collect all distinct substrings meeting four counts (length, digits, specials, uppercase), sort them lexicographically, and print the middle one. | Hard8 | StringSorting+2 | No attempts yet | 4s | 512 MB | Judgeable |
| Minimum Diameter SumSplit a set of n planar points into two nonempty groups so that the sum of the two group diameters is minimized, and print the value. | Hard8 | GeometryBinary search+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Meteor ShowerCount the convex polygons that are completely hidden from the origin by other polygons, since every ray stops at the first one it hits. | Hard8 | GeometrySorting+1 | No attempts yet | 1s | 512 MB | Judgeable |
| XOR SequenceChoose B in [0, N-1] to XOR every element of A, then find the maximum possible count of index pairs i < j with C_i < C_j. | Hard8 | Divide and conquerBit manipulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Rock BandEach of M members ranks all S songs; a set list is valid if every member plays all songs they rank above any chosen song. Find a shortest valid set list. | Hard8 | GreedySorting+2 | No attempts yet | 4s | 512 MB | Judgeable |
| The Longest Welded SwordSelect and order all plates so that widths strictly decrease, orienting each plate to maximize the total contributed length sum. | Hard8 | GreedySorting+2 | No attempts yet | 7s | 512 MB | Judgeable |
| Counting Similar TreesGroup labeled trees that are isomorphic under a bijection preserving edge label differences, and report each group size. | Hard8 | TreeHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sorting GameApply K sets of operations, each sorting a prefix of length A ascending then a prefix of length B descending, and print the final sequence. | Hard8 | SortingImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Inversions of a simple path sequenceGiven a connected unimodal (unicyclic) graph, find a minimum inversion count over simple paths visiting at least K vertices, or -1 if none exist. | Hard8 | GraphDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Counting ear shapesCount quadruples of red points and pairs of blue points forming an ear shape with angle and containment conditions. | Hard8 | GeometryBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Substitution Cipher KeyGiven N distinct words and a target permutation, find the lexicographically smallest substitution cipher key that sorts the encrypted words into that order, or report none. | Hard8 | GreedySorting+2 | No attempts yet | 1s | 64 MB | Judgeable |
| KingN elves each target a dwarf; elves enter one at a time and slide clockwise to the next free spot. Choose the entry order to maximize elven wins. | Hard8 | GreedySorting+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Romeo and JulietCompute each person's maximum guilt-to-Juliet and pain-to-Romeo transfer product, weight every event, then remove up to k events to minimize the total. | Hard8 | GraphShortest path+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Distance to the nearest pointFor each of N points, report the Manhattan distance to the nearest other point. | Hard8 | GeometryDivide and conquer+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Sequence and Queries 1Given a static sequence, answer M queries counting how many values in range A[i..j] are greater than k. | Hard8 | Segment treeSorting+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Sequence and Queries 3Given a static sequence, answer queries (decoded with the previous answer via XOR) counting how many elements in a subarray exceed k. | Hard8 | Segment treeBinary search+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Counting close pairs in a rangeGiven a sequence and K, each query asks how many index pairs inside a subarray have value difference at most K. | Hard8 | Divide and conquerPrefix sum+2 | No attempts yet | 3s | 512 MB | Judgeable |
| RoomGiven points on the edges of an unknown orthogonal monotone polygon with edge orientations, reconstruct it and output its perimeter or -1 if impossible. | Hard8 | GeometrySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Olympic Gold AthletesEach athlete's skill and fatigue change linearly in time; count those who are the unique max-skill and unique min-fatigue athlete at some time t >= 0. | Hard8 | GeometryBinary search+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Rectangular PlazaCount axis-aligned rectangles whose corners include two given lamps and whose interior contains no other lamp, given all X and Y coordinates are distinct. | Hard8 | GeometrySorting+1 | No attempts yet | 1s | 512 MB | Judgeable |
| BalloonGiven N disjoint ceiling segments, trace each vertically rising balloon as it sticks to horizontal segments or slides to the higher endpoint of tilted ones, and report the final resting point or escape x coordinate. | Hard8 | GeometrySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Tire PatchesOn a circular tire, cover all hole positions with the minimum total length of uncut patches of two given lengths and return that total length. | Hard8 | Dynamic programmingArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| EnclosureGiven k controlled points forming a convex hull, add one of the remaining points to maximize the hull area, and print the resulting area to one decimal. | Hard8 | GeometryGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Maximum Tent VolumeAssign n poles of given heights to a central hole and n-1 fixed holes around it to maximize the total volume of the resulting triangles. | Hard8 | GeometryDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Krypton StadiumsGiven n intervals where interval i contains point i, classify the layout as Great, Acceptable, or Bad based on whether pairs of cities are co-hosted by a nesting or shared stadium. | Hard8 | IntervalsGreedy+2 | No attempts yet | 10s | 512 MB | Judgeable |
| Rotation EstimationGiven two unordered point sets related by a rotation plus translation, find the smallest counterclockwise rotation angle in [0, 2pi) that maps the first set onto the second. | Hard8 | GeometrySorting+2 | No attempts yet | 8s | 512 MB | Judgeable |
| Ramen Shop SeatingSimulate a ramen shop with N counters of fixed seats where arriving groups pick the best free block under a preference rule and may leave if they wait too long; report average customer satisfaction. | Hard8 | SimulationImplementation+2 | No attempts yet | 8s | 512 MB | Judgeable |
| Online Quiz SystemGiven per-player delays and each player's answer timing, simulate the polling protocol and report bytes sent and received by the server and each player. | Hard8 | SimulationImplementation+2 | No attempts yet | 8s | 512 MB | Judgeable |
| Three SquaresGiven N integer points, find the smallest side length L so that three equal axis-parallel squares of side L can cover every point. | Hard8 | Binary searchSorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Emission SpectrumMaintain an integer array under adjacent swaps and answer k-th smallest value queries over subarrays online. | Hard8 | Binary searchDivide and conquer+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Washroom Satisfaction IndexAfter each point update to guest washroom times, compute the minimum sum over assignments of wait-plus-service times to W washrooms, where each washroom serves a subset in some order. | Hard8 | GreedySorting+2 | No attempts yet | 10s | 512 MB | Judgeable |
| ACM TaxFor each query path in a weighted tree, output the median edge length, rounded to one decimal. | Hard8 | TreeBinary search+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Sequence and Queries 14For each query on a subarray, take the distinct values, sort them, and report the k-th smallest, with each query depending on the previous answer. | Hard8 | ArraySorting+2 | No attempts yet | 5s | 1536 MB | Judgeable |
| Gotta Nudge 'Em AllChoose one 30-minute window for a double-XP bonus, catch every Nudgemon already logged, and maximize XP from evolutions inside that window. | Hard8 | GreedySliding window+1 | No attempts yet | 3s | 512 MB | Judgeable |
| Contest StrategySum the contest penalty over all n! read orders, where after reading k problems you always solve the read-but-unsolved problem with the smallest solving time. | Hard8 | CombinatoricsGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Demilitarized ZoneFor each protected point, count how many starting mines eventually trigger a blast covering it, given chain reactions over intervals. | Hard8 | IntervalsSorting+2 | No attempts yet | 3s | 256 MB | Judgeable |
| Solar FlightFor a line segment query, find the maximum total intercept-weight above a given ray over all x in a length-K window. | Hard8 | GeometrySorting+2 | No attempts yet | 15s | 512 MB | Judgeable |
| Data StructureGiven M required cells in a triangular pyramid with N up to 1e9, find the minimum number of filled cells so that every filled cell has both supporting cells below it filled. | Hard8 | GreedySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Zombie ApocalypseGiven up to 2000 zombie cells on an N by M grid with Chebyshev distance spreading, count how many cells end up at level Q. | Hard8 | GeometrySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Broadcast Tower OffersFor each offered tower height, find the best position along a row of buildings and report how many buildings to its west can receive its westward signal. | Hard8 | StackSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| K representatives on a lineFor each K from 1 to N, place K real points on a line to minimize the total distance to all given points. | Hard8 | Dynamic programmingDivide and conquer+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Quadrilateral blanketGiven N points and an area limit L, pick four points forming a simple quadrilateral with area at most L, maximizing that area. | Hard8 | GeometryBrute force+2 | No attempts yet | 5s | 128 MB | Judgeable |