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 results3,704 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Largest RectangleGiven a binary matrix where columns may be freely reordered, find the maximum area rectangle of all-1 cells after computing per-cell run heights and sorting rows to combine widths. | Medium7 | Dynamic programmingGreedy+2 | No attempts yet | 0.6s | 128 MB | Judgeable |
| Royal TreasuryGiven a tree hierarchy, find the maximum matching between parent-child pairs and count the number of maximum matchings, likely modulo something implicit. | Medium7 | TreeDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Bus TripFind a bus route plan from town 1 to town P arriving by time T that guarantees valid connections while minimizing worst-case total waiting time. | Medium7 | Shortest pathGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Character EquationGiven a recursive definition of a huge string T through variable concatenation equations, determine whether a pattern P is a subsequence of T without expanding T explicitly. | Medium7 | Dynamic programmingString+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Binary Stirling NumbersGiven n and m up to 1e9, determine the parity of the Stirling number of the second kind S(n, m) for many test cases efficiently. | Medium7 | Bit manipulationMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| I-KeyboardPartition an ordered list of letter frequencies into K consecutive groups to minimize sum of frequency times in-group position, with a tie-break favoring later keys getting more letters, then output the resulting keyboard layout. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| CaptionGiven a fixed current pixel grid layout and a new text with letter width k and spacing bounds smin/smax, find the layout minimizing flipped pixels using DP over positions and letters with precomputed per-letter overlap costs. | Medium7 | Dynamic programmingString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Kids Like CakesGiven a convex polygon, find the triangulation using only its vertices that maximizes the area difference between the largest and smallest triangle. | Medium7 | Dynamic programmingGeometry+1 | No attempts yet | 5s | 256 MB | Judgeable |
| Kitchen RobotFind the shortest robot route that starts at a given point, visits n bottles, and drops each bottle off at the nearest border point, requiring TSP-style optimization with precomputed border distances. | Medium7 | Dynamic programmingGeometry+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Auxiliary Question of the UniverseGiven a fragment of an arithmetic expression grammar (numbers, plus, parentheses), find the minimum insertions needed to make it a valid expression while keeping the fragment as a subsequence. | Medium7 | Dynamic programmingString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| AntsFind the minimum-cost perfect matching between n points and n points using squared Euclidean distance as edge weight. | Medium7 | GraphMath+1 | No attempts yet | 3s | 128 MB | Judgeable |
| DFAGiven a finite set of words, compute the minimum number of states of a DFA recognizing exactly that language. | Medium7 | TrieDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| DecipheringCount the ways to split an unspaced text into dictionary words, group them into sentences, and match each sentence to a valid part-of-speech rule, capping the huge counts. | Medium7 | Dynamic programmingString+2 | No attempts yet | 2s | 64 MB | Judgeable |
| Castle GuardsGiven a recursively described tree of small buildings connected by corridors, compute the minimum vertex cover (guard placement) that watches every corridor in the whole castle. | Medium7 | Dynamic programmingTree+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Mountain RoadSchedule two queues of cars crossing a one-lane road with direction-blocking and same-direction spacing rules to minimize the last car's exit time. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 2s | 128 MB | Judgeable |
| MobileGiven a recursively nested mobile of weighted objects, find the minimum number of object weights to change so every rod balances left and right. | Medium7 | TreeDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| AmbiguousSplit a scrambled, space-free string into a unique sequence of dictionary words matching letter multisets, first and last letters, reporting ambiguity or impossibility. | Medium7 | Dynamic programmingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Unequalled ConsumptionGiven up to 5 candy weights, find for each query P the smallest total weight whose number of representations (as an unordered multiset count) is at least P, using binary search over weight combined with counting compositions via generating functions or DP. | Medium7 | Dynamic programmingBinary search+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Multiprocessor SchedulingGiven two sequences of N processor-bound procedures each, find the minimum makespan when a shared processor forces ordering constraints between the two applications. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 3s | 128 MB | Judgeable |
| AlibabaGiven points on a line with deadlines, find the minimum finishing time to visit all points starting from an optimally chosen point, respecting each point's deadline, or report impossibility. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Beautiful LayoutGiven word lengths and page width W, determine how to break the words into justified rows so that the maximum consecutive blank run is minimized, and output that minimum value. | Medium7 | Binary searchGreedy+1 | No attempts yet | 5s | 128 MB | Judgeable |
| DartsCompute win probabilities up to score 501 for two darts players with different throw distributions, where B optimizes target section each turn. | Medium7 | Dynamic programmingProbability+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Power CalculusFind the minimum number of multiplications and divisions (using addition chains with subtraction allowed, keeping intermediate exponents positive) needed to build x^n for n up to 1000. | Medium7 | Dynamic programmingMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| The Best Name for Your BabyGiven a context-free grammar-like rewriting rule set, find the lexicographically smallest terminal string of exactly length l derivable from start symbol S. | Medium7 | Dynamic programmingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| 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. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Riding Roller CoastersGiven N coasters with fun a_i-(k-1)^2*b_i per ride and fixed ride times, answer Q queries for the maximum total fun within each time budget. | Medium7 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Exact MeasurementEach box offers up to q_i masses of weight 10^k_i; find the fewest boxes to open so the chosen masses sum to exactly x. | Medium7 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| MobileGiven a full binary tree of rods and toys, find the minimum number of left-right child swaps so that all toys sit at depths differing by at most 1, with deeper toys to the left. | Medium7 | TreeGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Parencedence!Two players alternately parenthesize one operator of an expression, maximizing and minimizing the value, and two rounds with swapped first movers decide the winner. | Medium7 | Game theoryDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Sofa, So GoodGiven framing and upholstering time matrices, find the minimum-cost framing assignment, then the minimum-cost upholstering assignment, and report each worker's schedule and total idle time. | Medium7 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Banzhaf Buzz-OffGiven board members with distinct weights, count for each weight how many winning coalitions make a member with that weight a critical voter. | Medium7 | Dynamic programmingCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| GPS I Love YouFind the minimum number of roads to force so that a specified simple route becomes the shortest path favored by the GPS. | Medium7 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| AbbreviationsGiven ignored stopwords, an abbreviation, and a sentence, count the distinct ways to split the abbreviation into pieces matched as subsequences of the meaningful words in order. | Medium7 | Dynamic programmingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Family FortuneChoose K nodes in a rooted tree, no one an ancestor of another, maximizing the sum of weights; print 0 if impossible. | Medium7 | Dynamic programmingTree+1 | No attempts yet | 10s | 128 MB | Judgeable |
| Moving PointsFind the least time for one chaser to intercept N moving targets in order when the chaser is faster than every target. | Medium7 | Dynamic programmingGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Counting BitsCount integers in [LO, HI] whose number of halving steps under the popcount map reaches 1 in exactly X steps. | Medium7 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Lawrence of ArabiaCut at most M of the N-1 gaps in a line of weighted depots to minimize the sum of products over all still-connected pairs. | Medium7 | Dynamic programmingPrefix sum+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Bridges and TunnelsGiven an undirected weighted graph whose edges are marked indoor or outdoor, answer p queries, each asking for the minimum outdoor time from one building to another, breaking ties by total time. | Medium7 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Thirty-One GameGiven a prefix of draws in the card game Thirty-One with cards 1 to 6, decide who wins from that position under perfect play with the remaining deck. | Medium7 | Game theoryDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ShoppingGiven weighted roads and up to 10 stores, find the shortest round trip from house 0 visiting every store. | Medium7 | GraphShortest path+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Shortest Flight PathGiven airports on a sphere, find the shortest route between two airports staying inside the union of radius-R circles and within each fuel leg. | Medium7 | GraphShortest path+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Stacking BowlsGiven several already-sorted stacks of bowls, find the minimum number of split and merge operations to combine them into one globally sorted stack. | Medium7 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Non-monotonicityGiven a permutation of 1 to n, find the longest subsequence whose elements alternate down, up, down, starting with a decrease. | Medium7 | Dynamic programmingArray+2 | No attempts yet | 10s | 128 MB | Judgeable |
| Choosing the Final Die's Face ValuesEach test case fixes several dice and asks for the r face values of the last die so that m given sums appear with exactly the given counts, choosing the lexicographically smallest set. | Medium7 | Dynamic programmingPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Polly NomialsFor each polynomial with leading coefficient 1, evaluate it at x = 1 or -1 and find the minimum key presses needed to compute it on a left-to-right calculator. | Medium7 | Dynamic programmingMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Preorder and PostorderCount how many m-ary trees share the given pre-order and post-order traversals. | Medium7 | TreeDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cousin StringsFind the smallest n such that x is an n-th cousin of y, where each cousin step requires a common string reachable by deleting at most half of each string, or report that no n exists. | Medium7 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| So You Want to Be a 2ⁿ-aire?A contestant with a current prize faces n questions; each question's success chance p is uniform on [t,1]. Find the optimal expected prize, to three decimals. | Medium7 | Dynamic programmingProbability+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Grid SpeedGiven a grid of streets with speed limits, find the earliest arrival time within a time window and the most fuel-efficient trip, choosing speeds per segment. | Medium7 | GraphShortest path+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Tango Tango InsurrectionGiven a sequence of required taps or rests, find the minimum total energy for the two feet under per-foot cost and crossover rules. | Medium7 | Dynamic programmingSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Dumb BonesGiven the chance that each placed domino tips left or right, find the minimum expected total placements needed to finish a run of n dominoes. | Medium7 | Dynamic programmingProbability+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Edit Step LaddersGiven a lexicographically sorted dictionary, find the longest sequence of words where each consecutive pair differs by one insertion, deletion, or substitution, and the sequence follows dictionary order. | Medium7 | Dynamic programmingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| YahtzeeGiven 13 rounds of five dice, assign each round to a distinct Yahtzee category to maximize total score including the upper-section bonus. | Medium7 | Dynamic programmingBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Temple BuildGiven an ideal truncated square pyramid and three brick cube sizes, stack square layers fully inside the shape to maximize total volume. | Medium7 | Dynamic programmingMath+2 | No attempts yet | 3s | 128 MB | Judgeable |
| BraceletsGiven two circular strings, find the longest common subsequence that can be read in the same or opposite orientation on the two bracelets, and report twice its length. | Medium7 | Dynamic programmingString+2 | No attempts yet | 30s | 256 MB | Judgeable |
| Crazy CircuitsGiven a directed acyclic circuit with current demands on edges, find the minimum supply current at the + terminal so every component gets its required current, or report impossible. | Medium7 | GraphDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| YO!Count paint-over patterns of a short string whose remaining letters, read left to right, form one or more dictionary words without overlap. | Medium7 | Dynamic programmingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Shut the BoxGiven N pieces labeled 1 to N and up to T turn values, mark disjoint sets of unmarked pieces summing exactly to each turn value in order, and find the largest total number of pieces markable. | Medium7 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Law of the JungleGiven up to 20 bridges with capacity and crossing time, simulate the two rules to find the minimum total time for all people to cross. | Medium7 | SimulationGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Two MountaineersGiven a polygonal mountain profile with equal endpoints, find the minimum total elevation change for two climbers who swap endpoints while staying at equal height. | Medium7 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Safety in AlchemyGiven reaction heats between pairs of chemicals and limited amounts of each chemical, find the maximum total heat that can be produced. | Medium7 | GraphDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Enigmatic TravelFor each complete graph size L, compute the average cost of a random walk, a random simple path, and a random simple cycle. | Medium7 | CombinatoricsMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Covered WalkwayCover all required points on a line with segments, where covering from x to y costs c plus (x - y) squared, minimizing total cost. | Medium7 | Dynamic programmingDivide and conquer+1 | No attempts yet | 10s | 128 MB | Judgeable |
| EstimationPartition an array into k contiguous sections, each replaced by one constant value, to minimize the total absolute error. Multiple test cases until 0 0. | Medium7 | Dynamic programmingDivide and conquer+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Wealthy FamilyGiven a rooted tree with a weight on each node, pick exactly k nodes with no ancestor relation between any two, maximizing the total weight, over multiple test cases. | Medium7 | TreeDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ClickomaniaGiven a string over uppercase letters, decide whether the one dimensional Clickomania puzzle can be fully cleared. | Medium7 | Dynamic programmingIntervals+1 | No attempts yet | 10s | 128 MB | Judgeable |
| Team WorkSplit the given pieces into three groups of equal total length, using each piece at most once, and report the largest such length or 0. | Medium7 | BacktrackingBrute force+1 | No attempts yet | 5s | 128 MB | Judgeable |
| String EquationsDecide whether a subset of distinct short strings and their repeats can be split into two groups whose multiset union of characters is identical. | Medium7 | MathNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Knight StoryAssign N knights to N distinct target cells on an infinite chessboard to minimize the total number of knight moves. | Medium7 | Dynamic programmingShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Value of a TriangleGiven up to 400 rows of a triangular grid of unit triangles, find the sub-triangle with the largest sum of unit values. | Medium7 | Dynamic programmingPrefix sum+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Let's Go to the MoviesEach family is a parent with children, and tickets are either singles or family tickets (one parent plus any subset of their own children). Find the arrangement minimizing cost, breaking ties by fewest tickets. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| I Hate Number TheoryFor each query interval [L, U] below one million, find the maximum of a score built from prime-factor counts over all subintervals [a, b]. | Medium7 | Number theoryPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Round TripFind a non-descending path from town 1 to town n and a non-ascending path back, sharing the first-visit visa fee of each town, minimizing total road cost plus fees. | Medium7 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| And Then, How Many Are There?Given stacked discs of four colors, repeatedly remove two same-colored discs that are both uncovered; find the maximum number of discs removable. | Medium7 | Dynamic programmingBit manipulation+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Pollock's conjectureFor each integer below 10^6, find the fewest tetrahedral numbers that sum to it, and the fewest odd tetrahedral numbers that do. | Medium7 | Dynamic programmingNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Discrete SpeedFind the fastest route from a start to a goal city where a car enters each road at an integer speed, changes speed by at most 1 per city, starts and ends at speed 1, and cannot U-turn. | Medium7 | GraphShortest path+2 | No attempts yet | 8s | 128 MB | Judgeable |
| CardsGiven blue and red cards with numbers, find the maximum number of blue-red pairs whose two numbers share a common divisor greater than 1. | Medium7 | GraphNumber theory+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Traveling by StagecoachWith up to 8 one-use tickets, each giving a speed, find the fastest route from city a to city b, or report Impossible. | Medium7 | GraphShortest path+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Robot VacuumFind the minimum number of moves for a robot to visit and clean all dirty cells in a grid with furniture, or report -1 if some are unreachable. | Medium7 | BFSShortest path+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Power BloggerFind the cheapest closed walk from city 1 that traverses every required edge at least once, using optional extra edges. | Medium7 | GraphDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Allergy TestFind the shortest non-adaptive schedule for applying allergens on a single morning each day so that every reaction pattern identifies exactly the allergy set. | Medium7 | CombinatoricsBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Code TheftNormalize two sets of source lines and find the longest consecutive run of lines common to both, reporting the length and which files achieve it. | Medium7 | StringHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Fixing the BugsWith B bugs, T hours, and a failure factor f, choose each hour's bug by dynamic programming to maximize the expected total severity fixed. | Medium7 | Dynamic programmingProbability | No attempts yet | 1s | 128 MB | Judgeable |
| Full Tank?For each query (tank capacity c, start s, goal e), find the minimum fuel cost to drive from s to e, buying gas only at cities at given prices; output impossible if unreachable. | Medium7 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Nested DollsGiven a set of dolls with widths and heights, partition them into the fewest strictly increasing chains in both dimensions, which equals the longest antichain by Dilworth's theorem. | Medium7 | SortingDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Moogle MapsChoose c of h house locations to store so that the average linear interpolation error over all houses is minimized, with endpoints always stored. | Medium7 | Dynamic programmingMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Whac-a-MoleGiven each mole's position and time, find the maximum number of moles whacked while the hammer moves at most distance d between time steps. | Medium7 | Dynamic programmingGeometry+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Random WalkingFor each graph, decide whether every bit position in every one of k random walk outputs has a 1-probability strictly between 25% and 75%. | Medium7 | GraphProbability+2 | No attempts yet | 1s | 128 MB | Judgeable |
| 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. | Medium7 | Dynamic programmingGame theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Congested NetworksFor each connected graph with at most 40 nodes, find the maximum number of edge-disjoint paths between any pair of nodes. | Medium7 | GraphUnion-find+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Ice CreamFind the minimum cost to buy single, double, and triple scoops from two flavors so every customer's vanilla and chocolate counts are met without contaminating one-flavor orders. | Medium7 | GreedyDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Segment PricingChoose a non-increasing fare for each boarding stop, with riders boarding only if their budget covers it, to maximize total revenue. | Medium7 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cherry PickingChoose one premium per category so at least m patients are insured and total premiums minus benefits is maximized. | Medium7 | Dynamic programmingSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Hare and the HedgehogsHedgehogs of equal speed start at given points and may move freely; find the maximum number of legs they can collectively reach exactly when the hare arrives. | Medium7 | GeometryDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Campaign StopsPick campaign stops and a round tour from city 1 that sways the most voters within the available hours. | Medium7 | Dynamic programmingGraph | No attempts yet | 1s | 128 MB | Judgeable |
| Find Fame in the Disc ArenaA DAG gives games with fame values and prerequisite sets; pick a closed-under-prerequisites set (possibly empty) maximizing total fame. | Medium7 | GraphDynamic programming+2 | No attempts yet | 5s | 128 MB | Judgeable |
| BOI-handsome NumbersCount digit strings over {1,2,3} of length n that avoid forbidden adjacent pairs, comparing them under an order given by a permutation of positions, up to a bound B. | Medium7 | Dynamic programmingCombinatorics+2 | No attempts yet | 1s | 256 MB | Judgeable |
| TrapezoidsPick the most pairwise disjoint trapezoids between two lines and count those optimal sets modulo 30013. | Medium7 | Dynamic programmingSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Gold Coin GameGiven S coins and a legal move set of powers of K, find the smallest first move that guarantees a win for the starting player, or 0 if none exists. | Medium7 | Game theoryMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Top 2000Partition a fixed sequence of singles into contiguous blocks, letting each block run under or over M minutes with per-minute penalties, and minimize the total penalty. | Medium7 | Dynamic programmingPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |