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
LifeguardsFire exactly one of N given time intervals, then maximize the total length of time covered by at least one of the remaining intervals.Medium6IntervalsSorting+1No attempts yet2s512 MBJudgeable
The Lion Is the King of Travel!!Given N days and M fixed non-overlapping-or-not travel intervals, choose a subset of disjoint intervals minimizing the longest gap of untraveled days.Medium6Binary searchGreedy+2No attempts yet2s512 MBJudgeable
MeetingsEach person occupies an interval [Si, Ei]; pair up people whose intervals overlap into disjoint pairs and maximize the number of pairs.Medium6GreedySorting+2No attempts yet1s1024 MBJudgeable
Memory AllocationSimulate first-fit malloc and free over 100,000 memory cells and print requested variable values in command order.Medium6IntervalsSimulation+2No attempts yet1s512 MBJudgeable
To Tell the TruthGiven n people each claiming the true count lies in [a,b], find the largest consistent truth-teller count or -1 if none exists.Medium6Brute forceMath+1No attempts yet2s512 MBJudgeable
AlehouseGiven n closed time intervals on a weekly circle, pick one interval of length at most k that intersects as many given intervals as possible.Medium6IntervalsSliding window+2No attempts yet1s512 MBJudgeable
Splitting DNAGiven the lengths of N fragments in order, find the minimum total energy to split the original chain, where each cut costs the current chain length.Medium6Dynamic programmingIntervals+2No attempts yet1s512 MBJudgeable
Meeting Room Scheduling 2Given N meetings that overlap only with their immediate neighbors in the list, choose a non-overlapping subset maximizing total attendees.Medium6Dynamic programmingArray+2No attempts yet1s256 MBJudgeable
Meeting Room Scheduling 3Choose non-overlapping meetings, where each meeting's time overlaps only its immediate neighbors in the input order, to maximize the total attendee count.Medium6Dynamic programmingGreedy+2No attempts yet1s256 MBJudgeable
GameTwo players alternately claim columns they can reach; each wants to claim more columns than the other, and the winner under optimal play is reported.Medium6GreedyGame theory+2No attempts yet2s512 MBJudgeable
Teacher Cho ForceGiven a moving catcher and N moving students, compute the maximum number of students that can simultaneously lie within radius R at any nonnegative time.Medium7IntervalsMath+2No attempts yet2s128 MBJudgeable
Four SubstringsGiven a string and four of its substrings, pick one occurrence of each so that the union of the covered positions has the fewest and the most distinct characters.Medium7String matchingIntervals+2No attempts yet2s512 MBJudgeable
Letters on the WallGiven up to 100 rectangles each filled with one of four parity-based patterns, compute the total number of unit cells that end up marked on the wall.Medium7IntervalsMath+2No attempts yet2s128 MBJudgeable
Once Opened, You Can't StopChoose one integer per flavor within its given range so the sum of absolute changes between consecutive picks is minimized, and output the values.Medium7Dynamic programmingGreedy+2No attempts yet2s128 MBJudgeable
Confining the Black GoatGiven N non-overlapping (but nestable) rectangles, find the maximum nesting depth achievable at a point and how many regions attain that depth.Medium7SortingGeometry+1No attempts yet2s128 MBJudgeable
Chip ConstructionGiven N component priorities and K non-crossing power lines each serving up to two components, find a nesting-valid pairing that maximizes total sum of squares/products.Medium7Dynamic programmingGreedy+1No attempts yet1s128 MBJudgeable
High-Speed RailwayCount subsets of interval-graph vertices forming a vertex cover of the interval overlap graph, modulo a given number.Medium7IntervalsDynamic programming+1No attempts yet1s128 MBJudgeable
Connecting RectanglesGiven N candidate axis-aligned rectangles with weights equal to their index, select a maximum-weight subset of pairwise non-overlapping and non-touching rectangles.Medium7Dynamic programmingGreedy+2No attempts yet1s128 MBJudgeable
Sangbeom's MelancholyGiven daily moods, compute flower-giving intervals before each depressed run (2T days, or 3T for one chosen longest run) and find the maximum count of distinct covered days by optimally picking which longest run gets the 3T rule.Medium7IntervalsGreedy+1No attempts yet1s128 MBJudgeable
Call ReconstructionGiven detector counts of calls crossing certain positions along a line of houses, find the minimum number of calls consistent with all counts (interval covering via greedy/sweep with counts as constraints).Medium7GreedyIntervals+1No attempts yet1s128 MBJudgeable
LRH PlantsGiven plants added over time with increasing heights, count for each new plant how many crossing points appear where its stems cross earlier plants' horizontal segments or vice versa, avoiding duplicate points.Medium7Segment treeGeometry+2No attempts yet1s128 MBJudgeable
Playlist Display IntervalsGiven a sequence of distinct requested songs, choose a length-K window covering each request to minimize the total number of distinct songs ever shown across all windows.Medium7GreedyIntervals+1No attempts yet1s128 MBJudgeable
FenceGiven overlapping rectangular planks forming a skyline, select the minimum subset of planks that reproduces the exact same skyline.Medium7SortingStack+2No attempts yet1s128 MBJudgeable
How I Mathematician Wonder What You Are!Determine whether a given simple polygon is star-shaped by computing the intersection of half-planes defined by its edges (kernel of polygon).Medium7GeometryIntervals+1No attempts yet1s128 MBJudgeable
Concert Hall SchedulingGiven up to 1000 interval requests with prices for two identical rooms over 365 days, select accepted intervals (assignable to either of 2 rooms without overlap) to maximize total revenue.Medium7Dynamic programmingGreedy+1No attempts yet2s128 MBJudgeable
SentriesGiven interval reports saying each range holds no ninja or at least one, find every bush that holds a ninja in all valid placements of exactly K ninjas.Medium7GreedyIntervals+2No attempts yet1s256 MBJudgeable
Serial NumbersApply range assignments of a status letter and a transfer code to serial numbers, then print the minimal merged list of ranges.Medium7IntervalsSorting+1No attempts yet1s128 MBJudgeable
ClickomaniaGiven a string over uppercase letters, decide whether the one dimensional Clickomania puzzle can be fully cleared.Medium7Dynamic programmingIntervals+1No attempts yet10s128 MBJudgeable
Team DessertDesserts sit in a row; two alternating teams take from either end, and the first-picking team wants the smallest total weight it can guarantee against optimal play.Medium7Dynamic programmingGame theory+2No attempts yet1s128 MBJudgeable
Emergency RationsChoose boxes with a capacity and an expiry day to eat one unit daily starting day 1; report the last reachable day and the fewest boxes needed.Medium7GreedySorting+2No attempts yet1s128 MBJudgeable
Popping BalloonsEach balloon is a circle not containing the origin. Find the minimum number of halflines from the origin that all cross at least one circle.Medium7GeometryIntervals+2No attempts yet1s128 MBJudgeable
Parking ShipsThe captain's parking interval is fixed; place the other ships on a line so that as many ship intervals as possible cover their house centers.Medium7SortingGreedy+1No attempts yet1s128 MBJudgeable
ShuffleAfter applying m shuffles to an ordered deck of n cards, count how many cards numbered r or less fall in positions p through q. n is up to 1e9, so the huge deck must be tracked implicitly.Medium7CombinatoricsMath+2No attempts yet1s128 MBJudgeable
Airplane ParkingGiven N time intervals (arrival, departure), find the largest subset that can be scheduled in a stack, so planes leave in last-in first-out order.Medium7Dynamic programmingIntervals+2No attempts yet1s128 MBJudgeable
Hyperactive Boy GangsanCount minimal subsets of intervals that cover [0, M] with no redundant interval, modulo 10^8, over multiple test cases.Medium7Dynamic programmingIntervals+2No attempts yet1s128 MBJudgeable
Lazy Jumping FrogGiven a grid with up to 1000 rectangular water regions, find the minimum energy path between two dry cells using a fixed set of twelve weighted jumps.Medium7Shortest pathGraph+2No attempts yet3s128 MBJudgeable
Land Division TaxSplit a ring of N lots one at a time; each split costs F times the larger resulting piece. Find the minimum total tax.Medium7Dynamic programmingIntervals+2No attempts yet1s128 MBJudgeable
PhotoGiven N cows in a line and K unfriendly pairs that cannot share a photo, find the minimum number of consecutive-range photos covering every cow.Medium7GreedyIntervals+2No attempts yet1s128 MBJudgeable
The Cow RunCows sit at distinct positions on a line; John starts at 0, moves one unit per minute, and each cow costs one dollar per minute until reached. Minimize the sum of arrival times.Medium7Dynamic programmingGreedy+2No attempts yet1s128 MBJudgeable
Time PlannerGiven each of up to 20 members' busy intervals, output every maximal window of length at least one hour where at most one member is absent throughout.Medium7IntervalsSorting+2No attempts yet1s128 MBJudgeable
TreasureFind all treasure cells on an N x N grid by asking rectangle count queries whose cost grows as the rectangle shrinks.Medium7Divide and conquerBinary search+2No attempts yet2s256 MBJudgeable
Huffman's GreedWe build the optimal binary search tree for weighted key and gap frequencies, minimizing weighted comparison counts.Medium7Dynamic programmingTree+2No attempts yet1s128 MBJudgeable
DinnerGiven a line of G and H programmers, repeatedly remove a run of at least K equal letters; find the minimum number of removals to clear the line, or -1.Medium7Dynamic programmingIntervals+2No attempts yet1s128 MBJudgeable
Hidden CodesGiven code words and a long text, choose non-overlapping covering sequences, each at most 1000 long, maximizing the total length of the code words used.Medium7Dynamic programmingString matching+2No attempts yet1s128 MBJudgeable
TripsMatch group sizes to trip intervals so that each interval gets at most one group and the number of matched intervals is maximized.Medium7GreedySorting+2No attempts yet1s128 MBJudgeable
RequestsGiven a cache of capacity K and N timed requests with expiration times, compute the minimum number of fetches over all offline replacement strategies.Medium7Dynamic programmingGreedy+2No attempts yet1s128 MBJudgeable
Sailing RaceGiven sign positions on a line, find the visiting order minimizing the sum of cumulative distances, where each next sign adds the distance from the previous sign.Medium7Dynamic programmingGreedy+2No attempts yet1s128 MBJudgeable
DiscoGiven N disjoint lit intervals on a line of L lamps and M switches that each flip a range, decide if some subset of switches turns every lamp off.Medium7IntervalsGreedy+2No attempts yet1s1024 MBJudgeable
Shortest Regular Brackets SequenceGiven a string of brackets, find the length of the shortest regular bracket sequence that contains it as a subsequence.Medium7Dynamic programmingIntervals+2No attempts yet1s128 MBJudgeable
Everybody May Get Lost in SpaceGiven three balls in 3D space, compute the exact volume of their union, rounded to six decimals.Medium7GeometryMath+2No attempts yet1s512 MBJudgeable
GophersGiven gopher holes and CD players on a line, count holes covered by at least one player before and after each of d moves of a player, outputting d+1 counts.Medium7SortingBinary search+2No attempts yet3s128 MBJudgeable
MusketeersGiven a tournament matrix on n people in a circle, determine everyone who can be the last survivor when adjacent duels are scheduled in any order.Medium7Dynamic programmingGame theory+2No attempts yet1s128 MBJudgeable
GenotypesGiven budding rules A1 -> A2 A3, decide for each target word whether it can be derived from some number of supergenes S, and report the minimum count.Medium7Dynamic programmingIntervals+2No attempts yet1s128 MBJudgeable
PawnGiven a large board colored by row intervals, answer whether two squares lie in the same connected same-color region under 8-directional moves.Medium7Union-findIntervals+2No attempts yet1s192 MBJudgeable
LinkNetGiven intervals on a line, schedule each transmission into a tick so that no interval in the same tick contains another interval's endpoint strictly inside it, and no point is used twice per tick; find the minimum ticks.Medium7IntervalsGreedy+2No attempts yet1s128 MBJudgeable
PhotosFind the point covered by the largest number of given axis-aligned rectangles.Medium7Segment treeSorting+1No attempts yet1s512 MBJudgeable
HalloweenGiven the sequence of required costumes, find the fewest put-ons when costumes stack and removals are free.Medium7Dynamic programmingIntervalsNo attempts yet1s128 MBJudgeable
The Funny Informatics ContestDecide whether each round can be assigned a non-overlapping continuous block of the required length inside its time window.Medium7GreedyIntervals+1No attempts yet1s128 MBJudgeable
Never Say NeverDecide whether two employees employed at the same moment ever have equal linear effectiveness values.Medium7SortingIntervals+1No attempts yet2s128 MBJudgeable
VisasChoose visa requests and give each a distinct day inside its window for the largest total payment.Medium7Dynamic programmingSorting+1No attempts yet1s128 MBJudgeable
AcceleratorMatch every red point on a discrete circle to a distinct blue point so the sum of shorter-arc distances is as small as possible.Medium7Dynamic programmingSorting+1No attempts yet1s128 MBJudgeable
Square AnnulusGiven N points, find the minimum width of a concentric axis-parallel square ring that contains all of them.Medium7GeometryBinary search+2No attempts yet1s128 MBJudgeable
Furniture FactoryDecide if m workers can finish n preemptible jobs with release times and deadlines when each job takes at most one worker at a time.Medium7GraphIntervalsNo attempts yet2s128 MBJudgeable
LaptopPlace each unit-time task inside its release time and deadline so idle gaps between tasks are as few as possible.Medium7Dynamic programmingGreedy+2No attempts yet2s128 MBJudgeable
Pizza DeliveryChoose which houses on a road to visit and in what order so earnings minus delivery times give the largest total profit.Medium7Dynamic programmingIntervalsNo attempts yet1s128 MBJudgeable
Popping GroupsDecide whether a string of a and b can be fully erased by repeatedly deleting maximal runs of at least two equal letters.Medium7Dynamic programmingString+1No attempts yet2s128 MBJudgeable
ArcheryDecide whether some spot on the archer line fires one straight shot through every horizontal target segment.Medium7GeometryIntervals+1No attempts yet1s128 MBJudgeable
Log JumpingFind the largest set of equal-length logs that can be visited in a closed tour where jumps are allowed between logs whose segments share a point.Medium7IntervalsSorting+1No attempts yet1s128 MBJudgeable
Seminar RoomEach group submits two candidate time intervals, and the program picks one per group so that no two chosen intervals overlap.Medium7GraphDFS+1No attempts yet1s128 MBJudgeable
Wire ConnectionChoose the fewest vias so vertical wires from the power line to those vias cross every horizontal wire.Medium7GreedyIntervals+1No attempts yet1s128 MBJudgeable
Subway MapDecide whether every station label fits above or below the line covering its own station point and no other, with no two labels overlapping.Medium7BacktrackingGeometry+1No attempts yet1s128 MBJudgeable
Surveillance SystemPick the fewest cameras whose clockwise ranges together cover all 100000 sectors on the circular boundary.Medium7GreedyIntervals+1No attempts yet1s128 MBJudgeable
Cliff WalkingFind the farthest square reachable on a 12-hour round trip over a tidal grid, stepping only between squares within 1m of height after each dried for an hour.Medium7Shortest pathGraph+2No attempts yet1s128 MBJudgeable
Chemicals MonitoringVictor admits the maximum-priority subset of streams that one shared output unit can report in stack order.Medium7Dynamic programmingStack+2No attempts yet4s256 MBJudgeable
Conditional StatementsGiven one-variable if lines that switch on numbered lights, delete as many lines as possible without changing which lights turn on for any input values.Medium7IntervalsHash map+1No attempts yet1s128 MBJudgeable
DiamondsArthas opens boxes outward from his starting keys to collect every diamond with the fewest openings.Medium7Dynamic programmingIntervals+1No attempts yet1s128 MBJudgeable
Array GameThe player shifts all numbers left or right each turn to maximize the total signed value collected when numbers land on fixed plus and minus cells.Medium7Dynamic programmingIntervalsNo attempts yet1s128 MBJudgeable
Flight Boarding OptimizationYou split the rows into k contiguous zones and order their boarding phases, keeping queue order inside each zone, to minimize total boarding difficulty.Medium7Dynamic programmingIntervals+1No attempts yet2s256 MBJudgeable
International EventFind the minimum distance for a robot starting and ending at A to move every flag along a line from its old pole to a pole requesting that nation.Medium7GreedyPrefix sum+1No attempts yet5s128 MBJudgeable
NP-hardFind the shortest route that visits each of up to 1500 cities once when every city keeps all lower-numbered cities on one side of it.Medium7Dynamic programmingIntervalsNo attempts yet2s256 MBJudgeable
TorrentHwiwon collects all n pieces from seeds with fixed online windows at one piece per second and reports the earliest time the file is complete, or -1.Medium7GraphBinary search+1No attempts yet2s128 MBJudgeable
It Can Be ArrangedFind the fewest rooms for daily courses that each need several parallel rooms, where a room can run course j after course i only if cleaning ends first.Medium7GraphIntervals+1No attempts yet2s128 MBJudgeable
Infix to PrefixGiven a prefix expression with spaces and parentheses removed, compute the smallest and largest values over all valid parses.Medium7Dynamic programmingIntervals+1No attempts yet5s128 MBJudgeable
DemonstrationsChoose up to two intervals to cancel so the total covered length of the remaining intervals shrinks as much as possible.Medium7IntervalsSortingNo attempts yet3s128 MBJudgeable
The HeroFind the shortest sailing time from island 1 to island n, waiting on islands to dodge trap intervals that forbid presence on active days.Medium7Shortest pathIntervalsNo attempts yet1s128 MBJudgeable
LaserChoose up to K rays from the origin to hit the most first-quadrant segments, with no segment hit by two rays.Medium7Dynamic programmingGeometry+2No attempts yet3s512 MBJudgeable
Xiao Long BaoChoose the order to eat N dumplings in a row to maximize total flavor, with each eaten dumpling adding its bonus to uneaten dumplings within its reach.Medium7Dynamic programmingIntervalsNo attempts yet1s128 MBJudgeable
TeamsSplit the row into the most contiguous teams so each student's team size lies within their given range, and count those optimal splits.Medium7Dynamic programmingSegment tree+1No attempts yet5s256 MBJudgeable
Ring road bus routesPrint the numbers of the clockwise arcs on an N-stop ring that no other given arc fully covers, in increasing order.Medium7IntervalsSorting+1No attempts yet2s256 MBJudgeable
Picture ValidatorDecide whether two robot-drawn line pictures cover the same point set up to translation.Medium7GeometryIntervals+1No attempts yet1s256 MBJudgeable
ShoppingA shopper starts at the entrance, visits each of N shops in a row under the given order constraints, and ends at the exit with the shortest total walk.Medium7Dynamic programmingIntervalsNo attempts yet1s256 MBJudgeable
Strange AntennasCount grid cells covered by an odd number of diagonal triangular antenna signals.Medium7GeometryPrefix sum+1No attempts yet5s256 MBJudgeable
Generalized Roman NumeralsGiven a string of Roman letters, list every distinct value it can take under all parenthesizations of the subtract-when-smaller rule.Medium7Dynamic programmingIntervals+1No attempts yet3s256 MBJudgeable
Two YachtsPick priced time intervals so no day is covered more than twice and the total price is maximal.Medium7Dynamic programmingIntervals+1No attempts yet1s256 MBJudgeable
Alien InvadersDestroy each alien within its time window using bombs, where a bomb of power R kills all aliens present within distance R at cost R, for minimum total fuel.Medium7Dynamic programmingDivide and conquer+2No attempts yet3s256 MBJudgeable
The Safe SecretFor each ring rotation, replace each ? with +, - or * and parenthesize to get the min and max values, then join their digits in order.Medium7Dynamic programmingIntervalsNo attempts yet1s256 MBJudgeable
AntennasPlace carrier-specific or shared antennas on a line so each house interval meets a matching coverage interval at minimum cost.Medium7Dynamic programmingSorting+1No attempts yet2s256 MBJudgeable
Cutting the Cake 2JOI chooses the first slice of a round cake, then both sides take exposed ends in turn against an opponent who always takes the larger end.Medium7Game theoryDynamic programming+1No attempts yet2s512 MBJudgeable
Trapped in the HaybalesMeasure the total length of starting positions between sorted bales from which repeated run-up breaks can reach neither the leftmost nor the rightmost bale.Medium7Dynamic programmingSorting+2No attempts yet1s256 MBJudgeable
MatChoose a set of top-anchored and bottom-anchored rectangles with disjoint interiors that maximizes total profit.Medium7Dynamic programmingIntervals+1No attempts yet1s512 MBJudgeable