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 |
|---|---|---|---|---|---|---|
| Bag of BagsProcess bags one by one; keep a bag unless its equality class merges two classes that were already equal, and report the decision for each. | Hard8 | IntervalsUnion-find+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Balanced SequenceReorder n bracket strings to maximize the length of the longest balanced subsequence of their concatenation. | Hard8 | GreedySorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Nutella's LifeChoose a subsequence of contests with nondecreasing values, where skipping x contests in a row costs x+1 each, to maximize total fun. | Hard8 | Dynamic programmingSegment tree+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Christmas GarlandGiven a garland of n bulbs with colors, each query flips the state of every bulb of one color, and after each flip you report the number of maximal lit segments. | Hard8 | ArrayImplementation+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Leave Out All The RestGiven two arrays with distinct values, interleave them into one sequence so that its longest increasing subsequence is as long as possible, and output that maximum length. | Hard8 | Dynamic programmingGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Biggest NumberAfter each of Q point updates to the digits on N cards, report the largest base-D number obtainable by rearranging the cards, modulo 1e9+7. | Hard8 | Segment treeSorting+2 | No attempts yet | 0.5s | 256 MB | Judgeable |
| SeatsGiven n prize values, choose one probability distribution over seats so that a player's expected prize, accounting for random contests at each seat, is maximized. | Hard8 | ProbabilityMath+2 | No attempts yet | 1.5s | 256 MB | Judgeable |
| SchedulingDecide whether n preemptible tasks with release times, deadlines, and processing times can be scheduled on m identical processors within their windows. | Hard8 | GreedySorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| ScheduleAssign interval tasks to machines so no two overlapping tasks share a machine; minimize the number of machines, then the total working time (earliest start to latest finish) across those machines. | Hard8 | IntervalsGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Subset SumGiven n integers, output the k smallest sums over all non-empty subsets, in ascending order. | Hard8 | HeapSorting+2 | No attempts yet | 5s | 512 MB | Judgeable |
| GaloisGiven a permutation p, count permutations q with p(q(i)) = q(p(i)) for all i, that have an even number of inversions, modulo 1e9+7. | Hard8 | CombinatoricsMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Donut-shaped EnclosurePlace a Chebyshev-distance donut with inner radius L and outer radius R at a lattice center to maximize the total weight of covered points. | Hard8 | GeometryPrefix sum+2 | No attempts yet | 3s | 1024 MB | Judgeable |
| Very New YorkGiven up to 100,000 restaurant points on a grid, answer 100,000 queries counting how many points lie within Manhattan distance d of a query point. | Hard8 | GeometryDivide and conquer+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Median on Binary TreeGiven a heap-shaped binary tree with distinct weights, for every a find the largest a-median, defined as the element at position floor((k-a+1)/2) of a subtree sorted by weight. | Hard8 | TreeDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Hacker Cups and BallsGiven a permutation and range sort operations that go ascending or descending depending on whether l < r, find the value in the middle cup at the end. | Hard8 | Binary searchSegment tree+2 | No attempts yet | 3s | 512 MB | Judgeable |
| PhysicsBalls move on a line with acceleration tied to speed, collide elastically, and each query asks for the k-th smallest velocity at time t. | Hard8 | MathSorting+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Value of the ArrayFor each k from 1 to n, sum over all non-empty subsequences the sum of their min(size, k) largest elements, modulo 998244353. | Hard8 | CombinatoricsSorting+2 | No attempts yet | 1s | 512 MB | Judgeable |
| TrianglesGiven up to 2000 distinct points, count right triangles formed by three of the points whose area falls in the inclusive range [A, B]. | Hard8 | GeometryHash map+2 | No attempts yet | 10s | 256 MB | Judgeable |
| Urban BlightGiven points and weighted segments, find a horizontal line whose intersection with the segments maximizes the total weight of segments it touches. | Hard8 | GeometrySorting+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| Voucher PreparationGiven members with distinct skills and names, answer many queries: remove the b highest-skilled members, then partition the best M*a remaining into a teams to maximize the summed product of skills, and output the XOR of the names of all chosen members. | Hard8 | GreedySorting+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| A Game with GrundyFor each i from 0 to N, count integer x positions with L <= x <= R that lie strictly inside at most i of N triangular visibility wedges. | Hard8 | GeometrySorting+2 | No attempts yet | 1s | 512 MB | Judgeable |
| How Many Burgers?Split N burgers with given utilities among three people so that the youngest gets the most he can while not exceeding either senior's total. | Hard8 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Rock ClimbingFind the smallest K such that every K-subset of N rocks contains two rocks A, B with A reachable from B by a strictly upward chain of moves, each move bounded by the max slippery rate. | Hard8 | GraphGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Cash GapGiven payments with allowed day ranges, decide whether some placement and ordering of the payments forces the balance below zero. | Hard8 | GreedySorting+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Operation <<Permutation>>Given inequalities between positions of an unknown permutation, find the earliest prefix of the conditions that pins down the permutation uniquely, or -1 if never. | Hard8 | GraphTopological sort+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Shushpanchiks and the CinemaGiven an n by n grid with m blocked seats, choose k consecutive free seats in one row minimizing the sum of Manhattan distances to a target seat. | Hard8 | MathIntervals+2 | No attempts yet | 2s | 512 MB | Judgeable |
| String ProcessingDecide whether a recursive split-and-swap program can turn string S into T, and if so output the 2^k - 1 bit program. | Hard8 | Divide and conquerString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Similar ArraysGiven pairs of positions, decide whether there is an array with all distinct values and an array with a repeated value that agree on every listed comparison, and output both arrays. | Hard8 | GraphDFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Pandemic 2On a weighted tree where some vertices start infected and the infection spreads along edges at speed one, find the maximum number of uninfected connected components that ever exist at one moment. | Hard8 | TreeDFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Team SelectionSplit N players into two equal teams so the difference between the captains' total scores is minimized, choosing the lexicographically smallest assignment. | Hard9 | Divide and conquerDynamic programming+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Good NumbersGiven a set S of forbidden integers, rank positive integers by how many good intervals (ranges containing only non-S values) contain each one, then print the first n. | Hard9 | CombinatoricsMath+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Goal CelebrationGiven a point inside a field with polygonal obstacles, find the farthest boundary point reachable by a straight segment that avoids the obstacles' interiors. | Hard9 | GeometrySorting+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Robot ArmGiven a rectilinear factory polygon and five candidate fixed points, decide for each whether an L-shaped two-segment robot arm confined to the polygon can reach every interior point. | Hard9 | GeometryIntervals+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Wake Up!Count the distinct points where any two of up to 20,000 line segments intersect, using an efficient computational geometry sweep. | Hard9 | GeometryDivide and conquer+2 | No attempts yet | 1s | 128 MB | Judgeable |
| OrchardGiven up to 2500 non-overlapping colored rectangles, find the maximum area axis-aligned rectangle fully covered by orchards of one fruit type. | Hard9 | GeometryMatrix+2 | No attempts yet | 2s | 64 MB | Judgeable |
| FenceGiven a square field with 4N fence posts and up to 30000 convex polygonal rocks blocking sight lines, count how many posts are visible from a given viewpoint using angular occlusion by polygon silhouettes. | Hard9 | GeometrySorting+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Hyeonju's Pizza ShopGiven jobs with desired completion times and processing times on a single machine, compute the maximum total tip (sum of signed lateness against desired times) after each of many update operations that change a job's parameters, requiring an efficient dynamic scheduling data structure. | Hard9 | GreedySegment tree+1 | No attempts yet | 2s | 128 MB | Judgeable |
| FPSGiven N players and Q candidate additions, count ways to pick K bots with distinct speeds/ranges each dominated by some human, modulo 10009. | Hard9 | CombinatoricsMath+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Chip RoutingAssign each marked point on a square chip a direction toward a side so that drawn segments never cross or pass through other points, minimizing the total segment length. | Hard9 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Hanging HatsSimulate mages hanging triangular hats on a wall, tracking nail visibility and expulsion under coverage rules that require an advanced geometric data structure. | Hard9 | GeometrySegment tree+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Cubic RubeGiven two connected 5x5 height maps of unit cubes, decide whether the pieces can be rotated and translated in 3D to assemble a full 5x5x5 cube. | Hard9 | ImplementationGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| PotholesPlace a straight rope across a rectangular lot without crossing any pothole so the total pothole area is split as evenly as possible, with tie-breaking rules. | Hard9 | GeometrySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ASCII ArtRender triangles with ASCII characters, projecting 3D vertices through a camera onto an S by S screen grid with depth-based visibility. | Hard9 | GeometryImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TeleportersPlace up to M new teleporters between given endpoints so the forced eastward walk triggers as many teleports as possible. | Hard9 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ContactGiven a binary string and a length range [A,B], report the N largest occurrence counts and all patterns achieving each count, with output ordering rules. | Hard9 | StringSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Ballroom LightsGiven point lightbulbs and disjoint circular columns inside a rectangle, compute the total length of the wall perimeter that some lightbulb can reach with a straight, unblocked ray. | Hard9 | GeometryMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Not Too Convex HullPartition the nails into B convex polygonal groups, all sharing the origin nail, minimizing the total covered area, with the origin strictly inside the global hull. | Hard9 | Dynamic programmingGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Largest FenceGiven N grid points with no three collinear, find the size of the largest subset whose points form the vertices of a convex polygon. | Hard9 | GeometryDynamic programming+2 | No attempts yet | 2s | 128 MB | Judgeable |
| LandingGiven up to 100000 integer points, find the largest circle whose boundary passes through at least three points and whose interior contains none, and output R^2 as a reduced fraction. | Hard9 | GeometryCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Move that Mouse AGAINGiven up to 50,000 axis-aligned rectangles in a fixed bottom-to-top stacking order, process 50,000 point clicks, printing the topmost window at each point and moving it to the top of the stack. | Hard9 | Segment treeGeometry+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Checker BoardEach row holds at most one checker per color; players slide their pieces along rows and the one who cannot move loses. Decide whether White wins, Black wins, or the game can run forever. | Hard9 | Game theoryGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TelecorpPlace one of M module types on any subset of N teleporters, each jump skipping ahead and multiplying speed, to minimize total travel time from 0 to L. | Hard9 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Find the BorderGiven a closed self-intersecting polyline, count the vertices of the border of its interior, the outer boundary enclosing all bounded regions. | Hard9 | GeometryImplementation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Suffix Array ReconstructionGiven a permutation p, decide whether it is the suffix array of some lowercase string and, if so, output the lexicographically smallest such string. | Hard9 | StringGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Dextrogyrate CamelFind the longest closed camel route that starts at oasis 1 heading to oasis 2, always turns right by at most 180 degrees at each oasis, never crosses itself, and visits the most distinct oases. | Hard9 | GeometryDynamic programming+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Bus TourChoose a sequence of attractions with strictly increasing construction times maximizing attractiveness collected plus Manhattan travel distance. | Hard9 | Dynamic programmingSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Save the DinosaursFor each vacant point, add it to the existing set and report the area protected by the soldiers (the region where every move gets closer to some soldier). | Hard9 | GeometrySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Wandering Flea TrainersGiven two functional graphs on n labeled nodes, decide whether some vertex relabeling makes the graphs isomorphic, i.e. the fleas' dance is identical. | Hard9 | GraphDFS+2 | No attempts yet | 3s | 128 MB | Judgeable |
| AB-wordsGiven up to 1000 nice ab-words (balanced parentheses words), count the maximum subset of pairwise non-similar words under a recursive similarity relation. | Hard9 | TreeHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TreesFor each tree, find the smallest adjacent-difference sum reachable by either keeping the row or swapping that tree with one other tree. | Hard9 | ArrayMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Computational BiologyFor each query length m, find a length-m word whose every cyclic rotation appears in s, maximizing the total count of those rotations in s. | Hard9 | StringSorting+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Army TrainingGiven n points with no three collinear, answer m queries, each a simple clockwise polygon on those points, counting the points strictly inside it. | Hard9 | GeometryCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Reconstructing the Convex PolygonGiven all edges and non-crossing diagonals of a convex polygon with shuffled vertex labels, recover the cyclic boundary order, with vertex 1 first and the smallest possible second vertex. | Hard9 | GraphImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| PeaksFor each query, starting from a peak and using only edges up to a difficulty limit, report the k-th highest reachable peak height or -1. | Hard9 | GraphUnion-find+2 | No attempts yet | 2s | 128 MB | Judgeable |
| The Most Valuable TowerFind the largest sum any single tower can reach by swapping top segments between towers of different heights. | Hard9 | Number theorySorting+2 | No attempts yet | 1s | 512 MB | Judgeable |
| GenomeBuild the lexicographically smallest sequence that is l adjacent swaps from the first genome and k-l swaps from the second. | Hard9 | GreedySegment tree+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Plot of LandGiven up to 3000 pine points and one million query rectangles, report the convex hull area of the points inside each rectangle. | Hard9 | GeometryDivide and conquer+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Thirsty AntsAnts on a line walk at unit speed toward the nearest fallen dew drop, and the task asks for every ant's position when the last drop is drunk. | Hard9 | SimulationSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Aquarium DrainageGiven an orthogonal aquarium floor with holes on its segments, compute the total drain time and the water left behind. | Hard9 | GeometrySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Lonely MountainGiven two orthogonal mountain silhouettes, decide whether any solid casts both and print the largest possible volume modulo 1000000007. | Hard9 | GeometryMath+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Largest and Smallest TriangleGiven n points in the plane, compute the largest and smallest areas among all triangles formed by triples of the points. | Hard9 | GeometrySorting+1 | No attempts yet | 6s | 128 MB | Judgeable |
| Green EnergyPlace towers of given heights on a polygonal terrain to maximize the total length lit by parallel sun rays blocked by terrain and other towers. | Hard9 | GeometryGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Rail Station RecoveryRecover every station's block number and C or D type from the all-pairs shortest-route distances and station 0's block. | Hard9 | GraphSorting+1 | No attempts yet | 3s | 512 MB | Judgeable |
| ParkingDecide whether axis-aligned cars in a strip of height w can be slid without overlap or rotation from the start layout to the target layout. | Hard9 | GeometryGraph+2 | No attempts yet | 3s | 256 MB | Judgeable |
| Pork barrelFor each query interval [l, h], build the cheapest forest using only roads with costs inside the interval that connects as many city pairs as possible. | Hard9 | Minimum spanning treeDivide and conquer+2 | No attempts yet | 30s | 256 MB | Judgeable |
| Hidden MazeCompute the expected median edge weight over all tree node pairs at odd distance, and print it as a reduced fraction. | Hard9 | Divide and conquerTree+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Same Suffix ArrayCount the strings that differ from the given length N string in exactly one position and keep the same suffix array. | Hard9 | StringString matching+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Radio WatchtowersKeep K of N towers on a line and raise their radio powers so each pair of kept towers can talk, minimizing raise cost minus sale income. | Hard9 | GreedySorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| CircusFind the smallest starting hold depth on a temporary rope at D that reaches distance M by hopping between ropes within swing range. | Hard9 | Shortest pathSegment tree+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Spin DoctorGiven n points (a_i, b_i) labeled 1 or 0, choose a direction (S, T); with ties broken adversarially, minimize the span covering all label-1 points. | Hard9 | GeometrySorting+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Connect HighwaysGiven two planar connected networks, find the Red-Blue junction pair allowed to be joined by a segment, following a fixed angular tie-breaking rule. | Hard9 | GeometrySorting+2 | No attempts yet | 0.4s | 32 MB | Judgeable |
| Covering postersFor each new axis-aligned rectangle, compute the total area of the given union of rectangles that it covers. | Hard9 | Segment treePrefix sum+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| Archaeological ResearchGiven the surviving shuffled entries of a table of next occurrences for an unknown alphabet size, recover the lexicographically smallest original sequence or report that none exists. | Hard9 | GreedyGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Clique on a LineGiven n points on a line with weights, two points are adjacent when their weights sum to at most their distance; find the largest clique. | Hard9 | Dynamic programmingSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Smallest Unpayable AmountFor each query interval, find the smallest positive amount that cannot be formed as a subset sum of the coins in that interval. | Hard9 | GreedySorting+2 | No attempts yet | 4s | 512 MB | Judgeable |
| PostersCompute the visible area of each of N rectangles pasted in order on the plane, where later rectangles cover earlier ones. | Hard9 | GeometryDivide and conquer+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Laser SensorsGiven N blue points and 2N red points in general position, build the particular non-crossing perfect matching prescribed by the paper's recursive angular-sweep Solve/Attach procedure. | Hard9 | Divide and conquerGeometry+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Counting points inside a circleFor each of M circle queries, count how many of N fixed points lie inside or on the circle, printing the count per query. | Hard9 | GeometryDivide and conquer+2 | No attempts yet | 8s | 512 MB | Judgeable |
| Sequence and Queries 9For each query range [i,j] and value k, count ordered pairs (p,q) from that range with A[p]*B[q] <= k. | Hard9 | Divide and conquerSegment tree+2 | No attempts yet | 6s | 512 MB | Judgeable |
| Where are the bubbles?Given the per-turn swap counts of bubblesort, reconstruct the lexicographically largest permutation that produces exactly those swap counts. | Hard9 | ImplementationGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Allowed swapsMaintain an array under swaps and union operations, answering whether it can be sorted and counting pairs of clouds whose merge would fix both. | Hard9 | Union-findImplementation+2 | No attempts yet | 6s | 512 MB | Judgeable |
| Appropriate Coordinate MapGiven N points, choose a ring through all of them and endpoints A, B so the two legs are monotone in the projection onto AB, maximizing the smallest gap in that projection. | Hard9 | GeometryGreedy+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Triple treeGenerate triples (a,b,c) satisfying a^2+b^2+c^2 = k(ab+bc+ca)+1 by two sweep operations from (1,k,k+k^2), then greedily print triples whose numbers are all new. | Hard9 | MathNumber theory+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Large Ping Pong TournamentGiven the total points each of 2^N players scored in a knockout ping pong tournament, decide if Dudu, who always wins ties, could have been champion. | Hard9 | GreedySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Robotic Cow HerdEach robot picks one model per location, and all K robots must differ somewhere; find the minimum total cost of K distinct robots. | Hard9 | HeapGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Soldiers (Large)Two players alternately pick soldiers, each new pick must beat all previous picks in attack or in defense; decide if the first player can end up with strictly more picks. | Hard9 | Game theoryDynamic programming+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Clash Royale (Large)Pick 8 of N cards and spend at most M coins on upgrades to maximize the total attack power of the chosen deck. | Hard9 | Dynamic programmingGreedy+1 | No attempts yet | 20s | 512 MB | Judgeable |
| Rides 2Each day one child grows by 1 or 2, and we must report how many of Q fixed child-pair and ride triples become valid that day. | Hard9 | Segment treeSorting+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Distinct Substring QueriesMaintain a string under push-back and pop-front operations, reporting the number of distinct substrings after each of up to a million queries. | Hard9 | StringString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Rolling the BottleGiven a convex polygon as a bottle base and a water volume, find the minimum and maximum number of sides of the water region as the bottle rolls. | Hard9 | GeometrySorting+2 | No attempts yet | 2.5s | 512 MB | Judgeable |