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 results123 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| The Worm TurnsSimulate a 20-cell worm on a 50x50 grid through a list of moves, stopping when it hits itself, leaves the board, or finishes. | Easy2 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Van Gogh's Work ScheduleSimulate a first-come queue of painting jobs and print arrivals, starts, and finishes for hours 0 to 23. | Easy2 | SimulationQueue | No attempts yet | 1s | 64 MB | Judgeable |
| Josephus PermutationSimulate the Josephus elimination order for N people counting off every K-th person in a circle and print the removal sequence. | Easy3 | QueueSimulation+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Printer QueueSimulate a queue where documents are printed only when no higher-priority document remains, and find the print order of a specific document. | Easy3 | QueueSimulation | No attempts yet | 2s | 128 MB | Judgeable |
| Card 1Simulate a queue where you discard the front card then rotate the next card to the back, printing the discard order and final survivor. | Easy3 | QueueSimulation | No attempts yet | 2s | 128 MB | Judgeable |
| Card 2Simulate the Josephus-style card elimination process to find which card number remains last for a given N. | Easy3 | QueueSimulation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Hotel Room AssignmentSimulate assigning arriving groups to hotel rooms with two beds each, filling empty rooms first then pairing singles, and output the final occupancy per room. | Easy3 | SimulationQueue+1 | No attempts yet | 1s | 128 MB | Judgeable |
| And Then There Was OneSimulate a Josephus-style circle elimination game with a custom starting removal point and report the last remaining stone for each test case. | Easy3 | SimulationQueue+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Ferry Loading IVSimulate a ferry of given length that repeatedly crosses between two banks, loading waiting cars in arrival order. | Easy3 | SimulationQueue | No attempts yet | 1s | 128 MB | Judgeable |
| CardsApply k top-to-bottom card moves in order and report the number on top of the deck. | Easy3 | QueueSimulation | No attempts yet | 1s | 128 MB | Judgeable |
| Snake game simulationSimulate 20 snake moves on a 15 by 15 board with growth on pellets and print the pellet count or game over with the final board. | Easy3 | SimulationQueue | No attempts yet | 1s | 256 MB | Judgeable |
| QueueProcess a sequence of push, pop, size, empty, front, and back commands on an integer queue and print each result. | Easy3 | Queue | No attempts yet | 0.5s | 256 MB | Judgeable |
| DequeProcess up to 10000 push, pop, size, empty, front and back commands on an integer deque and print each query result. | Easy3 | QueueImplementation | No attempts yet | 0.5s | 256 MB | Judgeable |
| Waiting for ChangeSimulate book sales across two queues with limited five-dollar change and report line B at its longest moment. | Easy3 | SimulationQueue | No attempts yet | 1s | 256 MB | Judgeable |
| Josephus PermutationRemove every Kth person from a circle of N people and print the removal order in angle brackets. | Easy3 | QueueSimulation | No attempts yet | 2s | 512 MB | Judgeable |
| Theme Park (Small)Groups board a k-seat coaster in queue order and rejoin the back after each run, so simulate R runs and add one euro per rider. | Easy3 | SimulationQueue | No attempts yet | 5s | 512 MB | Judgeable |
| Theme Park (Small)Groups board a k-seat coaster in queue order without skipping, riders rejoin the back, and total earnings over R runs are computed. | Easy3 | SimulationQueue | No attempts yet | 5s | 512 MB | Judgeable |
| Ping Pong Balls (Small)Given two fixed displacement vectors, simulate the chain reaction from one starting trap and count how many distinct traps fire. | Easy3 | SimulationBFS+2 | No attempts yet | 5s | 512 MB | Judgeable |
| TrucksTrucks cross a one-lane bridge in order under a weight limit; find the earliest time all have finished. | Easy3 | QueueSimulation | No attempts yet | 1s | 512 MB | Judgeable |
| Course registrationGiven a click log of student numbers and K seats, keep each student's last click, then print the first K distinct students in that order. | Easy3 | QueueHash map+1 | No attempts yet | 1s | 256 MB | Judgeable |
| RouterSimulate a buffer of size N: packets arrive in order, 0 means one is handled and removed from the front, and a packet arriving with the buffer full is dropped. | Easy3 | QueueSimulation+2 | No attempts yet | 1s | 512 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 |
| Josephus Permutation 2Given N people in a circle and a step size K, output the full removal order produced by repeatedly eliminating every K-th remaining person. | Medium4 | QueueSimulation+1 | No attempts yet | 0.15s | 128 MB | Judgeable |
| Card MagicFind an initial card order so that repeatedly cycling and dealing cards produces the sequence 1 to N on the table. | Medium4 | SimulationQueue+1 | No attempts yet | 2s | 128 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 |
| Finding Silent IntervalsFind every starting index of a length-m window in an array where the max minus min value is at most c, using a sliding window with monotonic deques. | Medium4 | Sliding windowQueue+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SnakeSimulate a classic snake moving on an N x N grid with given apple positions and scheduled turn events, and output the second when it hits a wall or itself. | Medium4 | SimulationQueue+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Card Pickup GameSimulate removing cards 1..N in order from a circular scan of a row, counting how many times the search wraps past the right end. | Medium4 | QueueSimulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Indiana Jones and the Lost Soccer CupGiven precedence constraints between levers, decide whether the order is unique; print the unique order, or report no order or multiple orders. | Medium4 | Topological sortGraph+2 | No attempts yet | 1s | 256 MB | Judgeable |
| JugglefestSimulate the first 20 throws of a siteswap pattern, assigning balls in order of first use, and detect any time two balls are due on the same throw. | Medium4 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Parking LotSimulate cars arriving and leaving a parking lot, assigning each to the lowest-numbered free space or a waiting queue, and sum weight times rate. | Medium4 | SimulationQueue+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Hide and SeekIn a connected undirected graph, find the barn farthest from barn 1. Print the smallest such barn number, its distance, and how many barns tie at that distance. | Medium4 | GraphBFS+2 | No attempts yet | 1s | 256 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 |
| Card StackingSimulate a deck where each dealt card is followed by moving P cards to the bottom, and report the original positions that reach Bessie. | Medium4 | SimulationQueue+2 | No attempts yet | 1s | 128 MB | Judgeable |
| M*A*S*HSimulate a card-driven counting-out lottery on a line of P people until X survivors remain, then print their original positions in increasing order. | Medium4 | SimulationArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Bridge CrossingSplit a line of people into consecutive groups of at most M, where each group costs its slowest member's time, and minimize the total cost. | Medium4 | Dynamic programmingArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Mysterious X NetworkGiven an undirected graph of N people, find the minimum number of intermediate people on a shortest path between two given people. | Medium4 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TomatoesGiven a grid of ripe, unripe, and empty cells, find how many days until every tomato ripens or report -1 if some never can. | Medium4 | BFSGraph+2 | No attempts yet | 1s | 256 MB | Judgeable |
| SSSP (Shortest Path Queries)Run the given SPFA shortest-path algorithm for each query and also output a push counter that accumulates across all queries. | Medium4 | Shortest pathGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| PilotsFind the length of the longest contiguous fragment whose maximum minus minimum is at most t. | Medium4 | Sliding windowTwo pointers+1 | No attempts yet | 3s | 128 MB | Judgeable |
| SnakeSimulate the snake's moves on the board and report the move on which its head hits a wall or its own body. | Medium4 | SimulationQueue+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Card ShufflingGiven a deck numbered from the top and a string of two shuffle moves, find the three cards at positions k-1, k and k+1 after all moves. | Medium4 | SimulationQueue | No attempts yet | 2s | 512 MB | Judgeable |
| Exploration TeamFind the size of the largest group where every member has at least k friends inside the group. | Medium4 | GraphQueue | No attempts yet | 1s | 256 MB | Judgeable |
| Sliding Window MinimumPrint the minimum of each window of length L ending at every position of the array. | Medium4 | Sliding windowQueue | No attempts yet | 2.4s | 512 MB | Judgeable |
| Miraculous DrugEach hour uses the cheapest enzyme bought within the last h hours, breaking ties toward the latest hour, and reports purchase counts over a given interval. | Medium4 | Sliding windowQueue | No attempts yet | 1s | 256 MB | Judgeable |
| gSnake (Small)Simulate a growing snake that eats food on alternating cells of a wrapping board with scheduled turns and report its length when it collides or time runs out. | Medium4 | SimulationQueue | No attempts yet | 5s | 512 MB | Judgeable |
| Mousetrap (Small)For each query index, report which card occupies that position in the unique deck that removes cards in order 1..K. | Medium4 | QueueSimulation+1 | No attempts yet | 30s | 512 MB | Judgeable |
| Jump JumpGiven jump distances on a row of n stones, count how many stones are reachable from a starting stone via left or right jumps that stay on the bridge. | Medium4 | GraphBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Eenie Meenie Miney MoeSimulate elimination in a circle of N heifers using a repeating sequence of up to L step sizes, and report the last heifer left. | Medium4 | SimulationImplementation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Olympiad PizzaContestants queue for pizza slices; each takes one slice per turn and rejoins the back if still hungry. Report the second each finishes. | Medium4 | QueueSimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Eeny MeenySimulate counting around a circle of kids with a rhyme length, removing one kid per round and assigning them to alternating teams. | Medium4 | SimulationImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Run, HongjunGiven N billboard intensities and a sight range M, output the maximum intensity within a sliding window of size 2M-1 for each valid position. | Medium5 | Sliding windowQueue+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Candidate RecommendationSimulate N photo frames where each recommendation either updates a displayed student's count or evicts the least-recommended, longest-displayed student to show the new one. | Medium5 | SimulationHash map+2 | No attempts yet | 2s | 128 MB | Judgeable |
| AirplaneSimulate passengers walking down a single aisle to their assigned row and taking 5 seconds to load luggage, blocked by others ahead, to find total boarding time. | Medium5 | SimulationQueue+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Stock PricesSimulate an order book with buy and sell orders, matching bids and asks at the ask price, and report ask, bid, and last trade price after each order. | Medium5 | SimulationImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Chat RoomsFor each submitted line, decide accept or reject using consonant-run length, the count of recent suspicious lines, and recent duplicate counts over a sliding window of the last 10 lines. | Medium5 | Sliding windowString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SnapSimulate the two-player Snap card game with card flipping, pile recycling, and a fixed random tie-breaker for up to 1000 turns. | Medium5 | SimulationQueue+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Dueling PhilosophersGiven m precedence edges among n essays, decide whether the es-says have zero, exactly one, or more than one valid topological ordering. | Medium5 | GraphTopological sort+2 | No attempts yet | 2s | 128 MB | Judgeable |
| ASM – The Abelian Sandpile ModelDrop grains one at a time on a grid and repeatedly topple any cell over the critical height, losing grains that fall off the edge, until the pile is stable. | Medium5 | SimulationQueue+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Bora BoraSimulate a children's card game with turn order, direction changes, forced draws and skips, and a fixed discard rule, and report the winner. | Medium5 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Relay RaceEach cow runs one lap, then signals other cows to start; find the time when the last cow finishes, ignoring repeat signals. | Medium5 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Team QueueSimulate a team queue where each new element cuts in behind its own teammates, if any, and otherwise joins the tail; print every dequeued element. | Medium5 | QueueHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Barking Dogs!Given dogs with wake-up delays and a directed hearing graph, simulate who barks each second from 0 to T and count each dog's barks. | Medium5 | SimulationGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Chemical ReactionsCount unowned compounds that become producible by repeatedly firing reactions whose substrates are all available. | Medium5 | BFSGraph+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Neighborhood RivalryEach cell of the grid needs the maximum value inside the square of radius R centered on it. | Medium5 | Sliding windowMatrix+1 | No attempts yet | 2.5s | 128 MB | Judgeable |
| Crowded CowsCount cows that have a cow at least twice as tall within distance D on both the left and the right. | Medium5 | Sliding windowSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| 2D Max FilterFor every cell of an R by C grid, output the maximum value inside the rectangular window centered on that cell, clipped at the borders. | Medium5 | Sliding windowQueue+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Hyper-minimumCompute the minimum of every M by M by M by M subcube of a 4D array with up to 1.5 million entries. | Medium5 | Sliding windowQueue | No attempts yet | 2s | 256 MB | Judgeable |
| PairingGiven complete preference rankings of N men and N women, compute the man-optimal stable pairing. | Medium5 | GreedySimulation+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Sum of submatrix maximaAdd up the maximum value inside every K by K submatrix of an N by N matrix generated from two arrays. | Medium5 | Sliding windowMatrix+1 | No attempts yet | 20s | 1024 MB | Judgeable |
| Theme Park (Large)Groups board a coaster holding at most k people in queue order and rejoin the back after riding, and R runs of earnings must be totaled. | Medium5 | SimulationQueue+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Theme Park Roller CoasterSimulate R rides where groups at the front board until the next group cannot fit, then return to the back; report total earnings. | Medium5 | QueueSimulation+1 | No attempts yet | 5s | 512 MB | Judgeable |
| SouvenirParticipants sit in a circle; stage t removes the t^3-th person counting clockwise from the current host, and you find the last survivor. | Medium5 | SimulationQueue+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Trading Union DeparturesStarting from country L leaving, each country exits once at least half its original partners have left; decide whether X exits too. | Medium5 | GraphSimulation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Jupiter OrbiterGiven queues with capacities, sensor writes between downlink windows, and per-window downlink limits, decide whether every queue can be emptied. | Medium5 | SimulationQueue+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Foosball DynastySimulate a foosball variation where seats rotate after each point and report the team whose scoring streak lasted longest. | Medium5 | SimulationImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Miss That Bus and You Are Late!!Simulate a single-lane bus stop where each bus parks in the frontmost free spot, waits if a bus ahead is still parked, and departs after its dwell time; report the parking spot of the m-th bus. | Medium5 | SimulationQueue+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Passport ControlDecide whether a given exit permutation can arise from a FIFO arrival line feeding k desk queues, each holding an arrival-ordered subsequence. | Medium5 | QueueStack+2 | No attempts yet | 0.2s | 512 MB | Judgeable |
| Drug Investigation UnitGiven a directed supply graph and a set of arrested suppliers, count how many remaining suppliers still receive drugs from some origin. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Musical ChairsSimulate the Josephus elimination where each eliminated person's own number k sets the next count length, and print the last survivor. | Medium5 | SimulationQueue+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Teleport StationGiven N points in a line, edges between x-1 and x+1, plus M teleport connections, find the shortest time from S to E. | Medium5 | GraphBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| BNKQCustomers arrive over time and each joins the shortest counter queue; find the total time until the last customer finishes being served. | Medium5 | SimulationHeap+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Queuing at the DoctorsSimulate visitors moving through a sequence of doctor offices, forming queues by arrival order and number, to find when the last person leaves. | Medium6 | SimulationQueue+2 | No attempts yet | 1s | 128 MB | Judgeable |
| FerrySimulate a shuttling ferry with capacity M and crossing time t, picking up waiting passengers with priority for those who arrived earlier, and output each passenger's arrival time on the opposite bank. | Medium6 | SimulationQueue+1 | No attempts yet | 2s | 128 MB | Judgeable |
| ExchangeImplement a limit order book that matches buy/sell orders FIFO by price-time priority, supports cancellation, and emits trades and quotes for each message. | Medium6 | QueueSimulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Book ReplacementSimulate a library queue where a librarian relocates books between capacity-limited desks and a shelf using an LRU-like eviction rule, and compute total access cost. | Medium6 | SimulationQueue+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Fire!Given a grid with walls, one starting cell, and fire cells that spread each second, find the earliest time the person can step off the map. | Medium6 | BFSGraph+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Mowing the LawnGiven N cows in a row with efficiencies, pick a subset that never includes more than K adjacent cows and maximize the total efficiency. | Medium6 | Dynamic programmingSliding window+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Parallel Computer SimulatorSimulate up to ten concurrent programs on one CPU with FIFO scheduling, quantum preemption, and lock/unlock mutual exclusion, then report prints in execution order. | Medium6 | SimulationQueue+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Sorting It All OutGiven up to n letter ordering constraints added one at a time, report the first point where a unique sorted order emerges or where the constraints contradict each other. | Medium6 | GraphTopological sort+2 | No attempts yet | 1s | 128 MB | Judgeable |
| EurozwrotnicaDecide whether the arriving train order can be split across two FIFO tracks so all trains leave in increasing order. | Medium6 | QueueGreedy | No attempts yet | 2.5s | 128 MB | Judgeable |
| People like peopleFrom each voter list of up to three liked students, find the largest group where everyone voted, likes only members, and is liked by a member. | Medium6 | GraphQueue+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Binary GameRead two binary strings and decide whether the first can reach the second by deleting the front character or appending the current parity bit. | Medium6 | QueueMath | No attempts yet | 1s | 256 MB | Judgeable |
| Professor Normal's Marble GameChildren on a grid repeatedly drop out when short on marbles, then survivors pass 12 marbles to neighbors; count the exchanges or the children who play forever. | Medium6 | SimulationQueue+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Suspicious SamplesFor each condition, count samples whose value is greater or less than the min, max, or average of samples in the preceding time window. | Medium6 | Sliding windowQueue+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Dueling PhilosophersGiven directed edges meaning essay d must precede essay u, decide whether the ordering is impossible, unique, or has multiple solutions. | Medium6 | GraphTopological sort+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Baby SharkOn a grid with fish and a baby shark that eats smaller fish and grows, simulate its BFS-driven meal choices and report the total time spent. | Medium6 | BFSGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Seoul Subway Line 2Given a connected graph with N vertices and N edges (exactly one cycle), find each vertex's distance to the unique cycle. | Medium6 | GraphBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Restroom RulesEmployees are dealt into M lines round-robin; repeatedly the head with the largest D, then largest H, then smallest line index is served. Count who goes before Deka. | Medium6 | SimulationHeap+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| PicnicGiven N students in a circle removing every K-th person Josephus-style, find the round number in which a specific student M is eliminated, with N and K up to 5,000,000. | Medium7 | Segment treeSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |