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 results288 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| 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 |
| CarpetFind the area of the largest subrectangle of a flawed carpet grid that holds at most one flaw. | Medium7 | StackPrefix sum+1 | No attempts yet | 4s | 256 MB | Judgeable |
| XH CompanyFor each query day D, report the length of the shortest suffix ending on day D-1 with the largest average. | Medium7 | StackPrefix sum+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Stack Copying GameMaintain up to 300,000 persistent stack versions built by push, pop, or copy, and answer popped values and common-element counts for pairs of versions. | Medium7 | TreeStack | No attempts yet | 1s | 64 MB | Judgeable |
| NEOFind the largest submatrix with at least two rows and columns in which every submatrix meets the corner-sum inequality. | Medium7 | MatrixStack+1 | No attempts yet | 1s | 256 MB | Judgeable |
| CensoringRepeatedly delete the leftmost occurrence of any of N forbidden words from string S until none remains and print the result. | Medium7 | String matchingStack+1 | No attempts yet | 1s | 256 MB | Judgeable |
| SolitaireGiven the starting deck order, compute the fewest redeals needed to move every card to the goal pile using the helper as ordered storage. | Medium7 | SimulationGreedy+1 | No attempts yet | 2s | 256 MB | Judgeable |
| SunlightCompute sunlight hours for each rooftop from the sky angles blocked by taller buildings on both sides. | Medium7 | StackGeometry+1 | No attempts yet | 4s | 256 MB | Judgeable |
| Luxury burrowFind the rectangle of area at least K whose minimum cell price is largest, breaking ties by larger area. | Medium7 | Binary searchStack+1 | No attempts yet | 2s | 64 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 |
| Walking in JOI KingdomN walkers start at given points and move east or west at speed 1, stopping when they meet anyone, and the task asks the positions of Q of them at time T. | Medium7 | StackSimulation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Ticket Swapping (Small)Given rider groups traveling between stations on one line, compute the largest fare loss from riders swapping entry cards, modulo 1000002013. | Medium7 | GreedyStack+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Letter Stamper (Small)Print a given string of A, B and C with push, pop and print on a letter stack using the fewest operations. | Medium7 | Dynamic programmingStack | No attempts yet | 5s | 512 MB | Judgeable |
| Letter Stamper (Large)Find the fewest stack pushes, pops, and prints needed to print each target string of A, B, and C grades in order. | Medium7 | Dynamic programmingStack | No attempts yet | 15s | 512 MB | Judgeable |
| MarblesPairs of matching colors sit on a line; join each pair with a non-crossing path above y=0 and minimize the total height. | Medium7 | StackGreedy | No attempts yet | 5s | 512 MB | Judgeable |
| Jolly Jelly JiffyCount and lexicographically minimize total orders consistent with the final box state of an insertion-sort-like stacking process and one extra value. | Medium7 | StackTopological sort+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Bracket MatchGiven a lowercase string S, find the lexicographically smallest matching bracket sequence, or print -1 if none exists. | Medium7 | StackGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Interleaved Output: Part 1Given a string over I, O, i, o, find the maximum number of times the event IO could have been printed. | Medium7 | GreedyStack+1 | No attempts yet | 20s | 1024 MB | Judgeable |
| Modern Art 2Given a 1D painting, decide whether it can be built by layering one interval per color, and if so find the minimum number of Moonet's disjoint-interval rounds. | Medium7 | StackGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Stack ConstructionFor each message, compute the minimum number of stack push, pop, and print operations needed to print it and leave the stack empty. | Medium7 | Dynamic programmingString+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Cutting the curveGiven a simple orthogonal polygon with edges crossing the x axis, count peaks minimal under containment and peaks maximal under containment. | Medium7 | StackGeometry+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Mixing CoinsGroups of equal coins are merged three at a time when three consecutive same-material coins appear, and the survivor count is requested. | Medium7 | SimulationStack+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Global WarmingFind the longest subarray whose minimum value and maximum value each occur exactly once, and report its length and earliest start. | Medium7 | Two pointersStack+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Line-upCount for each soldier, looking left or right, how many nearer soldiers are visible past blocking heights. | Medium7 | StackDivide and conquer+1 | No attempts yet | 2s | 512 MB | Judgeable |
| DefileMaintain minion healths under insert and delete, and after each update report how many would die in repeated 1-damage waves. | Medium7 | MathNumber theory+2 | No attempts yet | 3s | 1024 MB | Judgeable |
| StrahFor an N by M grid of '.' and '#', find the sum over all '.' cells of the number of all-'.' subrectangles containing it. | Medium7 | StackCombinatorics+2 | No attempts yet | 1s | 256 MB | Judgeable |
| DriveGiven D, tank capacity C, consumption E, and stations with distances and prices, find the cheapest way to reach distance D starting with a full tank, or report -1. | Medium7 | GreedyStack+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Mount MarathonGiven up to 52 piles of one card each, repeatedly move a single-card pile onto the pile just to its right if its value is at least the right pile's top card. Find the minimum final number of piles. | Medium7 | ArrayStack+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Buying Cards 3Sum, over all contiguous subarrays, of (maximum minus minimum) in the subarray. | Medium7 | StackArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Disrupting DefenseFind a sequence of n/2 attacks removing adjacent differently valued soldiers from a circular ring until all are gone, or report impossible. | Medium7 | GreedyStack+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Bad Hair Day and Expected ValueGiven N cows with heights, count the expected number of visible pairs over all N! orderings, modulo 1e9+7. | Medium7 | CombinatoricsMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Parentheses EditorAfter each push of '(' or ')' or one backspace, print the number of balanced substrings in the current text. | Medium7 | StackDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| PilotFor each of Q altitude limits, count subarrays of heights whose maximum is at most that limit. | Medium7 | StackSorting+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Visible Mountain RangeCompute the total visible area of overlapping isosceles triangular mountains that share a common baseline, given up to 100,000 triangles. | Hard8 | GeometrySorting+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Programming Language LSimulate execution of a custom esoteric language with nested loops and conditional jumps to find the maximum number of printed line executions, capping at infinity beyond 1e9. | Hard8 | SimulationDynamic programming+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Stack Truck DriverCount length-bounded walks from city 1 to city N in a graph where edges push or pop letters on a stack, with pops requiring a matching top element. | Hard8 | Dynamic programmingStack+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Hongjun and the FenceGiven fence plank heights, find the minimum leftover area after optimally applying width-X roller strokes (each painting up to the min height of X consecutive planks) and the minimum number of strokes achieving that area. | Hard8 | StackDivide and conquer+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Periodic TableCount ways to place K non-attacking pieces on a histogram-shaped grid where two cells in the same row are close only if all columns between them reach that row, modulo 1e9+7. | Hard8 | Dynamic programmingStack+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Balanced Bracket SegmentMaintain a dynamic string under prefix/suffix bracket insertions and after each insertion report the shortest valid contiguous bracket substring covering the new character. | Hard8 | StackString matching+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Stack MachineFor each pair of intersections, find the shortest route whose sequence of board and leave events forms a balanced stack (empty at start and end). | Hard8 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| VectorsParse and evaluate a small language over scalars and 3D vectors, including mixed operators and bracket styles that can close several open groups at once. | Hard8 | ImplementationRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| EmpodiaGiven a permutation biosequence, find every minimal framed interval: a segment whose endpoints are its min and max and that contains no shorter framed interval. | Hard8 | StackArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Crayfish ScrivenerProcess type and undo commands, including nested undos, and answer queries for the character at a given position. | Hard8 | StackTree+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Artificial LakeWater fills a terrain of N distinct-height platforms at 1 unit per minute; report when each platform first has 1 unit of water above it. | Hard8 | StackSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Fixing DisksGiven a master stack and your own stack of N labeled disks, use three limited reorder moves on the top K disks to remove disks cheaply; minimize total cost under a removal-order constraint. | Hard8 | Dynamic programmingStack+2 | No attempts yet | 2s | 512 MB | Judgeable |
| ChandelierGiven a valid stack program that builds a chandelier, find the minimum stack capacity needed to build an identical chandelier, where ring children may be rotated cyclically. | Hard8 | StackGreedy | No attempts yet | 2s | 128 MB | Judgeable |
| Identity CheckerEach test case gives a reverse Polish expression in x with sin, cos, and tan; decide whether it equals zero wherever defined. | Hard8 | MathString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Tetris AttackA stack holds each of n symbols twice; adjacent equal pairs vanish on contact, and one move swaps neighboring elements. Find the minimum swaps to empty the stack. | Hard8 | GreedyStack+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Untamed TreeThe task is to output for each leaf label the compressed subtree of its leaves and branching ancestors in preorder. | Hard8 | TreeSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Heavy BlocksTopple n distinct-weight blocks with the fewest pushes when each push fells lighter neighbors in one direction until a heavier block or gap. | Hard8 | Dynamic programmingStack+2 | No attempts yet | 1s | 128 MB | Judgeable |
| String TransformationFind the fewest adjacent swaps turning one balanced a/b string into another with every intermediate string balanced, or output -1 if impossible. | Hard8 | TreeStack+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Mountainous landscapeFor each segment of a left-to-right polygonal chain, find the nearest later segment with a point strictly above the ray extending the segment. | Hard8 | GeometryStack | No attempts yet | 10s | 256 MB | Judgeable |
| Norma's array price sumSum min times max times length over all contiguous subarrays and print the result modulo 1000000000. | Hard8 | Divide and conquerStack | No attempts yet | 3s | 64 MB | Judgeable |
| Stack MazeYou move only right or down through the grid, pick up lettered jewels, and drop them into matching holes in last-in-first-out order for the most matches. | Hard8 | Dynamic programmingStack+1 | No attempts yet | 8s | 256 MB | Judgeable |
| EditorGiven up to 500000 edits and leveled undos, print the editor state after each operation. | Hard8 | StackSegment tree+1 | No attempts yet | 3s | 512 MB | Judgeable |
| Greenhouse GrowthGiven n sunflower heights and an m-day schedule of left or right lamps, compute every height after daily growth toward the taller neighbor. | Hard8 | Segment treeStack+2 | No attempts yet | 6s | 512 MB | Judgeable |
| Connecting the wiresPlace each equal-number pair above or below a row so same-side joining arcs never cross, and print the lexicographically smallest side string. | Hard8 | GraphDFS+2 | No attempts yet | 1s | 64 MB | Judgeable |
| Memory CellBuild the expression tree, find the largest pair of disjoint identical subtrees, and print the loser's postfix in lexicographic order. | Hard8 | StackTree+2 | No attempts yet | 1s | 512 MB | Judgeable |
| What NextGiven a prefix of an NZPC Speak program cut at an arbitrary point, list the symbols that can legally come next, respecting declarations, masking, and partial names. | Hard8 | ImplementationSimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Broadcast Tower OffersFor each offered tower height, find the best position along a row of buildings and report how many buildings to its west can receive its westward signal. | Hard8 | StackSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Visual Python++Match n top-left corners to n bottom-right corners so the rectangles form properly nested or disjoint blocks, or report a syntax error. | Hard8 | SortingStack+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Buffalo BarricadesFor each settler arriving in order, count the buffalos inside the region bounded by rivers and fences whose upper right corner is the settler's post. | Hard8 | SortingPrefix sum+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Map of the Ninja HouseReconstruct the graph of a ninja house from the counter and door records produced by a fixed DFS exploration, handling back edges, skips, and multi-edges. | Hard8 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Rangers in the BusGiven each passenger's entry order and taken seat, determine which passengers could have been each of five rangers whose seat choice follows a fixed rule or a free choice. | Hard8 | SimulationGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| PanokseonSplit a sequence of n positive weights into groups with sum at most W to minimize the maximum of (W minus group sum) squared. | Hard8 | GreedyBinary search+2 | No attempts yet | 1s | 512 MB | Judgeable |
| ParenthesesClassify a C arithmetic expression as error, proper, or improper depending on validity and the minimality of its parentheses. | Hard8 | StackRecursion+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Circular DNAGiven a circular sequence of start and end markers for many gene types, choose a cut position that maximizes how many gene types have their markers properly nested in the resulting linear subsequence. | Hard8 | ArrayStack+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Pairing SocksGiven a sequence of 2n socks, find the minimum number of moves to pair all socks using two stacks with three allowed operations, or report impossible. | Hard8 | StackGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Hero's HistogramGiven a histogram of n columns, for every prefix of the first j columns report the largest axis-aligned rectangle that fits inside that prefix. | Hard8 | StackPrefix sum+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Rock-Scissors-Paper ExpressionCount the assignments of R, S, P to the ? symbols in a fixed arithmetic expression, under rock-scissors-paper defined operators, so that evaluation gives A. | Hard8 | Dynamic programmingDivide and conquer+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Balanced SequenceReorder n bracket strings to maximize the length of the longest balanced subsequence of their concatenation. | Hard8 | GreedySorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Fancy FenceCount axis-aligned integer rectangles lying on a histogram of N sections with heights h_i and widths w_i, modulo 1e9+7. | Hard8 | StackDivide and conquer+2 | No attempts yet | 1s | 32 MB | Judgeable |
| Counting in the OrderEach soldier looks left or right and sees past people no taller than the target; count how many soldiers each one sees. | Hard8 | StackArray+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Equal MaximumsCount quadruples of indices i<=j<k<=l where the maximum of a[i..j] equals the maximum of a[k..l], modulo 1e9+7, for n up to 100000. | Hard8 | ArrayStack+2 | No attempts yet | 1s | 512 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 |
| 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 |
| Brainf**k InterpreterDecide whether a given Brainfuck program halts on its input and, if it loops, report the matching bracket pair that encloses the infinite loop. | Hard9 | SimulationImplementation+2 | No attempts yet | 7s | 128 MB | Judgeable |
| PurifyRepeatedly delete forbidden substrings from P, always choosing the earliest-ending occurrence and removing the shortest such forbidden word, then print what remains. | Hard9 | StringTrie+2 | No attempts yet | 1s | 64 MB | Judgeable |
| Minimum bracketsGiven an arithmetic template with holes, delete as many brackets as possible while keeping the same value for every valid assignment of real numbers to the holes. | Hard9 | StringImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Aquarium 3Place K holes on distinct horizontal floor segments to maximize the area of water that drains out. | Hard9 | TreeGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Believer in I 2Over every ordering of A push, B add, and C multiply cards on an infinite stack of I, report the total of each of the top K stack values modulo 1,000,000,007. | Hard9 | CombinatoricsDynamic programming+2 | No attempts yet | 3s | 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 |
| Bracket SubstringsCount how many distinct balanced bracket sequences appear as non-empty substrings of a given bracket string of length up to 500,000. | Hard9 | StringHash map+2 | 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 |
| GameChoose the order in which balls are manually removed so chain reactions of merging equal neighbors delete as many other balls as possible; output that maximum count. | Hard9 | Dynamic programmingStack+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Gahui's Sequence Mod Play (Large)Maintain a stack under push and pop, and after each type 3 query report the shortest suffix whose remainders mod m cover every residue from 0 to m-1, printing -1 if impossible. | Hard9 | StackTwo pointers+2 | No attempts yet | 1s | 256 MB | Judgeable |
| GnalcatsDecide whether two genes, each a sequence of seven possible base transformations on proteins, produce identical results or both fail on every sufficiently long input protein. | Hard9 | StringStack+2 | No attempts yet | 0.3s | 512 MB | Judgeable |
| Holy cow, Vim! (Hard)Construct a stack-program whose lines, read normally, reversed, and lexicographically sorted, compute x, x squared, and negative x respectively. | Hard9 | ImplementationStack+2 | No attempts yet | 1s | 512 MB | Judgeable |