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 results388 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Go up the UltrasThe program reads an altitude profile of up to 100000 points and prints the indices of every peak with prominence of at least 150000 centimeters. | Medium7 | StackSegment tree | No attempts yet | 1s | 128 MB | Judgeable |
| Genetic engineeringDelete the fewest elements so the rest splits into blocks of k equal values, and print the lexicographically smallest among the longest such genomes. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| BlanketsCompute the average pairwise overlap area of n identical axis-aligned rectangles from their corner positions. | Medium7 | Segment treeSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Optimal MilkingEach day one machine value changes, then choose nonadjacent machines with maximum total output and add it to the overall sum. | Medium7 | Segment treeDynamic programming | No attempts yet | 1s | 128 MB | Judgeable |
| Airplane BoardingCows walk single-file to assigned seats and each blocks the line while stowing baggage, so compute the time until every cow sits. | Medium7 | Segment treeSimulation | No attempts yet | 1s | 128 MB | Judgeable |
| Traveling SagaPrint the order in which an apple from vertex 1 visits every tree vertex by always moving to the farthest unvisited vertex, breaking ties by largest index. | Medium7 | TreeSegment tree+1 | No attempts yet | 3s | 256 MB | Judgeable |
| The Lazy CowChoose a start point to maximize the total grass of patches within Manhattan distance K of it. | Medium7 | Sliding windowSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| CouriersGiven the courier numbers in shipment order, report the courier that appears more than half the time in each query interval, or 0 if none does. | Medium7 | Segment treeBinary search | No attempts yet | 3s | 512 MB | Judgeable |
| The Little BirdA bird jumps from tree 1 to tree n in flights of at most k and minimizes landings on trees at least as tall as the takeoff tree. | Medium7 | Dynamic programmingStack+1 | No attempts yet | 2s | 256 MB | Judgeable |
| TeamsSplit the row into the most contiguous teams so each student's team size lies within their given range, and count those optimal splits. | Medium7 | Dynamic programmingSegment tree+1 | No attempts yet | 5s | 256 MB | Judgeable |
| 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. | Medium7 | IntervalsSorting+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Flipping ParenthesesAfter each single-bracket flip that breaks a balanced parenthesis string, find the leftmost second flip that restores balance. | Medium7 | Segment treePrefix sum | No attempts yet | 5s | 256 MB | Judgeable |
| UFOSimulate K laser shots that each remove the first R cells reaching one layer along a row or column, then find the P by P square with the largest remaining sum. | Medium7 | Segment treeSimulation+2 | No attempts yet | 5s | 256 MB | Judgeable |
| Most Influential PumpkinAfter each range increment on an odd-length array, report the median value of the array. | Medium7 | Segment treeBinary search+1 | No attempts yet | 5s | 256 MB | Judgeable |
| Marathon sub-routesGiven checkpoint coordinates with point updates, report the shortest Manhattan route over each queried interval with at most one interior checkpoint skipped. | Medium7 | Segment treeMath | No attempts yet | 1s | 256 MB | Judgeable |
| RukaUpdate vectors of a polyline through cursor commands and report how many segments cross the coordinate axes. | Medium7 | Segment treePrefix sum | No attempts yet | 2s | 512 MB | Judgeable |
| City InfluenceAdd N weighted rectangles on a billion by billion grid and print the sum of squared cell values modulo 1,000,000,007. | Medium7 | Segment treeSorting+1 | No attempts yet | 2s | 64 MB | Judgeable |
| Rectangle update and rectangle sumYou add w to all cells in one rectangle per update and print the cell sum of one rectangle per query in order. | Medium7 | Segment treePrefix sum+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Consecutive OrderingDecide whether every vertex's closed neighbourhood forms one unbroken block in the given vertex ordering. | Medium7 | IntervalsTwo pointers+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Bond TourEach parade route is the tree path between two towns, and you report the best contiguous stretch of road weights on it, or zero. | Medium7 | Segment treeTree | No attempts yet | 5s | 256 MB | Judgeable |
| The Running GamePick disjoint segments of the given sequence so the sum of each segment weighted by its position inside the segment is as large as possible. | Medium7 | Dynamic programmingPrefix sum+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Tree of Almost Clean MoneyEach operation adds generated values to up to 1000 vertices and asks for the sum on the path between two vertices. | Medium7 | TreeSegment tree | No attempts yet | 4s | 256 MB | Judgeable |
| BitrisFind the fewest adjacent swaps that let all paired cubes cancel by repeatedly deleting equal neighbors. | Medium7 | IntervalsSorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Keep it energizedBuy energy packs at level shops so the stored energy covers each level cost in order for the least total cash. | Medium7 | Dynamic programmingSegment tree+2 | No attempts yet | 3s | 256 MB | Judgeable |
| Pyramid Base 2Find the largest axis-aligned square that fits on the grid so the total cost of removing the obstacles it overlaps stays within budget. | Medium7 | Binary searchSegment tree+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Shortest Complete SubarrayProcess point updates on an array and report the length of the shortest contiguous subarray containing every value from 1 to K, or -1 if none exists. | Medium7 | Segment treeSliding window+1 | No attempts yet | 3s | 512 MB | Judgeable |
| Watermelons of the Field of WondersGiven N lines W0 + S*K, report the line with the largest value at each of M query days, breaking ties by smallest index. | Medium7 | Segment treeSorting+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Weighing the stonesAfter each ranked stone is placed on pan 1 or pan 2, report whether pan 1 is heavier under every valid weight assignment, pan 2 is, or neither is certain. | Medium7 | Segment treeGreedy+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Monkey and Apple TreesCount ripe trees in each visited interval while other events ripen whole intervals, with every interval shifted by the previous count. | Medium7 | Segment treeIntervals | No attempts yet | 2s | 256 MB | Judgeable |
| Gold Camp ForcefieldChoose a contiguous group of camps whose total energy covers the distance between its ends to maximize total gold. | Medium7 | Segment treePrefix sum+1 | No attempts yet | 1s | 256 MB | Judgeable |
| K blocksSplit the array into exactly K contiguous blocks so the sum of each block's maximum is as small as possible. | Medium7 | Dynamic programmingStack+1 | No attempts yet | 1s | 256 MB | Judgeable |
| PinballThe program installs the cheapest set of row devices so every falling ball lands in one bottom cell. | Medium7 | Dynamic programmingSegment tree | No attempts yet | 1s | 512 MB | Judgeable |
| Cubic ArtGiven a cube state and a move sequence, apply point updates that replace one move and print the resulting cube state after each update. | Medium7 | Segment treeSimulation+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Range XORMaintain an array under range xor updates and range xor queries, both on subarrays given by index bounds. | Medium7 | Bit manipulationSegment tree+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Reading the stone slabAfter each range replacement on a string, count the number of subsequences equal to a given name of length at most 5, modulo 1e9+7. | Medium7 | Dynamic programmingSegment tree+1 | No attempts yet | 4s | 256 MB | Judgeable |
| First black vertex on a pathFlip vertex colors and, along the root-to-v path, report the first black vertex encountered from the root. | Medium7 | TreeSegment tree+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Maximum weight in a monochromatic componentOn a colored tree, handle color flips, weight updates, and queries for the maximum weight in the monochromatic component containing a vertex. | Medium7 | TreeSegment tree+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Increasing subsequences of length KCount length-K index subsequences whose values are strictly increasing, modulo 5,000,000. | Medium7 | Dynamic programmingSegment tree+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Man, Elephant, and RatMaintain a line of players cycling through three signs; range updates advance each player to the next sign, and range queries report counts of each sign. | Medium7 | Segment treeLinked list+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Performance ReviewFor each employee, sum t_j over all descendants j whose rank r_j is lower than the employee's rank. | Medium7 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Promotion CountingFor each node of a rooted tree, count descendants whose value is larger than the node's own value. | Medium7 | TreeDFS+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Venue Rental (Large)Given up to 3000 axis-aligned rectangles, find the total area of their union, counting overlaps once. | Medium7 | GeometrySorting+2 | No attempts yet | 5s | 256 MB | Judgeable |
| Grandpa's QuestionProcess a stream of child-getting-off statements and queries asking for the smallest-numbered child at least B who rode at most Y stops so far. | Medium7 | Segment treeBinary search+1 | No attempts yet | 1s | 64 MB | Judgeable |
| Fundraising DinnerChoose a subset of people with beauty, fortune, and donation so that no two conflict, and the total donation is maximized. | Medium7 | Dynamic programmingSorting+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Bake OffEach customer in line gets the most delicious remaining cake containing all six requested flavours, or nothing if none exists. | Medium7 | Bit manipulationImplementation+2 | No attempts yet | 8s | 512 MB | Judgeable |
| Escape RoomGiven the longest increasing subsequence length starting at each position, find the lexicographically smallest permutation of 1..N matching these values. | Medium7 | GreedySegment tree+1 | No attempts yet | 1s | 64 MB | Judgeable |
| Paul the barista picks coffee beansPick the longest subsequence of the given row so that consecutive picked values are congruent mod k or differ by at most d in absolute value. | Medium7 | Dynamic programmingSegment tree+2 | No attempts yet | 1.5s | 64 MB | Judgeable |
| Yonsei Water ParkGiven N stones in a line with values K_i, pick a starting stone and a sequence of distinct stones where each jump moves at most D positions, maximizing the sum of visited values. | Medium7 | Dynamic programmingSegment tree+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Calculate! 2On a rooted tree, handle subtree XOR queries and subtree XOR updates, printing the XOR of a vertex and its descendants. | Medium7 | TreeSegment tree+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Junha's Number Theory Assignment (Divmaster)Process Q operations on N natural numbers: replace a range with each value's divisor count, or print a range sum. Skip settled ranges using the fast convergence of divisor counts. | Medium7 | Segment treeMath+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Tree and GahuiIn a heap-indexed complete binary tree, answer subtree-size queries and subtree-removal queries as nodes get deleted over time. | Medium7 | TreeSegment tree+2 | No attempts yet | 1.5s | 512 MB | Judgeable |
| Points and RectanglesProcess point insertions and rectangle insertions online, after each query reporting how many (point, rectangle) pairs have the point inside or on the rectangle. | Medium7 | Segment treePrefix sum+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sterilizing SprayMaintain an array under point assignments and range operations that replace each value y by floor(y/K), answering range-sum queries; K is at most 10. | Medium7 | Segment treeArray+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Raider Choragi and Queries (Easy)Zones form a cycle; a squad covers one or two adjacent zones holding at most W prisoners. After each point update report the minimum number of squads covering all zones. | Medium7 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Flag DanceMaintain an array under point updates and answer range queries for the absolute difference between sums of charismas at even and odd positions within the range. | Medium7 | Segment treePrefix sum+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sequence and Queries 1.5Maintain an array under point updates and answer range queries counting how many elements in a subarray exceed k. | Medium7 | Segment treeSorting+2 | No attempts yet | 1.5s | 512 MB | Judgeable |
| Longest Increasing Subsequence 6For a sequence of up to one million integers, report the length of the longest strictly increasing subsequence and the number of such subsequences modulo 1e9+7. | Medium7 | Dynamic programmingBinary search+2 | No attempts yet | 2s | 512 MB | Judgeable |
| KoalaGiven houses on a line, a max jump length, and stamina costs, find the maximum stamina on arrival when each tutor house can be used once. | Medium7 | Dynamic programmingGreedy+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Gameworld TornadoGiven up to 100000 axis-aligned rectangles, find the total area of their union. | Medium7 | GeometrySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| WinteringMaintain acorn counts on a circular walkway split into contiguous regions, supporting range additions and range sum queries over possibly wrapping cell intervals. | Medium7 | Segment treePrefix sum+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Stacking horizontal blocksDrop N horizontal blocks one by one at fixed positions, each landing on the tallest surface below it, and report the final stack height. | Medium7 | Segment treeBinary search+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Company Culture 5A supervisor tree supports turning all subordinates of a worker on or off, and counting how many subordinates of a worker are currently on. Initially only the computer of node 1 is on. | Medium7 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Christmas TreeMaintain a dynamic set of colored nodes in a rooted tree under insertions and deletions, and after each update report the lowest common ancestor of all colored nodes. | Medium7 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Random GeneratorSimulate repeatedly picking the p-th remaining copy from a multiset where value i appears w_i times, and output the order in which values are exhausted. | Medium7 | Segment treeBinary search+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| 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. | Hard8 | GreedySegment tree+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Feeding the PandaFind the longest sequence of bamboo groves with strictly increasing tastiness where consecutive Manhattan distance stays within the destination's bamboo count. | Hard8 | Dynamic programmingGeometry+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Perimeter of a Rectangle UnionCompute the total outer perimeter of the union of up to 5000 axis-aligned rectangles using a sweep-line approach. | Hard8 | SortingGeometry+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Microbiology LabChoose the minimum number of distinct integer temperature points so every microbe's interval contains at least C[i] chosen points. | Hard8 | GreedySegment tree+2 | No attempts yet | 2s | 128 MB | Judgeable |
| World-Famous Oil MagnateMaintain tree heights under two operations, fertilize the C smallest trees whose height is at least H by raising each by 1, and answer range count queries, efficiently. | Hard8 | Segment treeBinary search+1 | No attempts yet | 1s | 128 MB | Judgeable |
| 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. | Hard8 | Segment treeIntervals+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Dynamic Sequence Data StructureDesign a data structure supporting range assignment, range arithmetic-progression addition, mid-sequence insertion, and range-sum queries efficiently. | Hard8 | Segment treeArray+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Mysterious ObjectSupport range updates that overwrite box X in [L,R] with ((X-L+1)*A) mod B, and answer range-sum queries over up to 10^9 boxes with 50000 operations. | Hard8 | Segment treeMath+1 | No attempts yet | 8s | 128 MB | Judgeable |
| Antarctic ExpeditionProcess bridge, penguin-update, and route-sum queries on an incrementally connected forest, requiring dynamic connectivity checks and path-sum queries under updates. | Hard8 | Union-findTree+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Frog PrincessSimulate a frog jumping to the nearest plant along diagonal directions, removing the departed plant each time, over up to 100,000 moves and plants. | Hard8 | Segment treeSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Wangnuni the FrogFind the path from leaf 1 to leaf N using only rightward or upward axis-aligned jumps costing K power each, that maximizes leftover power after eating flies along the way. | Hard8 | Dynamic programmingSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Rectangles in Three DimensionsGiven N axis-aligned rectangles in 3D each parallel to one coordinate plane, count pairs of rectangles that intersect in at least one point. | Hard8 | GeometrySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Study Leader HongjunMaintain a dynamic set of (A,B) student pairs supporting insertion and queries for the student with minimal B difference (tie-broken by minimal A difference) among those with B >= B_i and A > A_i or (B=B_i and A>A_i). | Hard8 | Segment treeBinary search+1 | No attempts yet | 3s | 128 MB | Judgeable |
| 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. | Hard8 | Segment treeIntervals+2 | No attempts yet | 1s | 128 MB | Judgeable |
| FlowersFor each flower, find the rectangle formed by nearest boundary hits in four directions and count strictly interior flowers, using offline sweeps and range structures. | Hard8 | SortingSegment tree+1 | No attempts yet | 1s | 128 MB | Judgeable |
| AntsGiven a forest of towns formed by persistent range-add copies of parent towns, answer range-sum queries on each newly created version using online, XOR-derived parameters that depend on previous answers. | Hard8 | Segment treePrefix sum+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Horizontally Visible SegmentsGiven disjoint vertical segments, count triangles formed by triples that are pairwise horizontally visible using a sweep and visibility structure. | Hard8 | SortingGeometry+1 | No attempts yet | 1s | 128 MB | Judgeable |
| FlightsFor each query, find the maximum altitude among a subset of parabolic missile trajectories (indexed by launch time) restricted to a horizontal range, and output the exact reduced fraction. | Hard8 | GeometrySegment tree+2 | No attempts yet | 3s | 1024 MB | Judgeable |
| MountainsMaintain a piecewise-constant sequence of elevation changes under range assignments, and after each update find the first prefix-sum position whose elevation exceeds a query height h. | Hard8 | Segment treeBinary search+2 | No attempts yet | 3s | 256 MB | Judgeable |
| Area and Perimeter of a Union of RectanglesGiven up to 10000 axis-parallel rectangles on an integer grid, compute the area of their union (and its perimeter when r=2), counting overlaps once. | Hard8 | Segment treeSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Jousting TournamentGiven the starting order of N-1 knights and C fixed round intervals, find the smallest insertion position for a late knight with skill R that maximizes the number of rounds it wins. | Hard8 | ArraySimulation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| ElephantsAfter each of M moves that relocate one elephant, report the minimum number of length-L segments needed to cover all current positions. | Hard8 | Segment treeDynamic programming+2 | No attempts yet | 12s | 256 MB | Judgeable |
| Route DesignGiven two banks of valued sites and a set of non-crossing routes, find the maximum total value of a tour that alternates between banks without intersecting routes. | Hard8 | Dynamic programmingSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Farm ManagementA tree of N farms gets path updates that add 1 to every edge on a path, plus path queries that sum edge values on a path; process M operations online. | Hard8 | TreeSegment tree+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Barn AllocationGiven stall capacities and interval requests, find the maximum number of requests that can be granted without any stall exceeding its capacity. | Hard8 | GreedySegment tree+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Safe TravelFor each pasture i, find the shortest path from pasture 1 to i that avoids the last edge of the unique shortest path to i. | Hard8 | GraphShortest path+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Holiday PaintingPaint rectangle updates on an R x C grid, R up to 50000 and C up to 15, and after each of Q updates report how many cells equal a fixed target pattern. | Hard8 | Segment treeBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| HotelProcess check-in and check-out requests on a row of hotel rooms, always assigning the leftmost block of the requested length, or 0 if none fits. | Hard8 | Segment treeDivide and conquer+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Frequent ValuesFor each range query on a sorted array, output how many times the most frequent value occurs inside the range. | Hard8 | Segment treeDivide and conquer+1 | No attempts yet | 1s | 128 MB | Judgeable |
| The K-th NumberGiven an array of distinct integers and m range queries, return the k-th smallest value inside each queried subarray. | Hard8 | Binary searchDivide and conquer+2 | No attempts yet | 1s | 256 MB | Judgeable |
| PlatformsGiven points with distinct x, find the longest chain of flights where each next point has larger x and no larger y, then report every point lying on some longest chain. | Hard8 | Dynamic programmingSorting+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Box ArtGiven a bounding box and up to 2000 axis-aligned boxes, compute the volume of their union clipped to the bounding box. | Hard8 | GeometrySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| RectanglesGiven N axis-aligned rectangles, compute the area of their union. | Hard8 | Segment treeSorting+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Rectangles Too!Find the longest chain of rectangles where each rectangle lies strictly below and to the left of the next one. | Hard8 | SortingDynamic programming+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Union Area of TrianglesGiven right isosceles triangles with axis-parallel legs and hypotenuse of slope -1, compute the area of their union. | Hard8 | GeometrySegment tree+2 | No attempts yet | 1s | 32 MB | Judgeable |
| Log AnalysisMaintain a volatile log under insertions in the middle, block deletions, and queries asking how many distinct event types appear in a position range. | Hard8 | ArraySegment tree+2 | No attempts yet | 2s | 256 MB | Judgeable |