Problems

Pick a problem and write your solution in the built-in editor. The judge runs it against real test cases while you watch, and the wider archive is open to read whenever you like.

Total results2,730 problems
TitleLevelTopicsSolvedTime limitMemory limitJudge
Crazy RotationsGiven a row of coloured lights, find the smallest rotation amount that can appear at position p in a non-decreasing sequence of rotation craziness values.Hard9String matchingCombinatorics+2No attempts yet15s512 MBJudgeable
GCD SumFor each k from 1 to n, split a multiset of n numbers into k nonempty groups to maximize the sum of the groups' gcds. n is up to 500000 and each value up to 10^12.Hard9Number theoryGreedy+2No attempts yet2s1024 MBJudgeable
Lunar LandscapeCompute the total area covered by axis-aligned squares and 45-degree rotated squares, counting overlaps once.Hard9GeometrySorting+1No attempts yet2s512 MBJudgeable
Journey from Petersburg to MoscowFind the minimum cost path from city 1 to city n where only the k most expensive edges of the path are paid for, or all edges if the path has k or fewer.Hard9GraphShortest path+2No attempts yet3s512 MBJudgeable
Laminar FamilyGiven an undirected tree and f vertex sets, each a simple path, decide whether the family of paths is laminar.Hard9TreeDFS+2No attempts yet2s512 MBJudgeable
GardenerMaintain N gardens under plantings, range deletions of plants taller than h, and range count queries, all with time-dependent growth.Hard9Segment treeBinary search+2No attempts yet3s128 MBJudgeable
In honor of Taekhee's graduationDeer bounce on a line segment [0,T], each with strength; a statue at x falls when the net force of deer that have reached it exceeds W. Maximize the fall time over x.Hard9MathSimulation+2No attempts yet3s128 MBJudgeable
New HomeStores of k types each occupy a point and an open year interval; for each (location, year) query, report the maximum over types of the distance to the nearest open store of that type, or -1 if some type is missing.Hard9Segment treeBinary search+2No attempts yet5s1024 MBJudgeable
Circle SelectionProcess circles in decreasing radius order; each chosen circle removes all remaining circles that intersect it, and for every circle you must report which chosen circle eliminated it.Hard9GeometrySorting+2No attempts yet3s1024 MBJudgeable
The SprawlOn an infinite grid, N cities grow one cell per day in index order; sum over all pairs the first day the two cities' territories touch and connect.Hard9GraphBFS+2No attempts yet5s768 MBJudgeable
Cloud computingChoose a set of orders and a set of computers to buy so every accepted order gets enough cores at its minimum clock rate, maximizing payments minus computer costs.Hard9Dynamic programmingGreedy+2No attempts yet2s512 MBJudgeable
ConstellationChoose a subset of up to 2e5 points maximizing total brightness so that from any chosen point all others fall in the first or third quadrant, with the nearest point in each occupied quadrant within Chebyshev distance L.Hard9MathGeometry+2No attempts yet1.5s512 MBJudgeable
Monitoring Ski PathsA DAG has at most one outgoing edge per junction and unique landing points; pick the fewest junctions met by all m registered s-to-t to-basement paths.Hard9GraphGreedy+2No attempts yet2s512 MBJudgeable
Removing Magical TilesGiven trapezoid tiles above the x-axis, find the minimum number of groups where each group is a set of tiles that pairwise overlap.Hard9GreedyGeometry+2No attempts yet2s512 MBJudgeable
Mowing MischiefGiven flowers on a grid, pick a longest chain of flowers both paths must visit, then find the minimum area the two monotone paths can sweep.Hard9Dynamic programmingSorting+2No attempts yet2s512 MBJudgeable
Query and QueryEach query swaps two sequence values; after every swap, pair up the M left-pocket indices and M right-pocket indices to minimize the largest range maximum. Output that minimized maximum.Hard9Segment treeGreedy+2No attempts yet2s512 MBJudgeable
The Tallest and Widest CastleChoose which signposts serve as vertices of each floor so the castle has the most floors, then the largest total floor area, then the fewest signposts used, and report each signpost's floor number.Hard9GeometryDynamic programming+2No attempts yet1s512 MBJudgeable
EmploymentGiven candidate evaluation values with point updates, answer queries asking for the number of maximal contiguous blocks of hired candidates whose value is at least a threshold.Hard9Segment treeDivide and conquer+2No attempts yet5s512 MBJudgeable
Historical ResearchFor each query range, report the maximum over event types t of t times the count of t inside the range.Hard9Divide and conquerArray+2No attempts yet4s512 MBJudgeable
Construction ProjectPlace at most H airports among N towns and connect all towns with axis-parallel roads that avoid M rectangular obstacles, minimizing airport cost times count plus total road length.Hard9Minimum spanning treeGeometry+2No attempts yet5s256 MBJudgeable
Sequence and Queries 34Maintain two integer sequences under updates and range queries: for a suffix of a compute the longest match against b and how many suffixes achieve it, compare suffixes of b, and test whether a concatenation of two b-substrings is itself a substring of b.Hard9String matchingSegment tree+2No attempts yet2s512 MBJudgeable
Nearest PointsCount the integer lattice points in an axis-aligned rectangle whose Euclidean distance to p1 is the minimum among K marked points.Hard9GeometryDivide and conquer+2No attempts yet2s512 MBJudgeable
Help Yourself (Platinum)Sum the K-th power of the number of connected components of the union over all 2^N subsets of N intervals, modulo 1e9+7.Hard9CombinatoricsDynamic programming+2No attempts yet2s512 MBJudgeable
Unseen SegmentsGiven n vertical segments and queries of (west power, east power), find the total length of parts no observer sees through at most that many segments.Hard9GeometrySorting+2No attempts yet2s256 MBJudgeable
Good GameCount monotone lattice paths in n dimensions from the origin to a target, avoiding m forbidden points, modulo 1e9+7.Hard9CombinatoricsDynamic programming+2No attempts yet2s512 MBJudgeable
Random PointsGiven n points in general position, output 2^n times the expected number of vertices of the convex hull of a uniformly random subset, modulo 1e9+7.Hard9GeometryCombinatorics+2No attempts yet5s512 MBJudgeable
Jong Hyok and StringGiven n pattern strings, for each query string Q count the substrings T of the patterns with the same set of (pattern, end position) occurrence pairs as Q.Hard9StringTrie+2No attempts yet1s1024 MBJudgeable
JumpGiven cities at integer grid points and portals that jump from one city to any city inside an axis-aligned rectangle at a given cost, find the shortest time from city 1 to every city.Hard9Shortest pathGraph+2No attempts yet1s512 MBJudgeable
The Potion of Great PowerGiven a graph whose edges change once per day with degree at most D, answer queries online for the minimum altitude difference between a neighbor of x and a neighbor of y on a given day.Hard9GraphSorting+2No attempts yet3s256 MBJudgeable
Find Marble Positions and VelocitiesReconstruct each marble's starting x-coordinate and constant velocity from N+1 unordered snapshots of N linearly moving marbles.Hard10MathCombinatorics+2No attempts yet2s128 MBJudgeable