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 results1,917 problems
TitleLevelTopicsSolvedTime limitMemory limitJudge
Counting Bow TiesCount 4-cycles in a bipartite graph defined by M rectangles over vertex ranges, with N up to 1e9.Hard8GeometryCombinatorics+2No attempts yet2s256 MBJudgeable
Warp DrivePlace two warp points on the plane to minimize the root mean square of flight times, where each time is min(direct, dist to nearest warp) divided by speed.Hard8GeometryBrute force+1No attempts yet8s512 MBJudgeable
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.Hard8GeometryBinary search+2No attempts yet1s512 MBJudgeable
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.Hard8GeometrySorting+1No attempts yet1s512 MBJudgeable
Magic Towers and TeleportationDecide whether repeatedly reflecting the whole set of points across three fixed towers can turn one given point multiset into another, with soldiers considered indistinguishable.Hard8GeometryMath+2No attempts yet2s512 MBJudgeable
Keeping the Dogs ApartTwo dogs follow their own polyline routes at the same constant speed; find the minimum distance between them while both are still walking.Hard8GeometryTwo pointers+2No attempts yet6s512 MBJudgeable
Cover the Polygon with Your DiskPlace a fixed-radius disk anywhere on the plane to maximize the area shared with a convex polygon, and print that maximum.Hard8GeometryBinary search+1No attempts yet3s512 MBJudgeable
Number of RegionsGiven A and B, count the regions into which the A times B lines y = ax + b with 0 <= a < A, 0 <= b < B divide the plane.Hard8CombinatoricsGeometry+1No attempts yet2s512 MBJudgeable
Segments in a Regular PolygonCount the orders in which the remaining polygon vertices can be visited so each new segment crosses an existing one and the path closes back to P0.Hard8BacktrackingDynamic programming+2No attempts yet2s512 MBJudgeable
Counting ear shapesCount quadruples of red points and pairs of blue points forming an ear shape with angle and containment conditions.Hard8GeometryBrute force+2No attempts yet2s512 MBJudgeable
Distance to the nearest pointFor each of N points, report the Manhattan distance to the nearest other point.Hard8GeometryDivide and conquer+1No attempts yet2s512 MBJudgeable
RoomGiven points on the edges of an unknown orthogonal monotone polygon with edge orientations, reconstruct it and output its perimeter or -1 if impossible.Hard8GeometrySorting+2No attempts yet2s512 MBJudgeable
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.Hard8GeometryBinary search+2No attempts yet1s512 MBJudgeable
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.Hard8GeometrySorting+1No attempts yet1s512 MBJudgeable
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.Hard8GeometrySorting+2No attempts yet2s512 MBJudgeable
Marble slideA ball rolls down alternating left and right fins, and we must find the largest diameter for which it still slides all the way to the bottom instead of getting wedged.Hard8GeometryBinary search+2No attempts yet2s512 MBJudgeable
War Among the StarsCompute the shortest distance between two tetrahedra in space, given the coordinates of their eight vertices.Hard8GeometryImplementation+1No attempts yet2s512 MBJudgeable
Scientists' RegattaGiven start, finish, and non-intersecting segment obstacles in the plane, compute the shortest path that never crosses a segment interior.Hard8GeometryShortest path+2No attempts yet2s512 MBJudgeable
Ghostbusters 2Assign each of N points a horizontal or vertical cross arm of equal length P so no two same-orientation arms intersect; find the max P or report UNLIMITED.Hard8GeometryBinary search+2No attempts yet2s512 MBJudgeable
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.Hard8GeometryGreedy+2No attempts yet2s512 MBJudgeable
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.Hard8GeometryDynamic programming+2No attempts yet2s512 MBJudgeable
Individually Customised Pop-up CardsFor a pop-up card folding on parallel axes, find the minimum distance to move the contact point (Xp,0) so a matching second segment exists.Hard8GeometryMath+2No attempts yet3s512 MBJudgeable
Sky JumpGiven N engines that instantly set velocity, each usable once, decide if the gravity-driven missile starting at the origin can pass through a target point.Hard8MathGeometry+2No attempts yet8s512 MBJudgeable
Alice and the BombGiven disjoint polygons, a bomb point, and Alice at the origin, find the shortest path she runs outside all polygon interiors until some building blocks the blast to the bomb.Hard8GeometryShortest path+2No attempts yet8s512 MBJudgeable
Camera ControlMembers move along timed polygonal routes around a fixed camera, and you may switch followers only when two members lie on the same ray; maximize total time filming a singing member.Hard8GeometryDynamic programming+1No attempts yet8s512 MBJudgeable
Neko's TreasureGiven n disjoint-or-nested circles, choose a valid subset so the rat crossing from its lair to the bed crosses the fewest walls.Hard8GeometryBFS+1No attempts yet8s512 MBJudgeable
Dig or ClimbGiven a polyline terrain cross-section, find the shortest travel time from the first point to the last, walking along the surface or tunneling horizontally between two same-height points whose interior stays below the terrain.Hard8GraphShortest path+2No attempts yet8s512 MBJudgeable
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.Hard8GeometrySorting+2No attempts yet8s512 MBJudgeable
Colony MaintenanceGiven up to 16 unit cubes forming a connected polycube, find the shortest path over its exposed surface between two points, with moves constrained by the three surface-adjacency cases.Hard8GraphBFS+2No attempts yet8s512 MBJudgeable
Turn PolygonsGiven a rotating polygon around a center and a fixed convex polygon inside it, find the angle until the two polygons first touch.Hard8GeometryBinary search+2No attempts yet8s512 MBJudgeable
The Extreme SlalomGiven up to 12 disjoint line-segment gates in order, find the shortest path that touches each gate in sequence.Hard8GeometryDynamic programming+1No attempts yet8s512 MBJudgeable
Light the RoomGiven an orthogonal polygon room with a lamp, trace rays that reflect once off the walls and find the total wall length left unlit.Hard8GeometrySimulationNo attempts yet8s512 MBJudgeable
Counting Self-Rotating SubsetsFor each size i, count the subsets of the given N points that a nontrivial rotation maps onto themselves, modulo 1e9+7.Hard8GeometryCombinatoricsNo attempts yet2s512 MBJudgeable
Find CGiven lattice points A and B, list K lattice points C such that both segments AC and BC are primitive and triangle ABC contains no other lattice point.Hard8Number theoryGeometry+2No attempts yet1s512 MBJudgeable
Flyswatter placementsCount the integer translations of a fixed polygon that keep it inside an axis-aligned rectangle and avoid all given points, including points on the boundary.Hard8GeometryPrefix sum+2No attempts yet1s256 MBJudgeable
CruiseChoose a closed polygonal cruise from Piraeus through the islands so that collected point value divided by route length is maximized.Hard8GeometryDynamic programming+2No attempts yet2s512 MBJudgeable
Jenga BoomSimulate removals from a Jenga-like tower and report whether it falls, and at which removal, when a level's center of mass leaves the convex hull of the blocks still supporting it.Hard8GeometrySimulation+2No attempts yet2s512 MBJudgeable
Solar FlightFor a line segment query, find the maximum total intercept-weight above a given ray over all x in a length-K window.Hard8GeometrySorting+2No attempts yet15s512 MBJudgeable
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.Hard8GeometrySorting+2No attempts yet2s512 MBJudgeable
FenceSum x! times y! over all unit cells inside an axis-aligned polygon, modulo 1e9+7, with coordinates up to 1e9.Hard8MathPrefix sum+2No attempts yet3s512 MBJudgeable
Quadrilateral blanketGiven N points and an area limit L, pick four points forming a simple quadrilateral with area at most L, maximizing that area.Hard8GeometryBrute force+2No attempts yet5s128 MBJudgeable
Painting SquaresAn infinite canvas starts white; each step picks the largest monochrome axis-aligned square of side at most D centered at a given point and flips its color. Find the final black area.Hard8GeometryDivide and conquer+2No attempts yet1s128 MBJudgeable
TrufflesGiven a grid of per-meter values, compute for each of M slanted lines the weighted length integral of the line through the grid, rounded to five decimals.Hard8GeometryPrefix sum+1No attempts yet3s128 MBJudgeable
VirusFind the rational point (X, Y, Z) closest to the origin satisfying N linear inequalities in three variables, or report that none exists.Hard8GeometryMath+1No attempts yet1s128 MBJudgeable
ElectricityPlace a power plant at an integer intersection minimizing the sum over axis-aligned rectangles of the Manhattan distance to the nearest rectangle corner.Hard8GeometryBinary search+1No attempts yet1.5s128 MBJudgeable
Median filterGiven a piecewise-linear integer signal by its corner points, output the corners of its median-filtered signal of width 2d+1.Hard8MathImplementation+2No attempts yet1s128 MBJudgeable
Triangle regionsGiven N points with no three collinear, count for each v how many triangles formed by three points contain exactly v other points strictly inside.Hard8GeometryCombinatorics+2No attempts yet2s512 MBJudgeable
Sticks and CarrotsChoose a subset of at least three vertices of a convex polygon so every carrot lies strictly inside the new polygon, minimizing its area.Hard8GeometryDynamic programming+2No attempts yet2s512 MBJudgeable
I Teach SweepingGiven segments in the first quadrant, find a line through the origin that intersects the most segments and report that count.Hard8GeometrySorting+1No attempts yet2s512 MBJudgeable
Gallery of Pillars (Small)Count the pillars in an N by N grid that are visible from the corner viewpoint, given identical circular pillars of radius R whose centers sit at cell centers.Hard8GeometryNumber theory+2No attempts yet5s512 MBJudgeable
Gallery of Pillars (Large)Count grid cells whose pillar is visible from a corner viewpoint, where pillars are radius-R circles and another pillar blocks the line of sight.Hard8Number theoryMath+2No attempts yet5s512 MBJudgeable
Radioactive Islands (Small)Find the minimum radiation dose for a boat crossing from (-10, A) to (10, B) at speed 1, given 1 unit/hour plus 1/D^2 per island at (0, C_i).Hard8GeometryMath+2No attempts yet30s512 MBJudgeable
Rebel Against the Empire (Large)Given moving asteroids, minimize the maximum jump distance so that no gap between jumps exceeds S seconds.Hard8GraphBinary search+2No attempts yet30s512 MBJudgeable
The Unscrupulous KingdomWith n points in the plane and m existing edges, add the fewest edges (segments that avoid other points) so the graph is connected while maximizing the sum of squared lengths.Hard8Minimum spanning treeUnion-find+2No attempts yet2s512 MBJudgeable
ParallelogramsGiven N points, produce a sequence of moves that translates one point to A+B-C each time, following a fixed published rule to bring every point into the first quadrant or report impossibility when all points are collinear.Hard8GeometryImplementation+2No attempts yet1s64 MBJudgeable
Stars in a CanPlace all n points in 3D inside one cylinder of any orientation, with at least three stars on one base, and print the minimum possible volume.Hard8GeometryBrute force+2No attempts yet2s512 MBJudgeable
Stretching StreamersCount ways to draw non-crossing chords among n points on a circle so the graph is a tree, edges only between numbers sharing a factor.Hard8Dynamic programmingCombinatorics+2No attempts yet2s512 MBJudgeable
Over Fitting (Large)Given N labeled points in the plane, find a line whose positive half-plane contains only LOVELYZ points and maximizes how many LOVELYZ points it captures.Hard8GeometrySorting+2No attempts yet3s512 MBJudgeable
Space ExplorationGiven N segment obstacles in the first quadrant and M rays from the origin, count how many segments no ray intersects, including exact endpoint touches.Hard8GeometrySorting+1No attempts yet2s256 MBJudgeable
Airport ConstructionGiven a simple polygon with up to 200 vertices, find the longest line segment that lies entirely inside it.Hard8GeometryBrute force+1No attempts yet2s512 MBJudgeable
Money for NothingPick one producer and one consumer to maximize (q-p)(e-d) over pairs where q>p and e>d, with up to 500000 of each.Hard8Divide and conquerGeometry+2No attempts yet5s512 MBJudgeable
Strange Solutions at Jeong LabGiven a growing set of (A,B) pairs, decide each day whether the new pair is dominated by or lies on the segment between two existing points.Hard8GeometryBinary search+2No attempts yet1s512 MBJudgeable
Jerry and TomDecide whether every mouse can be assigned to a visible hole on the polygon boundary, with each hole holding at most k mice.Hard8GeometryGraph+2No attempts yet1s512 MBJudgeable
Leftmost SegmentGiven n segments spanning two horizontal lines, answer m queries asking which segment meets a horizontal line at the leftmost point, breaking ties by the upper endpoint.Hard8SortingBinary search+2No attempts yet1s512 MBJudgeable
Omnicircumnavigation (Small)Given points on a sphere visited in order, decide whether the closed path along shortest arcs meets every great circle (every hemisphere) on the sphere.Hard8GeometryMath+1No attempts yet5s512 MBJudgeable
Grid paper and trianglesCount ordered triples of lattice points in a (w+1) by (h+1) grid whose triangle has positive integer area, modulo 1e9+7.Hard8CombinatoricsMath+2No attempts yet2s512 MBJudgeable
Horse tied outside the castleGiven a convex polygon and an exterior point with rope length L, compute the area reachable when the rope bends around polygon vertices and the two wrapping directions do not overlap.Hard8GeometryMath+1No attempts yet0.1s16 MBJudgeable
Rectilinear RegionsGiven two unbounded staircase polylines L and U, count the closed regions they enclose with L below and U above, and sum their areas.Hard8GeometryTwo pointers+2No attempts yet0.5s512 MBJudgeable
Flatland Fidget SpinnerGiven the pixel colors a camera recorded of a three-armed spinner, recover the camera's position and rotation angle.Hard8GeometryBinary search+2No attempts yet2s512 MBJudgeable
Knight's MarathonOn a huge rectangular board, find the minimum number of knight moves from one square to another while staying inside the board.Hard8MathBFS+2No attempts yet2s512 MBJudgeable
Easter EggsChoose a red egg set and a blue egg set from given plants, total N eggs, maximizing the minimum red-blue distance.Hard8Binary searchGraph+2No attempts yet2s512 MBJudgeable
Hoarse HorsesGiven line segments in the plane, count the maximum number of faces enclosed by them, i.e. bounded regions of their arrangement.Hard8GeometryGraph+2No attempts yet2s512 MBJudgeable
HubtownAssign citizens to one of their two angularly nearest train rays, respecting each ray's capacity, and maximize the number assigned.Hard8GreedySorting+2No attempts yet10s512 MBJudgeable
Abstract ArtGiven up to 100 simple polygons with 3 to 20 vertices each, compute the sum of their areas and the area of their union, each rounded to six decimals.Hard8GeometryImplementation+1No attempts yet2s512 MBJudgeable
Distinct DistancesChoose any point q in the plane and minimize the number of distinct Euclidean distances from q to n given integer points.Hard8GeometryMath+2No attempts yet3s512 MBJudgeable
Hot Sand and UmbrellasFind the minimum total time Kevin sprints on hot sand to go from the car to the ball and back, cooling at circular umbrellas, where each sun run is at most k seconds and the ball visit does not reset the limit.Hard8GraphShortest path+2No attempts yet2s512 MBJudgeable
DendroctonusDecide whether the infected and non-infected points can be separated by a single circle centered anywhere, where boundary non-infected points are allowed but interior ones are not.Hard8GeometryBrute force+2No attempts yet8s512 MBJudgeable
Painting polygon outlinesFor each polygon side, split it at intersections with later polygons, then sum over the pieces where the depth t counts how many later polygons contain the piece.Hard8GeometryImplementation+1No attempts yet1s512 MBJudgeable
Power plantsColor n points with two colors so the closest same-color pair is as far apart as possible, and output that squared distance plus the lexicographically smallest optimal coloring.Hard8GeometryDivide and conquer+2No attempts yet3s1024 MBJudgeable
IronmanFind the fastest path across n horizontal layers with different speeds, entering and exiting each layer boundary at an optimal x position, and print the minimum travel time.Hard8Dynamic programmingMath+2No attempts yet2s512 MBJudgeable
Islands of WeenesiaFind the shortest tunnel between two circular islands whose entrance points sit at least 100 cm inside the rims, so that the reachability graph over islands becomes strongly connected.Hard8GraphGeometry+2No attempts yet5s512 MBJudgeable
Building BridgesPick a subset containing the first and last pillars, pay (h_i-h_j)^2 for each bridge section and w_i for each skipped pillar, and minimize the total.Hard8Dynamic programmingGreedy+1No attempts yet3s128 MBJudgeable
Archery TournamentMaintain a dynamic set of non-overlapping circles tangent to the ground, support insertions and point queries that remove the hit circle, and report which circle each arrow hits.Hard8GeometryBinary search+2No attempts yet3s512 MBJudgeable
BoxGiven a box with edges a, b, c and a w by h cardboard, decide whether some edge-aligned net of the box fits on the cardboard.Hard8GeometryBrute force+2No attempts yet3s512 MBJudgeable
The Final LevelFind the minimum number of L-shaped n-blocks needed to cover a connected path of squares from (0,0) to (a,b) on an infinite grid.Hard8MathGreedy+2No attempts yet3s512 MBJudgeable
Fence InvasionCount how many distinct convex polygons can be formed as the convex hull of some subset of at least 3 of the given points, modulo 1e9+7.Hard8GeometryCombinatorics+2No attempts yet5s512 MBJudgeable
Bang! Bang!Given lines and circles all passing through the origin, count how many regions the plane is divided into, treating duplicates as one shape.Hard8GeometryCombinatorics+2No attempts yet2s512 MBJudgeable
Parallel LinesGiven up to 16 distinct points, pair them up to maximize the number of parallel pairs among the drawn segments.Hard8Bit manipulationDynamic programming+2No attempts yet10s512 MBJudgeable
Making the Perimeter of the Convex Hull ShortestGiven n points, find the largest decrease in convex hull perimeter achievable by removing exactly two of the points.Hard8GeometrySorting+2No attempts yet2s512 MBJudgeable
Rendezvous on a TetrahedronTwo worms start at vertex A of a regular tetrahedron, crawl straight across faces reflecting off edges, and stop after integer trail lengths; decide whether they end on the same face.Hard8GeometryImplementation+1No attempts yet1s512 MBJudgeable
Border WallGiven two colored point sets and a width d, find the minimum number of points to delete so that a strip of width d separates the remaining points by color.Hard8GeometrySorting+2No attempts yet2s512 MBJudgeable
Homotopic PathsDecide whether two polygonal paths from s to t in a plane with point obstacles are homotopic, that is, deformable into each other without crossing any tree.Hard8GeometryImplementation+2No attempts yet2s512 MBJudgeable
Convex QuadrilateralGiven n points, find the smallest-area convex quadrilateral whose four sides each pass through at least two of the points and that contains every point.Hard8GeometryGreedy+2No attempts yet9s512 MBJudgeable
Off the RailsGiven n cities sorted by x, cover them with straight non-vertical segments so that the sum of squared vertical distances plus C per segment is minimized.Hard8Dynamic programmingGeometry+2No attempts yet5s512 MBJudgeable
Blowing CandlesGiven up to 200,000 points inside a disk, find the minimum width of a strip that can cover all of them.Hard8GeometryBrute force+2No attempts yet4s512 MBJudgeable
Cat and MiceFind the smallest initial speed v so the cat can visit all points in some order, each arrival at or before its deadline, with speed multiplied by m after every meal.Hard8Binary searchDynamic programming+2No attempts yet2s512 MBJudgeable
Umbral DecodingGiven up to 100 safe points (x, y, b), count lattice points (p, q) in the square [0, n]^2 that are not covered by any region |x-p|^3 + |y-q|^3 <= b.Hard8GeometryMath+1No attempts yet2s512 MBJudgeable
Coin SliderChoose the largest subset of at most 16 coins and an order of moves so no moving coin ever collides with a stationary or already-moved coin.Hard8GeometryBit manipulation+2No attempts yet2s512 MBJudgeable
Share the Ruins PreservationSplit points by a vertical line that avoids all points, build the minimum-area enclosing convex hull of each side, and minimize the total area.Hard8GeometrySorting+2No attempts yet2s512 MBJudgeable
Connect the DotsGiven a 4 by 4 grid labeled 1 to 16, find the minimum number of straight segments a continuous polyline needs so that the dots are visited in numeric order.Hard8GeometryGreedy+2No attempts yet2s512 MBJudgeable