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
Restaurant Locations from Delivery TimesFor each friend, print the lexicographically smallest integer point at Manhattan distance exactly t that stays at distance at least t from every friend.Medium7GeometryIntervals+1No attempts yet2s512 MBJudgeable
Lonely mdicGiven N circles, count the ones fully covered by the union of the rest.Medium7GeometrySorting+1No attempts yet2s64 MBJudgeable
Consecutive OrderingDecide whether every vertex's closed neighbourhood forms one unbroken block in the given vertex ordering.Medium7IntervalsTwo pointers+1No attempts yet1s256 MBJudgeable
Train Ticket AllocationDecide how many tickets to sell for each station pair so paid and free riders fit capacity P on every segment and total income is maximal.Medium7GraphShortest path+1No attempts yet1s256 MBJudgeable
Count von Walken's FenceGiven a spacing D and the footstep counts between consecutive poles, decide whether unit steps can yield those counts without landing on a pole.Medium7IntervalsMathNo attempts yet1s256 MBJudgeable
Hero PowerEarn charge during star phrases and spend it on activations that double note points without wiping future phrases to maximize the score.Medium7Dynamic programmingGreedy+1No attempts yet1s256 MBJudgeable
BitrisFind the fewest adjacent swaps that let all paired cubes cancel by repeatedly deleting equal neighbors.Medium7IntervalsSorting+1No attempts yet1s256 MBJudgeable
RainfallChoose when to leave and how fast to ride within T minutes to minimize trip rain plus sweat that grows with the square of speed.Medium7MathPrefix sum+1No attempts yet5s256 MBJudgeable
Height MapCount the faces of the solid formed by grid columns of given heights, merging edge-adjacent unit squares on the same plane and direction into one face.Medium7BFSSorting+2No attempts yet3s256 MBJudgeable
Productivity improvementPartition all workers into exactly p nonempty lines to maximize the sum of each line's common overlapping work time.Medium7Dynamic programmingSorting+1No attempts yet2s256 MBJudgeable
Monkey and Apple TreesCount ripe trees in each visited interval while other events ripen whole intervals, with every interval shifted by the previous count.Medium7Segment treeIntervalsNo attempts yet2s256 MBJudgeable
Walking in JOI KingdomN walkers start at given points and move east or west at speed 1, stopping when they meet anyone, and the task asks the positions of Q of them at time T.Medium7StackSimulation+1No attempts yet2s512 MBJudgeable
Circular Barn RevisitedFarmer John opens k doors on a ring of n rooms so cows walking clockwise to their assigned rooms travel the smallest total distance.Medium7Dynamic programmingPrefix sum+1No attempts yet2s512 MBJudgeable
Virtual Rabbit (Large)Find the fewest feedings over D days so no gap exceeds X seconds while skipping work and sleep hours.Medium7GreedyMath+1No attempts yet5s512 MBJudgeable
Card GameBob repeatedly deletes three neighboring cards whose values form an arithmetic progression with difference K, and seeks the fewest cards that can remain.Medium7Dynamic programmingIntervalsNo attempts yet5s512 MBJudgeable
Card Game (Large)Repeatedly delete neighboring triples in arithmetic progression with difference K to leave as few cards as possible.Medium7Dynamic programmingIntervalsNo attempts yet5s512 MBJudgeable
Graduation Requirements (Large)Choose entry time and intersection to drive clockwise as long as possible without ever occupying the same point as any recorded counterclockwise car.Medium7IntervalsMath+1No attempts yet5s512 MBJudgeable
Sunlight (Large)Each building holds houses along its full height and the sun crosses a semicircle, so the task asks what fraction of houses sees the sun for at least H hours.Medium7GeometryIntervals+1No attempts yet10s512 MBJudgeable
Bribe the Prisoners (Small)Choose the release order of Q prisoners out of P cells to minimize total bribes, where each release bribes every still-occupied prisoner reachable from it until a boundary or empty cell.Medium7Dynamic programmingDivide and conquer+2No attempts yet5s512 MBJudgeable
Bribe the Prisoners (Large)Given prison cells in a row and a set of cells to release one per day, choose the release order that minimizes total bribes paid to prisoners who hear the news.Medium7Dynamic programmingDivide and conquer+2No attempts yet5s512 MBJudgeable
What Are Birds? (Large)Given labeled points and the fact that birds are exactly the points in a height interval crossed with a weight interval, classify each query as always bird, never bird, or unknown.Medium7ArrayIntervals+2No attempts yet5s512 MBJudgeable
Bribing the PrisonersRelease Q prisoners from a row of P cells in the order that minimizes bribes paid to neighbors reached by the news. Find that minimum total cost.Medium7Dynamic programmingIntervals+1No attempts yet2s512 MBJudgeable
Delete FilesGiven a top-aligned list of name boxes with widths, find the minimum number of axis-aligned rectangle selections whose deletions remove all 'y' files and keep all 'n' files.Medium7Dynamic programmingGeometry+2No attempts yet5s512 MBJudgeable
Starlight FallsGiven two observers' angular-direction and distance-range observations, decide whether a consistent star placement exists and find the maximum number of stars.Medium7GeometryIntervals+2No attempts yet2s128 MBJudgeable
Inverse RMQGiven query intervals and their maximum answers over a hidden permutation of 1..N, decide whether some permutation of 1..N satisfies all queries.Medium7GreedyIntervals+1No attempts yet2s512 MBJudgeable
Bridge AutomationGiven sorted boat arrival times, schedule bridge raises and lowers so no boat waits over 1800 seconds while minimizing total road closure time.Medium7Dynamic programmingGreedy+1No attempts yet2s512 MBJudgeable
ButterflyChoose non-overlapping dates; each person pays only if all their dates are kept, so maximize total satisfaction.Medium7IntervalsDynamic programming+2No attempts yet8s512 MBJudgeable
Merry ChristmasGiven a town road network and timed delivery requests, find the minimum number of Santas so every present arrives exactly at its scheduled time.Medium7Shortest pathDynamic programming+1No attempts yet8s512 MBJudgeable
Combining RiceballsGiven a row of riceballs, merge equal adjacent pairs or equal pairs with one ball between them, and find the largest size reachable.Medium7Dynamic programmingIntervals+2No attempts yet2s512 MBJudgeable
Blockade Duty ScheduleFind the largest M such that a daily duty schedule exists where at least M students are on duty at every moment, respecting each student's free periods and daily minute limit.Medium7IntervalsBinary search+1No attempts yet1s512 MBJudgeable
WolvesCount subsets of N sections, each holding at most one wolf, such that every given interval contains at least one chosen section, modulo 1e9+7.Medium7Dynamic programmingCombinatorics+2No attempts yet2s512 MBJudgeable
Legendary Twin Sword HeroGiven n triples (A, B, C), choose the smallest set of integers so that each triple has A chosen and some chosen value in [B, C].Medium7GreedyIntervals+2No attempts yet2s512 MBJudgeable
Watson and Intervals (Large)Generate N intervals from a recurrence, then find the minimum covered integer count after removing exactly one interval.Medium7IntervalsSorting+2No attempts yet5s512 MBJudgeable
Why Did the Cow Cross the Road 8Two rows each hold a permutation of N breeds; pair friendly pastures across the road without crossings to maximize the number of crosswalks.Medium7Dynamic programmingIntervals+1No attempts yet2s512 MBJudgeable
Modern Art 2Given a 1D painting, decide whether it can be built by layering one interval per color, and if so find the minimum number of Moonet's disjoint-interval rounds.Medium7StackGreedy+2No attempts yet2s512 MBJudgeable
Parenting PartneringSplit the 1440 minute day between two parents, respecting fixed busy blocks, so each gets exactly 720 minutes with fewest custody switches.Medium7GreedyIntervals+1No attempts yet5s512 MBJudgeable
Removal GameGiven a circle of numbers, remove them one by one paying the gcd of the two neighbors, and minimize the total cost.Medium7Dynamic programmingNumber theory+1No attempts yet2s512 MBJudgeable
Security BadgeGiven a directed graph whose edges each allow a range of badge IDs, count the badge IDs x for which room t is reachable from s.Medium7GraphBFS+2No attempts yet3s512 MBJudgeable
BricksCount the distinct sets of occupied boxes reachable after M bricks fall, where a brick at an occupied position expands its run left or right.Medium7Dynamic programmingIntervalsNo attempts yet0.2s512 MBJudgeable
Candy Wall BurglaryA bandit descends and reascends through shelves connected by sparse ladders, collecting jars at most once; find the maximum candy total.Medium7Dynamic programmingGraph+2No attempts yet2s512 MBJudgeable
Space ProbeGiven a random start time in [t1,t2] and fixed measurement offsets, find the probability that no measurement lands inside any forbidden interval.Medium7IntervalsMath+2No attempts yet2s512 MBJudgeable
Planet DestructionEach of K rockets hits the circle at an angle, and each virus spreads both ways along the circle at its own speed; find the first time every point of the circumference is covered.Medium7Binary searchIntervals+2No attempts yet2s512 MBJudgeable
Diagonal slices of a rectangle unionSum the total length of the union of axis-aligned rectangles cut by each diagonal line y = s - x for integer s in [L, R], and print the result divided by sqrt(2).Medium7GeometryIntervals+2No attempts yet2s512 MBJudgeable
Pokemon HuntPokemon sit on houses along a line, each with a candy value and a deadline; starting at house K, maximize candy collected while walking one house per second.Medium7Dynamic programmingIntervalsNo attempts yet1s512 MBJudgeable
Block GameRemove every block so the heights leave in non-decreasing order, minimizing moves of a machine that walks left and right along the shrinking row.Medium7Dynamic programmingGreedy+2No attempts yet2s512 MBJudgeable
Touch the SkyStarting at altitude 0, each balloon i can be inflated only at altitude at most L_i, then raises the house by D_i and pops; maximize the number of balloons popped.Medium7GreedySorting+2No attempts yet1s1024 MBJudgeable
It’s a Jungle Out ThereGiven moving point cars and snake lengths, count how many snakes can find a safe crossing window between two given times without a car touching their body.Medium7IntervalsSorting+2No attempts yet2s512 MBJudgeable
Rising SunFind the first integer minute when the upward-moving sun is visible from a house on a mountain boundary built from 45-degree zigzag segments.Medium7GeometryMath+1No attempts yet1s1024 MBJudgeable
Green LightGiven color observations and fixed traffic-light phase lengths, find the probability that the unknown cycle offset gives color cq at time tq.Medium7MathIntervals+2No attempts yet1s512 MBJudgeable
DriveGiven D, tank capacity C, consumption E, and stations with distances and prices, find the cheapest way to reach distance D starting with a full tank, or report -1.Medium7GreedyStack+2No attempts yet1s256 MBJudgeable
FestivalPick exactly one non-overlapping show from each of up to 10 stages so the total known-song count is maximized, or report -1 if no valid selection exists.Medium7Dynamic programmingBit manipulation+2No attempts yet2s512 MBJudgeable
Super Cheap Party RoomsManage a row of N rooms across new/in/out queries, placing each new room in the leftmost gap of size Y and cleaning it when its guests leave.Medium7IntervalsSimulation+2No attempts yet1s512 MBJudgeable
Forests in DangerGiven axis-parallel river segments and the country rectangle, find the smallest integer r so the union of r-thickened river rectangles covers at least P percent of the territory.Medium7GeometryBinary search+2No attempts yet1s512 MBJudgeable
Thread KnotsPlace one integer knot on each of n given intervals so that the smallest gap between any two knots is maximized, and print that optimum.Medium7Binary searchGreedy+2No attempts yet1s512 MBJudgeable
FrogsGiven n frogs at positions 1..n, each with reach r_i and skill s_i, pick three frogs that share a common reachable stone and maximize the sum of their skills.Medium7GreedySorting+2No attempts yet3s512 MBJudgeable
Deep800080Place a point on a line so that a disk of fixed radius R centered there covers as many of N given points as possible; output the maximum count.Medium7GeometrySorting+2No attempts yet2s512 MBJudgeable
Jumping JunipersMove each tree to a distinct positive integer position within its allowed interval so that the total distance from the house is minimized.Medium7GreedySorting+2No attempts yet4s512 MBJudgeable
We Need MasksEach citizen accepts mask prices in a range [L, R], each store sells X masks at price P, and we must match as many citizens to masks as possible.Medium7GreedySorting+2No attempts yet3s1024 MBJudgeable
ArcadeEach hand moves one button per second between presses; find the minimum number of hands that can cover all M presses.Medium7GreedySorting+2No attempts yet1s1024 MBJudgeable
LasersEach row holds sliding walls of fixed widths; count laser positions blocked in every possible configuration across all rows.Medium7IntervalsGreedy+2No attempts yet1s512 MBJudgeable
Array InitializationCount ordered sequences of M interval marks on an array of length N whose union covers every position, modulo 1e9+7.Medium7Dynamic programmingCombinatorics+2No attempts yet2s512 MBJudgeable
Paper FoldingGiven an N by M grid of integers, repeatedly fold it along row or column lines so overlapping cells sum, and find the maximum value obtainable in any cell.Hard8Dynamic programmingIntervals+2No attempts yet2s128 MBJudgeable
Toy SterilizationGiven daily toy demands over D days and two sterilization services with different delays and costs, decide which used toys to sterilize or discard versus buying new ones to minimize total cost.Hard8GreedyGraph+2No attempts yet2s128 MBJudgeable
BusGiven passenger groups each traveling between two bus stops, choose how many from each group to carry so total passengers are maximized without exceeding capacity C on any segment.Hard8GreedySegment tree+1No attempts yet2s128 MBJudgeable
Protective TentsGiven non-overlapping horizontal tents, add horizontal segments above them so that every point of the interval between the leftmost and rightmost endpoints receives downward water.Hard8GreedyIntervals+2No attempts yet2s128 MBJudgeable
Choosing GuitarsN guitars sit in a circle, and each turn the mover must take one guitar from every remaining contiguous group; find the max total value the first player can secure with optimal play.Hard8Dynamic programmingGame theory+2No attempts yet2s128 MBJudgeable
Freight TrainGiven two trains as unions of intervals of occupied cars, find the smallest forward shift of one train that maximizes the count of aligned occupied cars.Hard8IntervalsMath+2No attempts yet2s128 MBJudgeable
Fence Escape Season IVGiven N horizontal fence segments Jimin must dodge by sidestepping to their endpoints, compute the minimum total horizontal movement to reach the exit below.Hard8Dynamic programmingGreedy+2No attempts yet2s128 MBJudgeable
Food Wrap AreaGiven N food items on a 2-row by B-column grid, cover every food cell using at most K axis-aligned rectangular wraps while minimizing the total wrap area.Hard8Dynamic programmingGreedy+2No attempts yet2s128 MBJudgeable
SpiderwebGiven a convex polygon's vertices and circular puddles, find the maximum number of non-crossing diagonals that avoid all puddles.Hard8Dynamic programmingGeometry+2No attempts yet2s128 MBJudgeable
TicketsAssign seat blocks of length L to families to maximize profit, where exact preferred block gives 2, any other free block of L seats gives 1, and blocks can't overlap.Hard8Dynamic programmingGreedy+1No attempts yet2s128 MBJudgeable
Rectangles and ShapeGiven a rectilinear polygon and a set of non-overlapping axis-aligned rectangles, select rectangles that exactly tile the polygon's interior without exceeding its boundary.Hard8GeometryIntervals+1No attempts yet2s128 MBJudgeable
Microbiology LabChoose the minimum number of distinct integer temperature points so every microbe's interval contains at least C[i] chosen points.Hard8GreedySegment tree+2No attempts yet2s128 MBJudgeable
Visible SquaresGiven up to 1000 non-overlapping axis-aligned integer squares, count how many are visible from the origin by angular occlusion reasoning.Hard8GeometrySorting+1No attempts yet2s128 MBJudgeable
Total Length of Grid Segments in a PolygonGiven a simple polygon with integer vertices, compute the total length of grid line segments strictly inside the polygon.Hard8GeometrySorting+1No attempts yet1s128 MBJudgeable
Richest Tenant CompanyProcess chronological move-ins and range-max inspections on offices where each company's wealth grows linearly with time, requiring a segment tree over linear functions evaluated at the query day.Hard8Segment treeIntervals+1No attempts yet5s128 MBJudgeable
GrassSimulate N up to 1e9 plants under growth, cap, mow-left, mow-right, and clamp operations using an implicit interval structure, answering running sum queries efficiently.Hard8Segment treeIntervals+2No attempts yet1s128 MBJudgeable
Ships on a RiverGiven river fields with fish amounts and ships each needing a fixed anchor field and length placed without overlap, maximize total fish covered.Hard8Dynamic programmingGreedy+1No attempts yet1s128 MBJudgeable
JOKERGiven K shuffled and partly ambiguous card-removal records, decide if they can be reordered to remove all N-1 non-joker cards and output a valid execution order.Hard8GreedySimulation+1No attempts yet1s128 MBJudgeable
WalkCompute the shortest grid path length from (0,0) to (X,Y) avoiding up to 100,000 non-overlapping rectangular buildings that only occupy positive x squares.Hard8GeometryShortest path+2No attempts yet2s64 MBJudgeable
November RainGiven non-intersecting sloped roof segments, compute for each segment how much rainwater (falling vertically, then sliding down slopes and shielded by segments above) drains off its lower end.Hard8GeometrySorting+1No attempts yet1s128 MBJudgeable
Minimizing MaximizerGiven a pipeline of range-sort operations, find the minimum number of operations (kept in order) whose composition still guarantees the last position always holds the overall maximum.Hard8GreedyIntervals+1No attempts yet1s512 MBJudgeable
WormsGiven string rewriting rules, find the minimum number of days to grow the target worm from one cell, where each day any subset of cells splits.Hard8Dynamic programmingIntervals+1No attempts yet2s128 MBJudgeable
Missile CommandGiven missiles moving at constant velocity and circular shots that grow then shrink over 2 seconds, find the minimum number of shots needed to neutralize the same missiles and report the battle score.Hard8GeometryGreedy+2No attempts yet1s128 MBJudgeable
Fax RegionsGiven the width and run length encoding of a huge fax image, count the connected dark regions using 4-directional adjacency without expanding individual pixels.Hard8SimulationImplementation+2No attempts yet1s128 MBJudgeable
Edge DetectionGiven an image as run-length encoded runs, set each output pixel to the largest absolute difference from its 8 neighbors, and emit the result as runs.Hard8SimulationImplementation+2No attempts yet1s128 MBJudgeable
The Red GemFor each test case, find the fraction of a circular platform's circumference from which an entire red disk is visible without any orange disk blocking the line of sight.Hard8GeometryIntervals+2No attempts yet1s128 MBJudgeable
Grid NimTwo players alternately remove a heap from either end of a row; a player cannot take three heaps in a row on their own turns, and the first player wins if their coin total is at least the second player's.Hard8Game theoryDynamic programming+2No attempts yet1s128 MBJudgeable
PolygonRemove one edge of a polygon, then repeatedly merge adjacent vertices by the intervening + or *, and report the maximum final value plus every edge whose removal reaches it.Hard8Dynamic programmingIntervals+2No attempts yet1s128 MBJudgeable
PhotoGiven intervals each containing exactly one marked point, find the maximum number of marked points, or -1 if no assignment is consistent.Hard8Dynamic programmingGreedy+2No attempts yet1s128 MBJudgeable
Barn AllocationGiven stall capacities and interval requests, find the maximum number of requests that can be granted without any stall exceeding its capacity.Hard8GreedySegment tree+2No attempts yet2s128 MBJudgeable
IntervalsGiven n integer intervals each needing at least c_i chosen points inside it, find the smallest set of integers satisfying all requirements.Hard8GreedySorting+2No attempts yet1s128 MBJudgeable
IntervalsGiven a point light above the x-axis and non-overlapping circular pipes below it, find the shadowed intervals on the x-axis, sorted and rounded to two decimals.Hard8GeometrySorting+2No attempts yet1s128 MBJudgeable
Subway PlanningGiven points in the plane and a radius d, cover all points using the fewest rays from the origin, where a ray covers a point if some point on the ray is within distance d.Hard8GeometryGreedy+2No attempts yet1s128 MBJudgeable
CloudsEach cloud is a polygon moving with the same velocity; count the separate time intervals during which the vertical beam at the origin intersects at least one cloud.Hard8GeometrySorting+2No attempts yet2s128 MBJudgeable
RobotsRobots on a circular track move clockwise for given durations, pushing each other and stopping at walls; find each final position.Hard8SimulationIntervals+2No attempts yet1s1024 MBJudgeable
Farmer Bill's ProblemPlace non-overlapping, non-touching rectangles inside a rectangular field so all given circles lie within them, minimizing total rectangle area, and output the remaining harvestable area.Hard8GeometryDynamic programming+2No attempts yet2s128 MBJudgeable
Experiment "X": Explosions ExpectedCount valid mixtures (at most S total ounces, at least two ingredients used) that are not dominated coordinatewise by any of M given exploding mixtures, modulo nothing.Hard8CombinatoricsDynamic programming+2No attempts yet1s512 MBJudgeable
Fish CatchGiven a fixed net center and N fish moving at constant velocity, find the smallest radius that catches at least K fish at some time t >= 0.Hard8GeometryBinary search+1No attempts yet1s128 MBJudgeable
CensorshipGiven a text and a filter word set, remove occurrences repeatedly to make the shortest possible result and report its length.Hard8Dynamic programmingString+1No attempts yet1s128 MBJudgeable