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 results52 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Recently Used DocumentsSimulate a most-recently-used list of capacity k: each opened document moves to the front, new ones are inserted there and the back is dropped when full, then print the final list. | Easy2 | SimulationImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| LRU CachingSimulate an LRU cache over a sequence of letter accesses and exclamation-mark print requests, outputting cache contents from least to most recently used. | Easy3 | Linked listHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Queue 2Implement a queue supporting push, pop, size, empty, front, and back, and run N commands, printing output for the query commands. | Easy3 | QueueImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Popping BalloonsSimulate popping balloons arranged in a circle, moving left or right by the value on each popped balloon among remaining balloons. | Medium4 | SimulationLinked list+1 | No attempts yet | 2s | 4 MB | Judgeable |
| Nearest Common AncestorGiven a rooted tree and two nodes, find their nearest common ancestor for each test case. | Medium4 | TreeDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Army BuddiesAfter each loss report removes living soldiers L through R, print the nearest surviving neighbors on both sides, or * when none exists. | Medium4 | Union-findLinked list+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Cow LineMaintain a deque of cows under left/right insertions and left/right bulk removals, then print the remaining cows left to right. | Medium4 | QueueLinked list+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The RaceGiven the starting order of cars and a recorded list of adjacent overtakes, verify the sequence is valid and print the final order or the first impossible overtake. | Medium4 | SimulationArray+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Rearranging a SequenceGiven the sequence 1 to n, each request moves a named integer to the front while keeping the rest in order; output the final sequence. | Medium4 | Linked listImplementation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Overflowing BookshelfSimulate a fixed-width shelf through add (push books leftward) and remove events; at End list the surviving books left to right. | Medium5 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| KeyloggerA log of typed keys, arrow moves, and backspaces in a text field must be replayed to recover the final password. | Medium5 | Linked listSimulation+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Cleaning the DishesSimulate two stacks where each wash or dry command reverses the order of the dishes it moves, then print the final cleaned pile top to bottom. | Medium5 | SimulationStack+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Gondola sequence checkDecide whether n observed gondola numbers could appear as consecutive passings on a circle where broken gondolas are replaced in order by numbered spares. | Medium5 | SimulationHash map+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Traffic (Small)Given a tree and Q tickets, count how many tickets use each edge along the unique path, then report the edge with the largest count (smallest station pair on ties). | Medium5 | TreePrefix sum+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Snail ListA linked list has a tail node N pointing back to node V, forming one cycle. For each query K, report the value stored in the node reached after moving K steps from node 1. | Medium5 | Linked listArray+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Doubly Linked ListGiven a sequence of doubly linked list move operations, output the minimum number of operations that reverse them and restore the original order. | Medium6 | Linked listStack+1 | No attempts yet | 1s | 128 MB | Judgeable |
| AlphabetSimulate inserting tokens into a growing circular list by repeatedly stepping k tokens forward and inserting the next alphabet letter, then report the letter inserted on turn m (up to 1e9), requiring an efficient data structure rather than brute simulation. | Medium6 | Linked listSimulation+1 | No attempts yet | 2s | 64 MB | Judgeable |
| Colorful VillageMaintain N houses under range repaint operations and answer queries counting how many of the T colors appear in a range. | Medium6 | Segment treeBit manipulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Space ManagerSimulate a disk with insert, remove, and compact operations using best-fit placement, then print an eight-block free-space picture or a full-disk error. | Medium6 | SimulationImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Student CanteenStudents numbered by arrival either join the back of a queue or cut in right ahead of an earlier student; report each cutter's 1-indexed position at that moment. | Medium6 | ImplementationLinked list+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Linked ListMaintain a permutation of 1..N under slide(a,b) moves (move a to just after b), reporting how far a moves each time and printing the final list. | Medium6 | Linked listArray+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Problem About Solving Problems (Dequery)Maintain a deque under queries that push the same value many times at either end, pop many elements, and read the k-th element; output each read. | Medium6 | Linked listImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| BackupGiven n sorted company positions on a line, choose k disjoint pairs (2k companies) minimizing the total sum of pairwise distances. | Medium7 | GreedyHeap+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Cyclic MarathonRunners spaced around a circular track catch and eliminate the runner ahead, and the program prints the elimination order and the survivors. | Medium7 | HeapLinked list+2 | No attempts yet | 3s | 256 MB | Judgeable |
| Tree and Queries 2Answer path-cost and k-th-vertex queries on a weighted tree with up to 100,000 nodes and queries. | Medium7 | TreeBinary search+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 |
| Polyline SimplificationRepeatedly remove the interior point whose triangle area is smallest, breaking ties by original index, and report each removal index. | Medium7 | HeapLinked list+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Zeroing FireGiven a center circle of radius R and two distinct shot points, find the area of all positions for a third shot whose circumcenter lies inside the center circle. | Medium7 | GeometryMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Path EmbeddingGiven a tree and an ordering of its vertices, find the maximum tree distance between consecutive vertices in the ordering, capping the answer at 99. | Medium7 | TreeLinked list+2 | No attempts yet | 1s | 512 MB | Judgeable |
| New Game 2Simulate turns moving K stacked pieces on an N x N colored board, following white, red, and blue square rules, and report the turn when four pieces stack or -1. | Medium7 | SimulationImplementation+2 | No attempts yet | 0.5s | 512 MB | Judgeable |
| Card DroppingGiven the technique used for each dropped card in order, reconstruct the initial top-to-bottom ordering of cards 1..N that produces a sorted pile. | Medium7 | SimulationLinked list+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| Colored BallsSimulate repeatedly deleting the longest run of same-colored balls (leftmost on ties), merging neighbors after each removal, and report when the k-th original ball is deleted. | Hard8 | HeapLinked list+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Dividing ClassesGiven n students and m pairs who know each other's messenger ID, split them into the maximum number of classes so that any two students in different classes know each other, then output the class sizes. | Hard8 | GraphBFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| FirmProcess hires and queries on a growing rooted tree, counting employees at exact depth offset k below a given node at query time. | Hard8 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Fibonacci MachineMaintain registers under range increment, answering range queries of the sum of Fibonacci values at the register entries, modulo 1e9+7. | Hard8 | Segment treeMatrix+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sequence and Queries 13Maintain an array under range add, range multiply, and range assign modulo 1e9+7, answering range sum queries. | Hard8 | Segment treeLinked list+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sequence and Queries 19Maintain an array under range add, range floor-division by d, and report the minimum and sum over a range. The division step needs a segment tree with min and sum. | Hard8 | Segment treeLinked list+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Compass Card SalesRepeatedly remove the remaining card with the smallest uniqueness score, breaking ties by larger ID, and print the removal order. | Hard8 | SimulationSorting+2 | No attempts yet | 6s | 512 MB | Judgeable |
| Wookje and His FansMaintain a line of fans with club labels under deletions and range-count queries, where each query counts the maximal same-club run around an element. | Hard8 | Linked listUnion-find+2 | No attempts yet | 2.5s | 256 MB | Judgeable |
| Picking Numbers on a CirclePick exactly K numbers from a circle of N values so that no two chosen are adjacent, maximizing the sum. | Hard8 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| ANTSGiven a tree and a set of up to 50 marked nodes per query, find the node minimizing the sum of distances to all marked nodes, for up to 5000 queries. | Hard8 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Metro LinesA tree is given, and for each query with two pairs of terminals, count the stations shared by the two paths between those pairs. | Hard8 | TreeLinked list+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Rope and QueriesMaintain a string under up to 100,000 queries that cut a substring and move it to the front or back, and print single characters. | Hard8 | Linked listImplementation+2 | No attempts yet | 0.3s | 512 MB | Judgeable |
| Sequence and Queries 25Maintain an array under range bitwise AND, range bitwise OR, and range maximum queries, each value below 2^20. | Hard8 | Segment treeBit manipulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sequence and Queries 28Maintain an array under range add, range floor-sqrt, and range sum queries, and report each range sum. | Hard8 | Segment treeMath+2 | No attempts yet | 1s | 512 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 |
| VisitsGiven a tree, a visiting order, fuel prices, and tank capacities, compute the refueling cost of each trip in the order. | Hard8 | TreePrefix sum+2 | No attempts yet | 2s | 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 |
| 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 |
| Lowest common ancestor in a dynamic forestMaintain a forest of rooted trees under link, cut, and lowest-common-ancestor queries, printing each LCA. | Hard9 | TreeLinked list+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 |
| 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 |