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 results486 problems
TitleLevelTopicsSolvedTime limitMemory limitJudge
InspectorGiven statements of the form 'at time t, programmer j was present along with i others', find the largest prefix of statements that can all hold at once.Hard8IntervalsBrute force+2No attempts yet5s128 MBJudgeable
Painting the WallGiven n axis-aligned rectangles, find the total area of the plane covered by at least n-1 of them.Hard8SortingSegment tree+2No attempts yet1s128 MBJudgeable
TermitesTwo termites alternately eat planks adjacent to already-eaten ones, each maximizing her total; report the wood each ends up with under optimal play.Hard8GreedyGame theory+2No attempts yet2s512 MBJudgeable
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.Hard8GreedySorting+2No attempts yet1s128 MBJudgeable
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.Hard8GeometryGreedy+2No attempts yet1s128 MBJudgeable
Matryoshka DollsReassemble a row of dolls into complete 1 to m sets using adjacent merges while minimizing the number of doll openings.Hard8Dynamic programmingIntervalsNo attempts yet5s128 MBJudgeable
Contour MapGiven up to 20000 non-crossing convex orthogonal polygons, compute the maximum nesting depth where the outermost level is 1.Hard8GeometrySorting+2No attempts yet3s128 MBJudgeable
Block CompactionRepeatedly drop axis-aligned rectangles down and then left until none moves, and report the width and height of the final bounding box.Hard8SimulationGeometry+2No attempts yet1s128 MBJudgeable
KingdomRoads merge cities into connected states over time, and each query asks how many states a horizontal line meets and how many cities those states contain.Hard8Union-findSegment tree+2No attempts yet1s128 MBJudgeable
StainsTaeyeon covers integer points off the x-axis with diamonds centered on the x-axis and minimizes the sum of their areas.Hard8Dynamic programmingGeometry+2No attempts yet1s128 MBJudgeable
Rotate and RewriteDecide whether two rotatable integer sequences can be reduced to a common sequence by substring rewrite rules and report the greatest such length.Hard8Dynamic programmingString matching+1No attempts yet15s128 MBJudgeable
RingworldGiven n circular arcs on a ring of m cities, decide whether each arc can take a distinct city inside it.Hard8GreedyIntervals+1No attempts yet2s128 MBJudgeable
Janeway's JourneyFind the single straight line that hits the greatest number of disjoint circular asteroids in the plane.Hard8GeometrySorting+1No attempts yet40s128 MBJudgeable
History classFind the event order that respects disjoint time order and minimizes the largest position gap between overlapping intervals.Hard8IntervalsTopological sort+2No attempts yet10s128 MBJudgeable
Cleaning the HallwayGiven up to 500 outlets, each cleaning the ring swept by a small disk around a circle, compute the area of their union rounded to two decimals.Hard8GeometryMath+1No attempts yet5s128 MBJudgeable
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.Hard8GeometryIntervals+1No attempts yet1s128 MBJudgeable
Rent-A-PixelCompute the smallest row- and column-convex block set containing the given blocks and print its outline corners clockwise.Hard8GeometryIntervals+1No attempts yet3s128 MBJudgeable
Tree LightingA point light shines a bounded wedge upward through absorbing and mirrored segments, and you report the lit percentage of a horizontal house front.Hard8GeometrySimulation+1No attempts yet1s128 MBJudgeable
RNAReport the longest contiguous block shared by both RNA strings whose parenthesis marks balance.Hard8Dynamic programmingString+1No attempts yet1s128 MBJudgeable
BridgesTowns on two banks link east on the north side and west on the south side while bridges are added and roads close and queries ask if one town reaches another.Hard8GraphIntervals+1No attempts yet1s256 MBJudgeable
Line SweepFind the tallest vertical broom that still reaches every empty cell by sliding sideways, then the fewest sideways sweeps that clean them all.Hard8GreedyIntervals+2No attempts yet10s256 MBJudgeable
Truck EncountersCount how many times each queried pair of trucks, moving at equal speed along zigzag city routes, occupy the same position.Hard8IntervalsSorting+1No attempts yet3s64 MBJudgeable
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.Hard8Binary searchSegment tree+2No attempts yet10s512 MBJudgeable
HackerChoose a start on a valued ring and spread to neighboring computers each turn to maximize hacked value against an optimal blocker.Hard8Game theoryDynamic programming+1No attempts yet1s256 MBJudgeable
Forming TeamsFor each planned day, decide whether students with accepted size ranges can fill all requested teams of the given sizes.Hard8GreedyIntervals+2No attempts yet4s512 MBJudgeable
Train of ThreesYou repeatedly merge adjacent matching pairs in an array of 1s, 2s and numbers of the form 3 times a power of two to form the largest tile possible.Hard8Dynamic programmingIntervalsNo attempts yet5s256 MBJudgeable
Visitors' TrainCompute the total length of a straight track segment from which the main rectangle stays fully visible behind other rectangles.Hard8GeometryIntervalsNo attempts yet1s256 MBJudgeable
Party joke setsCount distinct joke-type sets from root-connected guest groups with unique values where each subtree below a guest forms consecutive numbers.Hard8Dynamic programmingTree+1No attempts yet1s32 MBJudgeable
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.Hard8Segment treeSorting+1No attempts yet10s512 MBJudgeable
Runaway QuailStarting at zero on a line, catch every quail that flees outward at a speed below yours in the smallest possible total time.Hard8Dynamic programmingMath+1No attempts yet5s512 MBJudgeable
Hiking DeerChoose speeds, including full stops, for one clockwise loop of a circular trail to minimize meetings with hikers who walk at constant speeds.Hard8MathSorting+1No attempts yet5s512 MBJudgeable
Hiking Deer (Large)Plan a variable-speed loop around a circular trail to cross paths with as few constant-speed hikers as possible.Hard8GreedyIntervals+1No attempts yet5s512 MBJudgeable
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.Hard8Segment treeIntervals+1No attempts yet15s512 MBJudgeable
Painting a Fence (Large)Pick the fewest offers from N interval-and-color proposals so every one of 10000 fence sections is covered using at most 3 distinct colors.Hard8IntervalsGreedy+2No attempts yet10s512 MBJudgeable
Dynamic memory allocationSimulate a memory allocator over n bytes: allocate the leftmost run of l free bytes, or free a range and count how many bytes were actually freed.Hard8IntervalsSegment tree+1No attempts yet1s1024 MBJudgeable
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.Hard8Dynamic programmingIntervals+2No attempts yet1s1024 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
IntegralGiven f at a set of integer points, extend it to a monotone piecewise linear function so the integral from 0 to n equals y.Hard8IntervalsNo attempts yet2s512 MBJudgeable
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.Hard8IntervalsGreedy+2No attempts yet10s512 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
Demilitarized ZoneFor each protected point, count how many starting mines eventually trigger a blast covering it, given chain reactions over intervals.Hard8IntervalsSorting+2No attempts yet3s256 MBJudgeable
Dominoes (Large)Find the fewest pushes (each a domino plus a direction) needed to topple every domino through chain reactions.Hard8GreedySorting+2No attempts yet1s512 MBJudgeable
Map LabelingPlace disjoint unit-height labels on a line above given points and count the minimum number of connectors that cannot run straight down to their own label.Hard8Dynamic programmingSorting+2No attempts yet1s512 MBJudgeable
Shooting GalleryA row of ducks, each with a species; a good round hits two ducks of the same species and keeps only the ducks strictly between them, and rounds continue while same-species pairs remain. Find the longest possible run of good rounds.Hard8Dynamic programmingArray+2No attempts yet2s512 MBJudgeable
Starting a Scenic Railroad ServiceFor n travel segments, compute the minimum seats needed under arbitrary online seat choices and under optimal offline assignment.Hard8GreedySorting+2No attempts yet2s512 MBJudgeable
Lifeguards (Platinum)Fire exactly K of N lifeguard shifts to maximize the total time covered by at least one remaining shift.Hard8Dynamic programmingSorting+2No attempts yet2s512 MBJudgeable
Grievous Loss of DataGiven the clash graph of N interval lectures, find the minimum number of halls, which equals the chromatic number guaranteed realizable by intervals.Hard8GraphIntervals+2No attempts yet6s512 MBJudgeable
Shooter IslandOn a 50 by 100000 grid, rectangles flood when hit, and after each query decide whether a radius-0.31416 boat can sail between two given squares on the remaining water.Hard8Union-findIntervals+2No attempts yet3s512 MBJudgeable
Overflowing PopularityGiven M guests with arrival and departure times, choose when to insert up to K extra friends so that the count of ordinary attendees stays below T as long as possible.Hard8Dynamic programmingGreedy+2No attempts yet1s256 MBJudgeable
Running RoutesGiven chords of a convex n-gon, find the largest set of chords no two of which share any common point, including endpoints.Hard8Dynamic programmingIntervals+2No attempts yet12s1024 MBJudgeable
Sequence and Queries 31Maintain a 0/1 sequence under range reversals, and answer queries for the longest run of 1s inside a given range.Hard8Segment treeIntervals+2No attempts yet2s512 MBJudgeable
Strange MachineCount the distinct pairs (x, y) produced by the map t -> (((t + floor(t/B)) mod A), t mod B) over n disjoint time intervals.Hard8MathNumber theory+2No attempts yet4s512 MBJudgeable
NamuhsGiven N unknown planet potentials, find the unique contiguous segment with the maximum sum using only queries that compare the sums of two segments.Hard8Divide and conquerBinary search+2No attempts yet2s512 MBJudgeable
LibraryGiven a hidden permutation of N books, query the oracle with a set of book numbers and receive the minimum number of contiguous-block removals needed to extract exactly those books, then recover the order.Hard8IntervalsMath+2No attempts yet2s512 MBJudgeable
Watch LaterGiven a string of video types, find the minimum number of manual clicks needed to watch everything, where playback auto-advances to the next video only if it has the same type.Hard8Dynamic programmingBit manipulation+2No attempts yet6s512 MBJudgeable
Glow, Pixel, Glow!Given horizontal and vertical pulses crossing a grid of wires, count the pixels where current passes through both intersecting wires at the same time.Hard8SortingImplementation+2No attempts yet2s512 MBJudgeable
True/False WorksheetCount binary strings of length n that satisfy range hints, where each hint says a range is all equal or not all equal, modulo 1e9+7.Hard8Dynamic programmingPrefix sum+2No attempts yet2s512 MBJudgeable
Collecting Stamps 3On a circular lake, N stamps sit at given positions with individual collection deadlines; find the maximum number of stamps JOI-kun can collect starting from position 0.Hard8Dynamic programmingIntervals+2No attempts yet2s512 MBJudgeable
Social DistancingPlace N cows on distinct integer grass points across M disjoint intervals on a line so that the minimum pairwise distance D is as large as possible, and output the largest achievable D.Hard8Binary searchGreedy+2No attempts yet1s512 MBJudgeable
New Year and ConferenceGiven n lectures, each with one time interval at venue a and another at venue b, decide whether every subset that is conflict-free at one venue is also conflict-free at the other.Hard8IntervalsSorting+2No attempts yet2s1024 MBJudgeable
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.Hard8IntervalsUnion-find+2No attempts yet2s256 MBJudgeable
SchedulingDecide whether n preemptible tasks with release times, deadlines, and processing times can be scheduled on m identical processors within their windows.Hard8GreedySorting+2No attempts yet1s256 MBJudgeable
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.Hard8IntervalsGreedy+2No attempts yet2s512 MBJudgeable
Saddle PointCount the n by m matrices with entries in 1..k that contain at least one position that is a strict maximum of both its row and its column, modulo 1e9+7.Hard8CombinatoricsDynamic programming+2No attempts yet1s512 MBJudgeable
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.Hard8GeometrySorting+2No attempts yet1s512 MBJudgeable
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.Hard8MathIntervals+2No attempts yet2s512 MBJudgeable
BusSimulate bus boarding with passengers sitting in the closest free seat or standing over an occupied one, and choose Anton's seat minimizing the total time someone stands over him.Hard8SimulationGreedy+2No attempts yet2s512 MBJudgeable
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.Hard9GeometryIntervals+2No attempts yet5s128 MBJudgeable
Museum GuardsAssign each guard repeating daily intervals on half-hour boundaries within their availability and minute limits so the minimum number of guards on duty is maximized.Hard9Binary searchGreedy+2No attempts yet5s128 MBJudgeable
TeleportersPlace up to M new teleporters between given endpoints so the forced eastward walk triggers as many teleports as possible.Hard9GreedySorting+2No attempts yet1s128 MBJudgeable
Synnerg LifeformGiven rewriting rules that merge adjacent synnergs with multiplicative lifetimes, find all maximum-lifetime synnergs obtainable by fully unifying some contiguous block of each input sequence.Hard9Dynamic programmingIntervals+2No attempts yet1s128 MBJudgeable
SetsGiven n arithmetic-progression sets of multiples of d_i, count elements in their union that share no prime factor with m.Hard9MathNumber theory+2No attempts yet1s128 MBJudgeable
Land TaxChoose a non-empty contiguous row and column range that maximizes combined row and column payments weighted by heights and widths.Hard9Divide and conquerGeometry+2No attempts yet1s128 MBJudgeable
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.Hard9SimulationSorting+2No attempts yet1s128 MBJudgeable
Fence WatchPlace the fewest sensors on a convex polygon boundary so every boundary point forms an angle from alpha to 360 degrees minus alpha with some sensor pair.Hard9GeometryGreedy+1No attempts yet1s128 MBJudgeable
Chain & Co.Decide whether axis-aligned square links split into two nonempty groups with every cross pair linked.Hard9GeometryGraph+1No attempts yet10s128 MBJudgeable
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.Hard9GreedySorting+2No attempts yet1s256 MBJudgeable
Rotating Cutter BitsThe program counts interior lattice points of a polygonal workpiece that survive one full rotation against a second rotating polygonal cutter.Hard9GeometrySimulation+1No attempts yet3s256 MBJudgeable
Solve this one tooGiven an N x L matrix, find windows of 3N columns split into matrices A, B, C with A*B=C; pick disjoint windows to maximize total colored cells.Hard9MatrixDynamic programming+2No attempts yet5s512 MBJudgeable
Koala GameDetermine properties of a hidden permutation by bidding stones in a game where Koala optimally maximizes the sum of values she wins, using as few rounds as possible.Hard9Game theoryGreedy+2No attempts yet2s512 MBJudgeable
Lexicographically Smallest Sign SequenceFill a sign sequence of -1 and 1 with some fixed entries so that every range [Ai,Bi] has sum at least Ci, and output the lexicographically smallest valid sequence or Impossible.Hard9GreedyPrefix sum+2No attempts yet1s512 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
mex and QueriesMaintain a set of natural numbers under range add, range remove, and range toggle queries, then output the mex after each of up to 100000 queries with values up to 1e18.Hard9Segment treeIntervals+1No attempts yet2s512 MBJudgeable
HotelMaintain an array under point height updates; after each update answer queries for the longest subsegment inside [l, r] that contains no strict interior valley.Hard9Segment treeArray+2No attempts yet2s512 MBJudgeable
ExploreAn interactive graph-reconstruction task: with limited modify, query, report, and check calls, determine every edge of an unknown undirected graph.Hard9GraphDivide and conquer+2No attempts yet1s512 MBJudgeable