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
Voter DepressionPick non-overlapping story intervals to multiply exposed voters' propensities and maximize the right-minus-left propensity gap.Medium5Dynamic programmingIntervals+1No attempts yet2s512 MBJudgeable
Candy ChainGiven a candy string and a list of paid parts (each reversible), find the maximum total value obtainable by repeatedly removing sold parts and rejoining the remainder.Medium5Dynamic programmingIntervals+2No attempts yet7s512 MBJudgeable
The StoveEach visitor stays for one time unit at a distinct arrival time; with at most K lights, minimize total stove-on time by skipping the largest idle gaps.Medium5GreedySorting+1No attempts yet1s256 MBJudgeable
Segments and QueriesProcess up to 100 queries that add intervals of strictly increasing length and ask whether two added intervals are connected by the overlap-based move relation.Medium5GraphUnion-find+2No attempts yet1s512 MBJudgeable
Measuring TrafficGiven sensor readings for each mile as inflow, outflow, or highway flow ranges, find the tightest possible interval for the flow before mile 1 and after mile N.Medium5IntervalsSimulation+2No attempts yet2s512 MBJudgeable
ContestGiven N intervals with start time, end time, and prize money, choose non-overlapping contests (end must not touch the next start) to maximize total prize.Medium5Dynamic programmingSorting+2No attempts yet1s256 MBJudgeable
Carpool MatchingEach passenger has a destination point and each driver accepts a closed interval of destinations; match the maximum number of passenger-driver pairs.Medium5GreedySorting+2No attempts yet3s512 MBJudgeable
What's Mine is MinePick non-overlapping ore intervals to maximize total value, where each interval's value is its duration times its mineral's price.Medium5Dynamic programmingSorting+2No attempts yet0.5s512 MBJudgeable
Riyuna Likes Sailor UniformsGiven N shirt widths and M collar widths, a collar of width c fits a shirt of width w if w/2 <= c <= 3w/4 or w <= c <= 5w/4; find the maximum number of valid shirt-collar pairs.Medium5GreedyTwo pointers+2No attempts yet1s256 MBJudgeable
Minimum Number of Conference RoomsGiven N meetings with start and end times, find the minimum number of rooms so that no two overlapping meetings share a room, where a meeting may start exactly when another ends.Medium5SortingGreedy+2No attempts yet2s256 MBJudgeable
Meeting Room Scheduling 4Choose a set of non-overlapping meetings, where touching endpoints are allowed, to maximize the total number of attendees.Medium5Dynamic programmingSorting+2No attempts yet1s256 MBJudgeable
Stars on Shoulder BoardsGiven bounds on star counts and the min and max stars removable from officer Y, find the smallest and largest possible battalion size.Medium5MathImplementation+2No attempts yet2s512 MBJudgeable
RegionsGiven N cities linked by a chain of express roads plus extra directed roads, split cities into equal-size regions that preserve a strict one-way reachability order, maximizing region count.Medium6GraphIntervals+2No attempts yet2s128 MBJudgeable
Lecture Rooms 2Assign each of N intervals a room number using the minimum number of rooms so overlapping lectures never share a room, touching endpoints allowed.Medium6GreedyHeap+2No attempts yet2s128 MBJudgeable
Morning Three and Evening FourGiven N banana weights, choose non-overlapping length-K blocks to move as a C-second group, minimizing total time and then the number of groups used, with output of chosen block positions.Medium6Dynamic programmingPrefix sum+2No attempts yet2s128 MBJudgeable
Card BundlesGiven a shuffled permutation of 1 to N, output N-1 adjacent merges that combine bundles into a single bundle where each intermediate bundle holds consecutive integers.Medium6StackGreedy+2No attempts yet2s128 MBJudgeable
RectanglesFind a line through the origin that intersects the maximum number of given axis-aligned rectangles, using each rectangle's angular interval from the origin.Medium6IntervalsSorting+1No attempts yet2s128 MBJudgeable
Bus and PassengersGiven up to 50000 requested one-directional bus segments and a bus of capacity C on a route of N stops, maximize the total number of passengers carried in one round trip without exceeding capacity at any point.Medium6GreedyIntervals+1No attempts yet2s128 MBJudgeable
Mayor Election PostersGiven n posters pasted in order over intervals on a huge wall, count how many posters remain at least partially visible after later posters overlap earlier ones.Medium6Segment treeCombinatorics+2No attempts yet1s192 MBJudgeable
Princess's GardenSelect the minimum number of intervals (flower bloom ranges) to cover every day from March 1 to November 30, or report 0 if impossible.Medium6GreedyIntervals+1No attempts yet1s192 MBJudgeable
Water TaxiGiven pickup and drop-off points along a line for many passengers picked up by a boat starting at 0 that must end at M, compute the minimum travel distance covering everyone.Medium6GreedyPrefix sum+1No attempts yet1s128 MBJudgeable
BOATGiven clients in fixed order, each with rental durations and deadline-based payment options, schedule non-overlapping rentals to maximize total earned money.Medium6Dynamic programmingGreedy+1No attempts yet1s128 MBJudgeable
Convention CenterChoose the largest set of non-overlapping day intervals, breaking ties by picking the set of group indices that is lexicographically smallest.Medium6GreedySorting+2No attempts yet2s64 MBJudgeable
CoverageGiven up to 100 towers with integer centers and radii, compute the percentage of a line segment path covered by at least one tower, rounded to two decimals.Medium6GeometryIntervals+2No attempts yet1s128 MBJudgeable
Cell Phone AntennaPlace one antenna of range 1000 on the line y=0 so that the total inhabitants of all covered houses is maximized, and report that maximum.Medium6GeometryIntervals+2No attempts yet1s128 MBJudgeable
The Splitting ClubGiven distinct ages with member counts and a ratio R, partition all age groups into the fewest contiguous sections where the max count in a section is at most R times the min count.Medium6GreedyTwo pointers+2No attempts yet1s128 MBJudgeable
Painting the FenceBessie walks along a number line and each segment she covers gains a coat of paint; find the total length covered by at least K coats.Medium6IntervalsSorting+2No attempts yet1s128 MBJudgeable
Painting the FenceBessie walks back and forth along a line, each pass adding a coat; find the total length covered by at least two coats.Medium6Prefix sumSorting+2No attempts yet1s128 MBJudgeable
Treasure ChestTwo players alternately take a coin from either end of a row of N coins; find the maximum total the first player can guarantee with optimal play.Medium6Dynamic programmingGame theory+2No attempts yet1s128 MBJudgeable
Work SchedulingGiven jobs each taking one unit of time with a deadline and a profit, choose a subset to schedule so total profit is maximized.Medium6GreedyHeap+2No attempts yet1s128 MBJudgeable
Milking TimeChoose non-overlapping milking intervals, each separated by at least R rest hours, to maximize the total milk produced over N hours.Medium6Dynamic programmingBinary search+2No attempts yet1s128 MBJudgeable
Cow Roller CoasterChoose components that tile [0, L] with no gaps or overlaps, maximizing total fun while keeping total cost within budget B.Medium6Dynamic programmingSorting+2No attempts yet1s128 MBJudgeable
Decorate the WallGiven non-overlapping axis-aligned rectangles on a wall, find the lowest then leftmost position where a new w' by h' rectangle fits without overlapping any of them, or report failure.Medium6GeometrySorting+2No attempts yet1s128 MBJudgeable
Ambiguous ResultGiven a parenthesis-free expression of numbers joined by + and *, restore parentheses to find the smallest and largest values it can evaluate to.Medium6Dynamic programmingIntervals+2No attempts yet1s128 MBJudgeable
Moving PianosEach piano job is a day interval; decide whether all jobs fit on weekdays, or only with weekends, or not at all, given p tuners doing floor(p/2) jobs per day.Medium6GreedyIntervals+2No attempts yet1s128 MBJudgeable
Grazing on the RunBessie starts at position L and walks a line to eat N grass clumps; minimize the sum of times at which each clump is eaten.Medium6Dynamic programmingIntervals+1No attempts yet1s128 MBJudgeable
Dividing the PathPartition the segment [0, L] into consecutive pieces of even length between 2A and 2B so no cut lands strictly inside any cow's interval, and minimize the number of pieces, or report that no partition exists.Medium6Dynamic programmingPrefix sum+2No attempts yet1s128 MBJudgeable
Cleaning ShiftsCover shifts 1 through T with the fewest intervals, where each interval covers a contiguous range of shifts. Return the minimum number of intervals or -1.Medium6GreedySorting+2No attempts yet1s128 MBJudgeable
TelevisionGiven N intervals on a line, choose the fewest intervals so that every point covered by any interval is covered by a chosen one, then print that count.Medium6GreedySorting+2No attempts yet1s1024 MBJudgeable
Moving TablesEach move occupies a corridor segment; find the minimum number of 10-minute rounds so that overlapping segments never share a round.Medium6GreedySorting+1No attempts yet1s128 MBJudgeable
Joke with TurtlesEach turtle claims a count of turtles ahead and behind it; choose positions to maximize how many claims hold at once.Medium6Dynamic programmingGreedy+2No attempts yet2s128 MBJudgeable
AdvertisementPlace the fewest advertisements so every jogger's interval of billboards contains at least min(K, length) of them.Medium6GreedyIntervals+2No attempts yet1s128 MBJudgeable
Keep the Customer SatisfiedGiven orders with processing times and due dates on a single machine, choose the largest subset that can all finish on time.Medium6GreedySorting+2No attempts yet1s1024 MBJudgeable
Angry LarvaEach snake is a vertical segment at some x-coordinate and height range. Find the launch angle whose parabola passes through the most segments.Medium6GeometryIntervals+1No attempts yet1s128 MBJudgeable
BracketsGiven a bracket string, find the maximum length of a regular bracket sequence obtainable as a subsequence.Medium6Dynamic programmingIntervals+1No attempts yet1s128 MBJudgeable
Two ProfessorsFind the minimum number of rooms for fixed-interval classes, given that professors 1 and 2 must never share a room.Medium6SortingGreedy+1No attempts yet3s128 MBJudgeable
Lecture Halls ReservationChoose a set of non-overlapping intervals (open at both ends) to maximize the total length covered, given n up to 10000 and times up to 30000.Medium6Dynamic programmingSorting+2No attempts yet1s256 MBJudgeable
TemperatureEach day gives an interval the temperature could lie in; find the longest run of consecutive days that can be assigned non-decreasing values.Medium6GreedyTwo pointers+2No attempts yet1s128 MBJudgeable
KangaroosFor each lens interval, find the longest contiguous block of sighting intervals that all overlap it.Medium6IntervalsSorting+2No attempts yet5s128 MBJudgeable
ExamGiven n equal-size axis-aligned rectangles dropped in order, report the indices of sheets whose interior no later sheet covers.Medium6GeometryIntervals+2No attempts yet5s128 MBJudgeable
BridgesAssign each pair a distinct height so the number of vertical-horizontal crossings is minimal and output the bridges from lowest to highest.Medium6IntervalsTopological sort+1No attempts yet2s128 MBJudgeable
ProgramCount the starting values from 1 to M that reach exactly A after running the given add, subtract, multiply, and floor-divide program.Medium6Binary searchIntervals+1No attempts yet1s128 MBJudgeable
Genome EvolutionCount the shared gene blocks of length above one that appear as consecutive runs in both chromosomes.Medium6IntervalsArrayNo attempts yet1s128 MBJudgeable
StreetChoose up to k non-overlapping blocks of at most t lots to maximize total block length times its minimum height limit.Medium6Dynamic programmingIntervalsNo attempts yet2s512 MBJudgeable
RectanglesCompute the total area covered by up to 1000 axis-aligned rectangles, counting overlaps once.Medium6SortingIntervals+1No attempts yet1s128 MBJudgeable
SnowstormSimulate plows clearing road intervals in order of smallest remaining uncovered length and print the clearing order.Medium6IntervalsSimulation+2No attempts yet1s128 MBJudgeable
Surveillance CamerasChoose the fewest circular arcs that cover all N rooms on a circle, or report impossible.Medium6GreedyIntervals+1No attempts yet4s512 MBJudgeable
KRAVEYou extend a horizontal or vertical fence from each given point across its current field and report the two resulting areas in order.Medium6IntervalsBinary search+1No attempts yet5s256 MBJudgeable
VampireA circular sun of radius r rises from the horizon behind rectangular buildings, and each dataset asks for the last time the whole disk stays hidden.Medium6GeometryIntervals+1No attempts yet3s256 MBJudgeable
Number Picking GameAhyeon removes interior numbers one at a time, scores each pick plus its live neighbors, and maximizes the total score.Medium6Dynamic programmingIntervalsNo attempts yet1s256 MBJudgeable
Ship TrafficFind the longest subinterval of start times in [t1, t2] during which a northbound ferry avoids every moving ship in each lane.Medium6IntervalsSorting+1No attempts yet3s256 MBJudgeable
NAFTAFor each K from 1 to S, drill up to K whole columns to drain every touched oil pool and maximize the collected oil.Medium6Dynamic programmingIntervals+1No attempts yet2s512 MBJudgeable
Deque Sort 2Place each number at the front or back of an existing deque or into a new one so the deques join into ascending order with the fewest deques.Medium6Dynamic programmingSorting+1No attempts yet1s256 MBJudgeable
Merging FilesCompute the cheapest way to merge consecutive chapter files when each merge costs the sum of the two parts.Medium6Dynamic programmingIntervals+1No attempts yet2s256 MBJudgeable
Cow CraneDecide whether a crane starting at 0 with speed 1 can carry each of two cows from its start to its target by its deadline while holding one cow at a time.Medium6Brute forceGreedy+2No attempts yet1s256 MBJudgeable
TomosynthesisGiven N disjoint disks, find the widest angle range over which their parallel projections stay pairwise disjoint.Medium6GeometryIntervals+1No attempts yet1s256 MBJudgeable
Floppy MusicDecide if every drive head can cover its required sound intervals by moving steadily without a forced turn or stray sound.Medium6Dynamic programmingIntervalsNo attempts yet1s256 MBJudgeable
Railway TicketsCount station pairs where every leg has a free seat but no single seat stays free for the whole trip.Medium6IntervalsSorting+1No attempts yet1s256 MBJudgeable
Wall ClocksEach member sees a section of the office walls inside a 90 degree cone, and the task asks for the fewest clock points so every member sees at least one.Medium6GreedyIntervals+1No attempts yet1s256 MBJudgeable
Power OutageDecide which lamps run in blackouts to maximize the road length lit both normally and during blackouts.Medium6IntervalsSorting+1No attempts yet1s256 MBJudgeable
262144Merge adjacent equal numbers into a number one larger in any order to build the largest value possible.Medium6Dynamic programmingIntervalsNo attempts yet2s512 MBJudgeable
The 248 GameMerge adjacent equal numbers into a number one larger to maximize the largest value left.Medium6Dynamic programmingIntervalsNo attempts yet2s512 MBJudgeable
IP Address SummarizationMerge the given IPv4 subnets and print the shortest ordered list of normalized subnets that covers exactly the same addresses.Medium6IntervalsBit manipulation+2No attempts yet5s512 MBJudgeable
Smoothing Window (Small)Given sliding window sums of an unknown integer sequence, find the smallest possible range between its largest and smallest values.Medium6Binary searchIntervals+1No attempts yet5s512 MBJudgeable
Radio Receiver (Small)Choose a walking path at speed at most one so every timed message on a line is within the smallest possible reception distance.Medium6Binary searchIntervals+1No attempts yet5s512 MBJudgeable
Radio ReceiverFind the smallest radius D that lets a person moving at speed one stay within D of each broadcast at its sending time.Medium6Binary searchIntervals+1No attempts yet5s512 MBJudgeable
Card Fusion EventMerge adjacent cards until one remains, where a merge pays the sum of both levels and keeps only the left card's level; maximize total gold.Medium6IntervalsDynamic programmingNo attempts yet1s512 MBJudgeable
Stock ChartsGiven N piecewise-linear price graphs over K time points, find the minimum number of charts so that no two graphs on a chart intersect.Medium6GeometryIntervals+1No attempts yet2s512 MBJudgeable
Happy CowRemove portions from either end of a row over N days; on day d a portion with value H gives H times d. Maximize total happiness.Medium6Dynamic programmingIntervalsNo attempts yet2s512 MBJudgeable
Chain DetonationPlace one extra bomb past the last one with unlimited power to destroy as many not-yet-detonated bombs, minimizing the duds among the original bombs.Medium6GreedyIntervals+1No attempts yet2s512 MBJudgeable
Donut DecorationGiven N donuts and T interval operations each applying a task number, count donuts whose operations form tasks 1..K in order.Medium6IntervalsSorting+1No attempts yet5s512 MBJudgeable
Maximum Clique of an Interval GraphGiven N intervals, find a largest set of pairwise overlapping intervals, and output its size plus the vertex indices in lexicographically smallest order.Medium6SortingGreedy+2No attempts yet1s512 MBJudgeable
Cutting a StringGiven cut positions on a string of length N, find the order of cuts that minimizes the total cost, where each cut of a piece of length L costs L.Medium6Dynamic programmingIntervalsNo attempts yet2s512 MBJudgeable
Daruma OtoshiGiven a stack of weighted blocks, remove adjacent pairs whose weights differ by at most 1, in any order, to maximize the total removed.Medium6Dynamic programmingIntervalsNo attempts yet2s512 MBJudgeable
RailroadGiven n intervals with distinct endpoint positions, find the maximum number of intervals fully contained in some segment of fixed length d.Medium6SortingSliding window+2No attempts yet1s512 MBJudgeable
Carrot FarmMaintain a set of disjoint planted intervals under plant and harvest operations; after each, report the empty or planted area directly left and right of the affected span. Each area is (number of columns) times L.Medium6IntervalsTree+2No attempts yet3s512 MBJudgeable
MacbethGiven n time intervals and w witches, each witch predicts a chain of non-overlapping intervals, so find the maximum number of intervals coverable by w chains.Medium6IntervalsGreedy+1No attempts yet2s512 MBJudgeable
CardsGiven an even row of cards with integers, two players alternately take an end card; the first player maximizes his total sum while the second minimizes it. Report the best score the first player can guarantee.Medium6Dynamic programmingGame theory+2No attempts yet2s512 MBJudgeable
Alien Ribonucleic AcidFor each strand, compute the largest number of base pairs (B-S and C-F) that can form when disjoint intervals fold onto themselves.Medium6Dynamic programmingIntervalsNo attempts yet2s512 MBJudgeable
Parking LotSimulate a single-line parking lot where each arriving vehicle takes the first free gap from the entrance that fits, and total the fees for vehicles that park.Medium6SimulationImplementation+2No attempts yet2s512 MBJudgeable
Hard RefactoringMerge a union of integer intervals given as comparisons, then reprint the merged ranges using the fewest possible constants, with special handling for saturated ends and all-true or all-false cases.Medium6IntervalsSorting+2No attempts yet2s512 MBJudgeable
Large PhD RestaurantGiven N tasks each with a cost and a reward, and starting money M, choose an order to run tasks (paying cost first, then gaining reward) that maximizes the final money.Medium6GreedySorting+2No attempts yet2s512 MBJudgeable
Minions and the roomsRooms flip between available and unavailable over range updates; after each flip, count set partitions of N minions into the k currently available rooms, mod 880803841.Medium6CombinatoricsIntervals+1No attempts yet2s512 MBJudgeable
Why Did the Cow Cross the Road 4Match chickens, each available at a single time, to cows whose interval covers that time, so that as many cows as possible get help.Medium6GreedySorting+2No attempts yet2s512 MBJudgeable
SceneryGiven n time windows and a fixed photo duration t, decide whether all photos can be scheduled as non-overlapping intervals.Medium6GreedySorting+2No attempts yet6s512 MBJudgeable
Nothing But The TruthGiven facts about which person was at which place and when, count how many claims in a text (who met whom, who was where) are definitely false.Medium6StringIntervals+1No attempts yet2s512 MBJudgeable
Cows on a LeashGiven N intervals, find the fewest half-integer cut points so that every interval contains at least one chosen point.Medium6GreedyIntervals+1No attempts yet2s512 MBJudgeable
HipercampoGiven two anchors on the x-axis and N points above, choose the largest subset whose segments to both anchors meet only at the anchors.Medium6GeometrySorting+2No attempts yet1s1024 MBJudgeable
Intuidiff IIGiven intervals in the order they appear in a modified document, choose a subsequence of intervals whose original ranges strictly increase; maximize total characters left plain.Medium6Dynamic programmingIntervals+2No attempts yet4s512 MBJudgeable
A Strange TournamentGiven a sequence of distinct powers, choose a non-crossing knockout bracket minimizing the total absolute difference over all matches played.Medium6Dynamic programmingDivide and conquer+2No attempts yet2s512 MBJudgeable