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 |
|---|---|---|---|---|---|---|
| MatryoshkaFor each query (A, B), take the dolls with R >= A and H <= B and find the minimum number of chains needed to store them all nested, i.e. the size of the largest antichain under the containment partial order. | Hard8 | SortingDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| ScarecrowsCount pairs of scarecrows that can be the SW and NE corners of an axis-aligned rectangle whose interior contains no other scarecrow. | Hard8 | SortingDivide and conquer+1 | No attempts yet | 4s | 512 MB | Judgeable |
| 3D Points and QueriesCount points inside axis-aligned 3D boxes, where each query's box coordinates are decoded by XOR with the running sum of previous answers. | Hard8 | Segment treeSorting+2 | No attempts yet | 7s | 1024 MB | Judgeable |
| Computer CacheMaintain a mutable byte array over m pieces, support range increments modulo 256 on a piece, cache loads of whole pieces into fixed cache positions, and point queries of cache bytes. | Hard8 | Segment treeArray+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Cut Inequality DownFor many range queries [B,E] and starting wealth X, simulate monthly income with wealth clamped into [L,U] after each month and report the final wealth. | Hard8 | Segment treeImplementation+2 | No attempts yet | 0.7s | 512 MB | Judgeable |
| Shortest Paths and QueriesGiven a grid with up to 5 rows and 100,000 columns, answer queries for the minimum-weight monotone-free path between two cells. | Hard8 | Dynamic programmingMatrix+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Black DebtContestants get point increases over time; after each update, report the total count of (yellow, black) pairs where the black contestant has strictly more points. | Hard8 | Segment treeBinary search+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Movie-goerChoose a contiguous block of days maximizing the sum of weights of movies that appear exactly once in the block. | Hard8 | ArrayTwo pointers+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Bad DoctorEach doctor prescribes a set of medicines over a day interval; ignoring one doctor, compute the total cost of distinct medicines needed per day summed over all days. | Hard8 | Segment treeSorting+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Glad You CameApply m range-max updates (a_j = max(a_j, v_i)) to a zero array, where each l, r, v comes from a fixed 32-bit RNG, then output the XOR of i*a_i. | Hard8 | Segment treeImplementation+2 | No attempts yet | 4s | 512 MB | Judgeable |
| Snowy SmileGiven up to 2000 weighted points, find an axis-aligned rectangle maximizing the sum of weights of points inside or on its border, allowing an empty rectangle for zero. | Hard8 | Dynamic programmingSorting+2 | No attempts yet | 3s | 512 MB | Judgeable |
| AlakazamGiven an array and range shuffle operations that permute a segment uniformly at random, answer point queries for the expected value at a position. | Hard8 | MathProbability+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Crazy LCPGiven N strings and Q range queries, for each range [L, R] report the maximum longest common prefix over all pairs of distinct strings in that range. | Hard8 | StringTrie+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Non-Decreasing Subarray GameFor each query range, Yuto picks an integer to minimize and Platina then picks one to maximize the count of non-decreasing subarrays inside the interval they bound; output the resulting score. | Hard8 | Game theoryDynamic programming+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Nutella's LifeChoose a subsequence of contests with nondecreasing values, where skipping x contests in a row costs x+1 each, to maximize total fun. | Hard8 | Dynamic programmingSegment tree+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Biggest NumberAfter each of Q point updates to the digits on N cards, report the largest base-D number obtainable by rearranging the cards, modulo 1e9+7. | Hard8 | Segment treeSorting+2 | No attempts yet | 0.5s | 256 MB | Judgeable |
| Addition RobotMaintain a binary string under range flips and answer queries that apply the range's A/B operations to a pair of numbers, modulo 1e9+7. | Hard8 | Segment treeMatrix+2 | No attempts yet | 3s | 512 MB | Judgeable |
| ADD, DIV, MAXMaintain an array under range add, range floor-divide, and range maximum queries, with N and Q up to 200000. | Hard8 | Segment treeLinked list+2 | No attempts yet | 5s | 256 MB | Judgeable |
| Hacker Cups and BallsGiven a permutation and range sort operations that go ascending or descending depending on whether l < r, find the value in the middle cup at the end. | Hard8 | Binary searchSegment tree+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Array and OperationsMaintain an array under range add, range floor-square-root, and range sum queries, printing each sum. | Hard8 | Segment treeBinary search+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Urban BlightGiven points and weighted segments, find a horizontal line whose intersection with the segments maximizes the total weight of segments it touches. | Hard8 | GeometrySorting+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| Heavy BurgerMaintain a string of parentheses under range flips, and for each query on a substring report the minimum number of characters to insert so the substring becomes a balanced parenthesis sequence. | Hard8 | Segment treeString matching+2 | No attempts yet | 3s | 1024 MB | Judgeable |
| Admiral Yi Sun-sinMaintain a dynamic graph of national roads (union-find) and acyclic expressways (link-cut style tree), updating region comfort values tied to region 1's component and answering path/sum queries online. | Hard9 | Union-findTree+2 | No attempts yet | 1.216s | 512 MB | Judgeable |
| Wake Up!Count the distinct points where any two of up to 20,000 line segments intersect, using an efficient computational geometry sweep. | Hard9 | GeometryDivide and conquer+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ShotGiven columns of black/gray/white cans stacked in fixed color order, repeatedly shoot a height to remove one layer from every tall-enough column and report the collapsing score after each shot. | Hard9 | Segment treeBinary search+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Hyeonju's Pizza ShopGiven jobs with desired completion times and processing times on a single machine, compute the maximum total tip (sum of signed lateness against desired times) after each of many update operations that change a job's parameters, requiring an efficient dynamic scheduling data structure. | Hard9 | GreedySegment tree+1 | No attempts yet | 2s | 128 MB | Judgeable |
| FPSGiven N players and Q candidate additions, count ways to pick K bots with distinct speeds/ranges each dominated by some human, modulo 10009. | Hard9 | CombinatoricsMath+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Standard ProblemGiven a 0/1 grid, answer up to a million offline queries for the largest all-zero rectangle confined to a specified row range. | Hard9 | Segment treeDivide and conquer+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Hanging HatsSimulate mages hanging triangular hats on a wall, tracking nail visibility and expulsion under coverage rules that require an advanced geometric data structure. | Hard9 | GeometrySegment tree+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Cow HopscotchChoose an outbound path of jumps (each at most K squares) and a return path that only lands on squares one less than an outbound square, maximizing collected values. | Hard9 | Dynamic programmingSegment tree+2 | No attempts yet | 1s | 128 MB | Judgeable |
| A Romantic Movie OutingMaintain a dynamic set of occupied seats across a huge theatre, answer queries for the combined field-of-vision inconvenience of two seats, and at the end find the minimum over far unoccupied seat pairs. | Hard9 | Segment treeDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Move that Mouse AGAINGiven up to 50,000 axis-aligned rectangles in a fixed bottom-to-top stacking order, process 50,000 point clicks, printing the topmost window at each point and moving it to the top of the stack. | Hard9 | Segment treeGeometry+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Longest Paths in a TreeA rooted tree has weighted edges. Handle point updates to edge weights and queries that ask for the maximum-weight downward path from a vertex inside its subtree. | Hard9 | TreeSegment tree+2 | No attempts yet | 5s | 1024 MB | Judgeable |
| Falling BallsGiven slanted platforms whose endpoints move over time, find the final x-coordinate reached by a ball dropped at a given x. | Hard9 | Segment treeTree+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| Bus TourChoose a sequence of attractions with strictly increasing construction times maximizing attractiveness collected plus Manhattan travel distance. | Hard9 | Dynamic programmingSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Ski RentalGiven daily snowfall amounts with point updates, answer queries asking for the maximum average snowfall over a consecutive run starting at a given day, reported as an irreducible fraction. | Hard9 | Segment treeGeometry+1 | No attempts yet | 1s | 128 MB | Judgeable |
| JourneysGiven m batches, each joining every town in one interval to every town in a disjoint interval, find the shortest path in highway count from town p to all towns. | Hard9 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| HighwaysMaintain a layered graph where each province has a few cities and highway lane counts change over time, answering route-count queries modulo d after each update. | Hard9 | MatrixSegment tree+1 | No attempts yet | 1s | 128 MB | Judgeable |
| PeaksFor each query, starting from a peak and using only edges up to a difficulty limit, report the k-th highest reachable peak height or -1. | Hard9 | GraphUnion-find+2 | No attempts yet | 2s | 128 MB | Judgeable |
| GenomeBuild the lexicographically smallest sequence that is l adjacent swaps from the first genome and k-l swaps from the second. | Hard9 | GreedySegment tree+1 | No attempts yet | 1s | 128 MB | Judgeable |
| WombatsFind the cheapest southbound path across a grid with free east-west moves and south-only vertical roads under weight updates and escape queries. | Hard9 | Segment treeShortest path+1 | No attempts yet | 20s | 256 MB | Judgeable |
| It Takes a VillageProcess online trading-post additions that spread through biconnected blocks and capital dominators, and answer revenue queries for single villages. | Hard9 | GraphDFS+2 | No attempts yet | 20s | 128 MB | Judgeable |
| CakeStarting from piece a, Leopold always eats the less delicious piece next to the empty interval, and each query asks how many pieces are eaten before piece b. | Hard9 | Segment treeDivide and conquer+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| Solar LampsCompute each lamp turn-on time from its place in the power-on order and the count of already lit lamps shining on it. | Hard9 | GeometrySegment tree+1 | No attempts yet | 1s | 256 MB | Judgeable |
| MuseumA burglar picks guards to bribe to maximize the value of exhibits no remaining guard sees minus bribe costs under downward cone views. | Hard9 | GraphGeometry+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Tile CuttingFor each query range, find the area with the largest count of inscribed parallelogram cuts and report that count, breaking ties by the smaller area. | Hard9 | Number theoryMath+1 | No attempts yet | 15s | 256 MB | Judgeable |
| Magical SubarraysEach query asks for the longest subarray inside [L,R] with every element between its first and last values. | Hard9 | Divide and conquerSegment tree+1 | No attempts yet | 4s | 128 MB | Judgeable |
| CircusFind the smallest starting hold depth on a temporary rope at D that reaches distance M by hopping between ropes within swing range. | Hard9 | Shortest pathSegment tree+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Covering postersFor each new axis-aligned rectangle, compute the total area of the given union of rectangles that it covers. | Hard9 | Segment treePrefix sum+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| Half-plane land grab 2Maintain a dynamic set of lines under insertions and deletions and answer maximum-at-x queries online. | Hard9 | Dynamic programmingDivide and conquer+2 | No attempts yet | 4s | 512 MB | Judgeable |
| Smallest Unpayable AmountFor each query interval, find the smallest positive amount that cannot be formed as a subset sum of the coins in that interval. | Hard9 | GreedySorting+2 | No attempts yet | 4s | 512 MB | Judgeable |
| ArrayStart with array a_i = i, apply up to 300000 queries that reverse or rotate subarrays and ask for range min, max, sum, value at index, or index of a value, then print the final array. | Hard9 | ArrayImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| PostersCompute the visible area of each of N rectangles pasted in order on the plane, where later rectangles cover earlier ones. | Hard9 | GeometryDivide and conquer+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Trees and Queries 10Given a tree with vertex weights, answer path maximum-subarray-sum queries and path range-assign-weight updates. | Hard9 | Segment treeTree+2 | No attempts yet | 2s | 512 MB | Judgeable |
| XOR QueriesMaintain an array under appends, rollbacks of the last k elements, and range queries for max XOR, count <= x, and k-th smallest. | Hard9 | TrieSegment tree+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sequence and Queries 0For each query range [i,j] of a ±1 sequence, report the length of the longest contiguous subarray inside it whose sum is 0, or 0 if none exists. | Hard9 | Segment treePrefix sum+2 | No attempts yet | 2.5s | 512 MB | Judgeable |
| Sequence and Queries 6For each query range [i, j], report the highest number of occurrences of any single value inside that range. | Hard9 | Segment treeDivide and conquer+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sequence and Queries 9For each query range [i,j] and value k, count ordered pairs (p,q) from that range with A[p]*B[q] <= k. | Hard9 | Divide and conquerSegment tree+2 | No attempts yet | 6s | 512 MB | Judgeable |
| Sequence and queries 12Maintain a dynamic sequence under point updates, deletions, and insertions, answering range queries for distinct count and the sum of triple products of distinct values. | Hard9 | Segment treeHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| HackerSimulate substring comparisons, substring copy from a fixed string, and range letter-increment operations on a mutable string of length N. | Hard9 | Segment treeHash map+2 | No attempts yet | 4s | 512 MB | Judgeable |
| Rides 2Each day one child grows by 1 or 2, and we must report how many of Q fixed child-pair and ride triples become valid that day. | Hard9 | Segment treeSorting+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Smallest unreachable subsequence sumFor each subarray, find the smallest non-negative integer that no subsequence sums to. | Hard9 | Segment treeGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Intrinsic IntervalFor each query range in a permutation, find the smallest subarray containing it whose values form a set of consecutive integers. | Hard9 | Segment treeStack+1 | No attempts yet | 3s | 512 MB | Judgeable |
| GarageMaintain a sequence under point updates, and for each range query count subarrays whose elements share a common divisor greater than 1. | Hard9 | Segment treeNumber theory+2 | No attempts yet | 4s | 256 MB | Judgeable |
| Imelda's Shopping SpreeMaintain a sequence of prices under range-add and range-reverse, and after each update output the number of contiguous segments whose values are strictly increasing. | Hard9 | Segment treeArray+2 | No attempts yet | 5s | 512 MB | Judgeable |
| GardenerMaintain N gardens under plantings, range deletions of plants taller than h, and range count queries, all with time-dependent growth. | Hard9 | Segment treeBinary search+2 | No attempts yet | 3s | 128 MB | Judgeable |
| New HomeStores of k types each occupy a point and an open year interval; for each (location, year) query, report the maximum over types of the distance to the nearest open store of that type, or -1 if some type is missing. | Hard9 | Segment treeBinary search+2 | No attempts yet | 5s | 1024 MB | Judgeable |
| International Cow Lineup Photo ContestGiven a 0/1 array and up to 1e5 adjacent swaps, after each swap report the longest subarray with equal numbers of 0s and 1s. | Hard9 | Segment treePrefix sum+2 | No attempts yet | 2s | 512 MB | Judgeable |
| mex and QueriesMaintain a set of natural numbers under range add, range remove, and range toggle queries, then output the mex after each of up to 100000 queries with values up to 1e18. | Hard9 | Segment treeIntervals+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Query and QueryEach query swaps two sequence values; after every swap, pair up the M left-pocket indices and M right-pocket indices to minimize the largest range maximum. Output that minimized maximum. | Hard9 | Segment treeGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Build a WorkbookMaintain a dynamic precedence relation among N problems under edge inserts and deletes, and answer whether the subgraph induced by problems x through y is acyclic. | Hard9 | GraphDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sequence and Queries 26Maintain a sequence under range chmin updates, range maximum queries, and range sum queries, with up to a million elements and queries. | Hard9 | Segment treeDynamic programming+2 | No attempts yet | 4s | 512 MB | Judgeable |
| Traveling MerchantGiven weekly price cycles at n towns, answer q queries for the max profit from buying and later selling during a trip from town s to town t. | Hard9 | Segment treeDivide and conquer+2 | No attempts yet | 10s | 1024 MB | Judgeable |
| HotelMaintain an array under point height updates; after each update answer queries for the longest subsegment inside [l, r] that contains no strict interior valley. | Hard9 | Segment treeArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Dynamic DiameterMaintain a weighted tree under edge weight updates and report the diameter after each of q updates, decoding each query with the previous answer. | Hard9 | TreeDivide and conquer+2 | No attempts yet | 5s | 512 MB | Judgeable |
| EmploymentGiven candidate evaluation values with point updates, answer queries asking for the number of maximal contiguous blocks of hired candidates whose value is at least a threshold. | Hard9 | Segment treeDivide and conquer+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Sequence and Queries 32Maintain a sequence under point updates and answer whether it can be split into contiguous blocks whose xors all lie in a small given set. | Hard9 | Dynamic programmingPrefix sum+2 | No attempts yet | 10s | 512 MB | Judgeable |
| Sequence and Queries 34Maintain two integer sequences under updates and range queries: for a suffix of a compute the longest match against b and how many suffixes achieve it, compare suffixes of b, and test whether a concatenation of two b-substrings is itself a substring of b. | Hard9 | String matchingSegment tree+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Colored Paper and QueriesGiven N axis-aligned rectangles and M axis-aligned query rectangles, report for each query the maximum number of input rectangles covering any single point inside it. | Hard9 | Segment treeDivide and conquer+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Seven NeversFor every window of k consecutive elements in a permutation, compute the LIS length after deleting that window. | Hard9 | Dynamic programmingSegment tree+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Make Rounddog HappyCount subarrays whose elements are all distinct and whose maximum minus length is at most k, for arrays up to 300,000 with values bounded by n. | Hard9 | Divide and conquerTwo pointers+2 | No attempts yet | 2s | 512 MB | Judgeable |
| OR and QueriesProcess range bitwise-OR updates on an array and count how many positions in a range currently equal a fixed K. | Hard9 | Segment treeBit manipulation+2 | No attempts yet | 1.5s | 256 MB | Judgeable |
| Deja VuMaintain an array under point updates and answer queries asking for the earliest position d that ends an increasing subsequence of length 4 starting at or after l. | Hard9 | Segment treeDynamic programming+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Dirt RatioChoose a contiguous subarray to minimize (number of distinct values)/(subarray length); print the minimum ratio. | Hard9 | Binary searchPrefix sum+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sequence and Queries 39Maintain an array under range updates that add an arithmetic progression, and answer queries for the longest arithmetic-progression subarray inside a range. | Hard9 | Segment treeMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| JumpGiven cities at integer grid points and portals that jump from one city to any city inside an axis-aligned rectangle at a given cost, find the shortest time from city 1 to every city. | Hard9 | Shortest pathGraph+2 | No attempts yet | 1s | 512 MB | Judgeable |
| AtomsMaintain a sequence of charges under range add updates, and after restricting to a query segment, report the longest run of consecutive positions where each next charge exceeds the previous by exactly one. | Hard9 | Segment treeDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Tree and Queries 20Maintain a dynamic forest with link/cut and weighted edges, supporting toggling a vertex weight and querying the minimum weighted sum of tree distances from any vertex, with encrypted vertex indices. | Hard10 | TreeSegment tree+1 | No attempts yet | 5s | 512 MB | Judgeable |