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 |
|---|---|---|---|---|---|---|
| Consecutive OnesPermute the columns of a 0-1 matrix so that the 1s in every row are consecutive, with column 0 fixed as the first column. | Hard8 | GraphImplementation+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| The K-th NumberGiven an array of distinct integers and m range queries, return the k-th smallest value inside each queried subarray. | Hard8 | Binary searchDivide and conquer+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Destroying the GraphFind the minimum cost to cover every arc of a directed graph by choosing, for each vertex, to delete its incoming or outgoing arcs. | Hard8 | GraphMinimum spanning tree+2 | No attempts yet | 1s | 512 MB | Judgeable |
| PlatformsGiven points with distinct x, find the longest chain of flights where each next point has larger x and no larger y, then report every point lying on some longest chain. | Hard8 | Dynamic programmingSorting+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Box ArtGiven a bounding box and up to 2000 axis-aligned boxes, compute the volume of their union clipped to the bounding box. | Hard8 | GeometrySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| FrogGiven axis-aligned non-touching squares in the first quadrant and a jump reach d, find the largest x+y over squares reachable from the square at the origin. | Hard8 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Lattice Points in the Union of CirclesCount integer lattice points inside the union of up to 10,000 circles, restricted to the coordinate box from -16383 to 16384. | Hard8 | GeometrySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Missing LettersReconstruct a space-free corrupted string into words from a known vocabulary, choosing the highest-scoring word segmentation and breaking ties alphabetically. | Hard8 | Dynamic programmingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Jury CompromisePick exactly m candidates minimizing the prosecution minus defence imbalance, breaking ties by the largest total value, then by lexicographically smallest candidate list. | Hard8 | Dynamic programmingSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| The RaceCount all overtakes among spaceships with given starting positions and speeds, then list the first 10000 in time order. | Hard8 | SortingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| RectanglesGiven N axis-aligned rectangles, compute the area of their union. | Hard8 | Segment treeSorting+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Empty TrianglesGiven N lines with no three concurrent, count the triangles whose interior is not crossed by any other line. | Hard8 | GeometryCombinatorics+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Game RiggingGiven a set of players, a subset of friends, and known guaranteed match-up outcomes, decide whether a friend can be made to win the elimination tournament. | Hard8 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Rectangles Too!Find the longest chain of rectangles where each rectangle lies strictly below and to the left of the next one. | Hard8 | SortingDynamic programming+1 | No attempts yet | 3s | 128 MB | Judgeable |
| 2D MatrixSplit N points into two disjoint non-empty sets, each centrally symmetric, and print every division's two centres in lexicographic order. | Hard8 | Hash mapSorting+2 | No attempts yet | 1s | 64 MB | Judgeable |
| Cover All Points with Three SquaresFind the smallest integer side length d so that three axis-aligned d×d squares can cover all N given points. | Hard8 | Binary searchGreedy+2 | No attempts yet | 2s | 64 MB | Judgeable |
| Cyclic Rotation CipherReconstruct the original lowercase string from its Burrows-Wheeler transform index i and last column R. | Hard8 | StringSorting+1 | No attempts yet | 1s | 32 MB | Judgeable |
| Painting PatternsCount grid cells painted black by up to N rectangle operations, each applying one of three periodic patterns under OR overlap. | Hard8 | GeometryPrefix sum+2 | No attempts yet | 2s | 64 MB | Judgeable |
| Union Area of TrianglesGiven right isosceles triangles with axis-parallel legs and hypotenuse of slope -1, compute the area of their union. | Hard8 | GeometrySegment tree+2 | No attempts yet | 1s | 32 MB | Judgeable |
| CakesSchedule dough preparation and single-oven baking for N cakes so that all finish as early as possible. | Hard8 | GreedySorting+1 | No attempts yet | 1s | 32 MB | Judgeable |
| Knowledge for the MassesEach row's racks keep their order and can shift left or right at cost 1 per rack; find the cheapest passage position and all positions attaining it. | Hard8 | GreedyPrefix sum+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Closest PointFor each of N points, output the squared distance to the nearest other point. | Hard8 | Divide and conquerSorting+2 | No attempts yet | 3s | 128 MB | Judgeable |
| The PicnicGiven up to 99 points, find the largest convex polygon whose vertices are points and whose interior contains no other point. | Hard8 | GeometryDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Bytean Road RaceGiven a planar south/east DAG from node 1 to node n, answer queries asking whether some monotone path passes through both given crossings. | Hard8 | GraphDFS+2 | No attempts yet | 3s | 64 MB | Judgeable |
| Evaluation of an ExpressionCount assignments of values to variables modulo a prime that make a given sparse polynomial expression zero, output modulo 30011. | Hard8 | MathNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Fruit ChickenA tree has shops at one end and houses at the other, separated by a single bridge edge; assign each open shop a distinct house minimizing the time until all couriers arrive, with no two couriers sharing a road at once. | Hard8 | TreeBinary search+2 | No attempts yet | 3s | 128 MB | Judgeable |
| MotorwaysAssign each of k motorway chords to one of two sides so that no two chords on the same side interleave, choosing the lexicographically smallest assignment. | Hard8 | GraphSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| B-Smooth NumbersCount B-smooth numbers (no prime factor above B) in the interval [n, n+m], with n up to 2e9, m up to 1e8, and B up to 1e6. | Hard8 | Number theorySegment tree+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Labyrinth of WellsGiven a colored DAG where each room has three outgoing wells, find the minimum number of rooms in a DAG producing the same color sequence for every path. | Hard8 | GraphDynamic programming+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Empty CuboidsGiven up to 5000 integer points, find the largest axis-aligned box anchored at the origin whose strict interior contains none of the points, and output its volume. | Hard8 | SortingTwo pointers+2 | No attempts yet | 3s | 128 MB | Judgeable |
| RocketsMatch the n red points to the n white points with non-crossing segments so the total Euclidean length is minimum, and report the matching. | Hard8 | Dynamic programmingDivide and conquer+2 | No attempts yet | 1s | 128 MB | Judgeable |
| AltarsFor each rectangle temple, decide whether a ray from its center can exit through the half-wall entrance and escape to infinity without touching any rectangle. | Hard8 | GeometryImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Flat Broken LinesGiven n points, find the minimum number of flat broken lines (each moving right with segment slopes between -1 and 1) needed to cover all points. | Hard8 | GreedySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| RooksPlace n non-attacking rooks, one per given axis-aligned rectangle, or report that no placement exists; output the lexicographically smallest placement. | Hard8 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Disk OptimizationGiven disk sectors holding files split across blocks, find the minimum copy/swap cost to pack files into consecutive sorted blocks. | Hard8 | SortingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| WarehouseFind a crossroads minimizing the weighted sum of Chebyshev distances to n shops. | Hard8 | GeometryBinary search+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SchoolsAssign a distinct number 1..n to each school within its allowed interval, minimizing the total weighted movement cost. | Hard8 | GreedyDynamic programming+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Rock GardenEach boulder may keep or swap its two coordinates; choose swaps so the axis-aligned bounding rectangle perimeter is minimal, then minimize total swapped weight. | Hard8 | GreedySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Gas PipelinesAssign each of n extraction points to a distinct station southeast of it, minimizing the total Manhattan distance. | Hard8 | GreedySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Mirror TrapGiven a rectilinear polygon, pair up its corners by tracing 45-degree laser beams that reflect off mirror walls until each beam lands in another corner. | Hard8 | GeometrySimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ElephantsGiven elephant masses and two permutations, find the minimum total cost of swaps (cost = sum of the two masses) to convert the first order into the second. | Hard8 | GreedyGraph+2 | No attempts yet | 3s | 512 MB | Judgeable |
| BeadsSplit the bead string into blocks of size k (leftover dropped) and find the k that maximizes the count of distinct blocks, where a block and its reversal are the same. | Hard8 | StringHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Tree Rotations 2Given a binary tree with distinct leaf labels, rotations swap children at any node; find the minimum possible inversion count of the leaf sequence. | Hard8 | Divide and conquerRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SquarksGiven the n(n-1)/2 pairwise sums of n distinct positive integers, find and list all sets of n integers whose pairwise sums match these values, in lexicographic order. | Hard8 | SortingBrute force+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Warehouse StoreGiven daily deliveries a_i and daily orders b_i, choose which orders to accept so that the warehouse never runs out of stock, maximizing accepted orders. | Hard8 | GreedyHeap+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Painting the WallGiven n axis-aligned rectangles, find the total area of the plane covered by at least n-1 of them. | Hard8 | SortingSegment tree+2 | No attempts yet | 1s | 128 MB | Judgeable |
| FosaGiven horizontal and vertical segments, find the largest axis-aligned square whose entire perimeter lies on those segments, or report that none exists. | Hard8 | GeometrySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| VacationFind a permutation of n attractions minimizing the total capped positional distance to k given rankings (k at most 3). | Hard8 | Dynamic programmingSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Byteland Worldbeat PublishersGiven a sparse matrix of pair efficiencies (some described by row-wise column ranges), decide whether all maximum-size matchings have the same total weight. | Hard8 | GraphGreedy+2 | No attempts yet | 5s | 128 MB | Judgeable |
| TelescopeChoose an order for the coins and insertion times so that the paid viewing windows cover as many meteor intervals as possible. | Hard8 | Dynamic programmingSorting+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Map 2Count integer starting points (a,b) such that each of the four diagonal quadrants around (a,b) contains at least one of n marked points. | Hard8 | SortingPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Byteball MatchGiven partial results of a round-robin group, list every team that can still finish first once all remaining matches are played, under points and goal-difference tiebreaks. | Hard8 | GraphBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| PermutationFor a sequence a and each of m point updates, report whether a permutation p with p_i <= a_i for all i exists. | Hard8 | GreedySegment tree+1 | No attempts yet | 1s | 128 MB | Judgeable |
| CakesSum, over every triangle in an undirected graph, of the maximum vertex weight in that triangle. | Hard8 | GraphSorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| TurnsFor each starting position, find how many turns must be observed before the position on the map becomes uniquely determined. | Hard8 | StringString matching+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Near 2Given n tree points and m apple points, find the minimum over all apples of the Manhattan distance to the nearest tree. | Hard8 | Divide and conquerGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| CloudsGiven disjoint simple polygons and a fixed wind direction, place a point so the number of polygons that cross the vertical ray above it at some time is maximized. | Hard8 | GeometrySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Sum of PolygonsAdd two convex polygons by Minkowski sum and print twice the area of the resulting polygon. | Hard8 | GeometryTwo pointers+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TetrisEach block is a horizontal strip 1 unit tall; given its length and left offset, choose the drop order that minimizes the final stack height. Output that minimum. | Hard8 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SupercomputerGiven jobs with arrival times and required processor-time, schedule them with preemption on a single 100% processor to minimize the sum of completion-minus-arrival times. | Hard8 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ScreensaverA point moves diagonally and reflects off a set of disjoint horizontal and vertical wall segments; report its position after t seconds. | Hard8 | GeometrySimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Power of the ArrayGiven an array and t range queries, compute for each subarray the sum over values s of s times the square of s's frequency in the range. | Hard8 | ArrayPrefix sum+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Creative AccountingGiven daily balances, pick a contiguous period whose sum modulo m (with nonnegative remainder) is as large as possible, and report that maximum remainder. | Hard8 | Prefix sumMath+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Express DeliveryGiven a depot and clients with distinct x and y coordinates, find the fewest monotone (shortest-path) routes from the depot that cover all clients. | Hard8 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Spy SatellitesGiven a terrain polyline with some marked points, place satellites on the line y=H so their visibility segments cover all marked points, minimizing the count. | Hard8 | GeometryGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| BajtoriSelect a subset of squares to maximize the sum of the squared red total and squared green total. | Hard8 | GeometrySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Fence In Godzilla!The task is to find the smallest nonzero area among triangles with vertices from n points. | Hard8 | GeometrySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Untamed TreeThe task is to output for each leaf label the compressed subtree of its leaves and branching ancestors in preorder. | Hard8 | TreeSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| VirusesGiven up to 24 virus sources with distinct daily hours, determine how many cells each one ends up occupying on an n by n board. | Hard8 | GeometryBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Company ChoirGiven a rooted tree where each node has a pitch and a distinct ability score, answer queries that ask for the k highest-ability subordinates of a node whose pitch lies in a range [a,b]. | Hard8 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| MapsGiven up to a million arbitrarily rotated rectangles, find the number of edges of their common intersection polygon. | Hard8 | GeometryImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| BeetlesGiven n segments, find the smallest axis-aligned square that contains at least k of them entirely, with boundary counted as inside. | Hard8 | Binary searchGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| City WallDecide whether every segment of a polygonal city wall is visible from an interior church point without occlusion by other segments. | Hard8 | GeometrySorting | No attempts yet | 1s | 512 MB | Judgeable |
| ConductorsConductors with different speeds start at their own compartments and take the smallest unchecked one when free, and the goal is the last compartment of each. | Hard8 | Binary searchMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| DrzewaFor each node of a labeled rooted tree, find the leaf below it whose downward label string is lexicographically largest, breaking ties by smaller leaf number. | Hard8 | TreeGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TrójmiastoPick three of up to one million points in the plane so the sum of their three pairwise distances is smallest. | Hard8 | GeometryDivide and conquer+1 | No attempts yet | 10s | 128 MB | Judgeable |
| The ChampionshipPair as many employees as possible so each team holds two people with neither managing the other. | Hard8 | GreedyTree+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Contour MapGiven up to 20000 non-crossing convex orthogonal polygons, compute the maximum nesting depth where the outermost level is 1. | Hard8 | GeometrySorting+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Sports Channel GSKGiven match start times, durations, and travel times, find the largest set of matches in which no reporter can cover any two. | Hard8 | GraphSorting | No attempts yet | 2s | 128 MB | Judgeable |
| Block CompactionRepeatedly drop axis-aligned rectangles down and then left until none moves, and report the width and height of the final bounding box. | Hard8 | SimulationGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| InstallationsOrder jobs with given service times and deadlines to minimize the sum of the two largest lateness penalties. | Hard8 | Dynamic programmingSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Opening a RestaurantCount the grid intersections that beat every existing restaurant in distance to apartment A or to apartment B. | Hard8 | GeometrySorting+1 | No attempts yet | 5s | 128 MB | Judgeable |
| KTX Train DepotFind the smallest number of straight tracks on which trains entering from either end before midnight can all leave toward their fixed ends on time. | Hard8 | GreedySorting+1 | No attempts yet | 5s | 128 MB | Judgeable |
| A Lazy WorkerJobs have processing times with arrival times and deadlines, and the worker picks among available jobs without idling to minimize total executed work. | Hard8 | Dynamic programmingSorting | No attempts yet | 1s | 128 MB | Judgeable |
| CastlesFind the minimum Manhattan distance between any west-bank castle and any east-bank castle from two monotone chains. | Hard8 | GeometrySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| StainsTaeyeon covers integer points off the x-axis with diamonds centered on the x-axis and minimizes the sum of their areas. | Hard8 | Dynamic programmingGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Tree LabelingThe program counts labelings of a tree with up to 1000 vertices that preserve each label's neighbor label set. | Hard8 | TreeCombinatorics+1 | No attempts yet | 1s | 128 MB | Judgeable |
| BooksortGiven a permutation of 1 to n with n at most 15, find the fewest adjacent block swaps that sort it, reporting 5 or more when the minimum exceeds 4. | Hard8 | BacktrackingBrute force+1 | No attempts yet | 1s | 128 MB | Judgeable |
| RingworldGiven n circular arcs on a ring of m cities, decide whether each arc can take a distinct city inside it. | Hard8 | GreedyIntervals+1 | No attempts yet | 2s | 128 MB | Judgeable |
| The Avaricious ISPChoose two disjoint disks over weighted points to maximize the product of the covered weight sums. | Hard8 | GeometrySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Janeway's JourneyFind the single straight line that hits the greatest number of disjoint circular asteroids in the plane. | Hard8 | GeometrySorting+1 | No attempts yet | 40s | 128 MB | Judgeable |
| Inverting HuffmanGiven code lengths that some Huffman run can produce, find the smallest total character count that allows those lengths. | Hard8 | GreedyTree+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Longest ChainFind the longest chain of triples with all three coordinates strictly increasing among up to 300,000 points per dataset. | Hard8 | Divide and conquerDynamic programming+2 | No attempts yet | 10s | 128 MB | Judgeable |
| TV TransmittersSome rooftops hold transmitters, buildings block their straight rays, and the total length of ground that sees one transmitter is printed as a reduced fraction. | Hard8 | GeometryIntervals+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Increasing Shortest PathFind the cheapest A to B path using at most C edges whose weights strictly increase. | Hard8 | Dynamic programmingShortest path+2 | No attempts yet | 15s | 256 MB | Judgeable |
| Highway of the FutureGiven each car entry time and speed, compute the largest number of cars at the same spot at the same time on a 100-unit highway. | Hard8 | GeometrySorting+2 | No attempts yet | 10s | 128 MB | Judgeable |
| 2D Solar SystemCircles tangent to one straight line glide with constant velocity, and the program reports when the first two touch. | Hard8 | GeometrySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Wedding HallFind the largest L-shaped hall of three equal squares that fits inside a walled garden without enclosing any tree. | Hard8 | GeometryBinary search+2 | No attempts yet | 1s | 128 MB | Judgeable |
| FerriesCaptains at each island reassign fixed ferry fares among destinations to maximize the cheapest fare from island 1 to island N. | Hard8 | Shortest pathGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Rent-A-PixelCompute the smallest row- and column-convex block set containing the given blocks and print its outline corners clockwise. | Hard8 | GeometryIntervals+1 | No attempts yet | 3s | 128 MB | Judgeable |