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 results2,994 problems
TitleLevelTopicsSolvedTime limitMemory limitJudge
Two BallsTwo balls move on a grid for T seconds with different random rules; compute the probability they collide, to 4 decimals.Medium7ProbabilityDynamic programming+1No attempts yet1s256 MBJudgeable
Explosion at CafebazaarA directed multigraph alternates send and receive rounds from an initial 1-bit packet; count the starting switches whose bit makes some buffer grow without bound.Medium7GraphDFS+2No attempts yet2s512 MBJudgeable
Watson and Intervals (Large)Generate N intervals from a recurrence, then find the minimum covered integer count after removing exactly one interval.Medium7IntervalsSorting+2No attempts yet5s512 MBJudgeable
Blindfolded speedrunnerFind the shortest fixed action sequence that walks a blindfolded hero from the bottom-left to the top-right cell of an N x N grid regardless of whether the initial facing is up or right.Medium7BFSGraph+2No attempts yet2s512 MBJudgeable
Double EliminationGiven J's winners-bracket and losers-bracket win counts in a double-elimination tournament with 2^k players, find his final rank.Medium7MathImplementation+2No attempts yet2s512 MBJudgeable
Detective JunhaFind the shortest walk on a 4x5 grid that starts at 0, visits museums in numeric order, and covers every non-dot cell, moving one step at a time.Medium7BFSGraph+2No attempts yet0.5s512 MBJudgeable
Replicate Replicate RfplicbteGiven a final grid from a punctured cellular automaton (odd-parity rule with at most one cell flipped per step), find the unique smallest nonempty starting pattern.Medium7SimulationImplementation+2No attempts yet3s512 MBJudgeable
Your NameGiven unread counts for messages in order, find every person who could have left message Q unread under some consistent reading schedule.Medium7GreedyImplementation+2No attempts yet2s256 MBJudgeable
Shuttle busProcess students getting off a shuttle; after each exit every student shifts toward the nearer end one adjacent empty seat at a time, and queries ask who sits in a given seat.Medium7Union-findSimulation+1No attempts yet1.5s512 MBJudgeable
ParrotsGiven N parrot sentences and one written sequence, decide whether distinct words can interleave so that each parrot's words stay in order and no word repeats.Medium7SimulationGreedy+2No attempts yet1s512 MBJudgeable
Dev, Please Add This!Decide whether a ball that rolls until hitting a wall or edge can collect every star on a grid.Medium7GraphBFS+2No attempts yet1s256 MBJudgeable
Faster SortingFor each MINRUN, simulate Timsort's run splitting and report the number of subarrays and the number of bad elements pulled in.Medium7SimulationTwo pointers+1No attempts yet1s128 MBJudgeable
Flow ShopGiven N jobs processed through M stages in the same order with per-job times, and a smallest-label-first queue rule at each stage, find each job's finish time.Medium7SimulationQueue+1No attempts yet6s512 MBJudgeable
Bathroom StallsSimulate K people choosing the emptiest interval by a tie-break rule, and report the gap sizes of the K-th chosen stall.Medium7HeapGreedy+2No attempts yet5s512 MBJudgeable
Play the DragonGiven dragon and knight stats, find the fewest turns of attack, buff, cure, or debuff actions to defeat the knight, or report it is impossible.Medium7Brute forceGreedy+2No attempts yet5s512 MBJudgeable
Roller Coaster Scheduling (Small)Given tickets for specific seats and customers, find the minimum rides needed after freely moving tickets to smaller-numbered seats, and the minimum promotions achieving it.Medium7GreedySorting+2No attempts yet5s512 MBJudgeable
Box DeliveryA 1x1x3 box rolls 90 degrees across a grid, and we want the fewest rolls until it touches the destination cell; the box has two stable resting shapes.Medium7BFSGraph+2No attempts yet1s256 MBJudgeable
Marathon Ice HockeyAssign each player a number of minutes by a fixed greedy order, then convert the resulting cyclic blocks into an explicit substitution list.Medium7GreedySorting+2No attempts yet1s64 MBJudgeable
Folding a RibbonGiven the layer index and part index of a marked spot on a ribbon folded n times, output the unique sequence of left and right folds.Medium7RecursionDivide and conquer+2No attempts yet2s512 MBJudgeable
GentleBotsSimulate a fixed three-dimensional two-robot controller: for each robot, print the straight or detour route around the other robot's position, exactly following the stated rules.Medium7SimulationImplementation+2No attempts yet1s512 MBJudgeable
Champagne TowerGiven up to 20 glasses with rim circles in 3D, pour champagne into the highest one at 100 ml/s and find when the whole tower fills, or report Invalid.Medium7GeometrySimulation+2No attempts yet2s512 MBJudgeable
Yes, Yes, It's NonogramsRepeatedly apply line-by-line nonogram deduction until no square's color is forced, then print the resulting grid.Medium7SimulationImplementation+2No attempts yet2s512 MBJudgeable
Is-A? Has-A? Who Knows-A?Given is-a and has-a facts between at most 500 classes, apply the four transitivity rules and answer whether each queried relation holds.Medium7GraphDFS+2No attempts yet2s512 MBJudgeable
Fygon 2.0Given nested Fygon loops with inclusive ranges over variables and n, compute the asymptotic complexity C*n^k of the single lag execution count, with C as an irreducible fraction.Medium7MathCombinatorics+2No attempts yet3s512 MBJudgeable
Landing slotsFor each incoming aircraft, find the lowest free landing slot it can physically reach and report the join point and arrival time.Medium7GeometrySimulation+1No attempts yet2s512 MBJudgeable
ASCII Art TreesFor each prefix-encoded binary tree, draw its ASCII layout using the given slash, bar, and spacing rules and print the resulting character grid.Medium7TreeRecursion+2No attempts yet2s512 MBJudgeable
Polyline SimplificationRepeatedly remove the interior point whose triangle area is smallest, breaking ties by original index, and report each removal index.Medium7HeapLinked list+2No attempts yet5s512 MBJudgeable
World Cup DrawSimulate the World Cup draw by placing each team into the leftmost group that keeps the rest of the pot placeable, then sort groups by total rank.Medium7GreedyBacktracking+2No attempts yet2s512 MBJudgeable
Mixing CoinsGroups of equal coins are merged three at a time when three consecutive same-material coins appear, and the survivor count is requested.Medium7SimulationStack+1No attempts yet5s512 MBJudgeable
ClickbaitGiven an ASCII map of containers joined by pipes, determine the order in which the containers fill with water starting from container 1.Medium7SimulationGraph+1No attempts yet1s128 MBJudgeable
English RestaurantGiven n tables and random hourly group sizes from 1 to g, find the expected number of seated people after t hours, where each group takes the smallest table that fits.Medium7Dynamic programmingProbability+1No attempts yet2s512 MBJudgeable
Marble Escape 4On a small board with one red marble, one blue marble, and a single hole, tilt until the red marble falls through the hole while the blue never does; report the fewest tilts or -1.Medium7BFSSimulation+2No attempts yet2s512 MBJudgeable
Puyo Puyo StackingGiven a final Puyo Puyo board, print one accepted sequence of pair drops that builds it in the exact column order the statement fixes, using temporary pops to clear leftovers.Medium7SimulationImplementation+2No attempts yet1s1024 MBJudgeable
IncineratorMaintain a queue of waste and M incinerator cells under burn, query, append, and recycle commands, then report the final cells.Medium7ImplementationQueue+2No attempts yet2s512 MBJudgeable
Array and OperationsApply a sequence of global 'add index to each position' updates and range reversals to a zero array, then report the values at m queried positions.Medium7ArrayImplementation+2No attempts yet2s512 MBJudgeable
RoboThievesOn a grid with walls, cameras, and one-way conveyors, find the minimum number of robot steps to reach each empty cell without ever being seen by a camera.Medium7BFSGraph+2No attempts yet2s512 MBJudgeable
Floating-Point NumbersStarting from s = a, add the same 64-bit truncated floating-point value a to s exactly n times (n up to 10^18) and output the resulting 64 bits.Medium7SimulationMath+2No attempts yet2s512 MBJudgeable
GPSFor each orbiting satellite, decide whether its straight-line radio signal reaches a given point on a spherical Earth, and if so output the travel time.Medium7GeometryMath+2No attempts yet2s512 MBJudgeable
The Cowherd and the Weaver GirlOn an N by N grid, move 1 cell per minute from (0,0) to (N-1,N-1); bridges with given periods are crossable only at some minutes, never twice in a row, and you may add one bridge of period M.Medium7BFSGraph+2No attempts yet1s256 MBJudgeable
Three RobotsGiven a connected weighted graph and three robot start vertices, find the earliest time all three can meet at one vertex, where each robot may wait or move along edges.Medium7GraphShortest path+2No attempts yet2s512 MBJudgeable
EmpireSimulate a tree of kingdoms and wars: process each battle in order, transfer vassal subtrees on losses and successful rebellions, then report the root kingdoms sorted by ASCII order.Medium7TreeSimulation+2No attempts yet1s256 MBJudgeable
Repeating GoldbachsApply the largest-difference Goldbach step to an even x under 1,000,000 until it drops below 3, and count the steps.Medium7Number theorySimulation+2No attempts yet2s512 MBJudgeable
Dragon and DungeonSimulate the fixed-attack dungeon and track required minimum HP, then binary search the smallest starting maximum HP that keeps survival possible.Medium7Binary searchSimulation+2No attempts yet1s256 MBJudgeable
SwitchesGiven initial on-lamps and N switches that each toggle a set of lamps, find how many flips are made cycling 1..N until all lamps are off, or -1 if never.Medium7SimulationMath+2No attempts yet2s512 MBJudgeable
BAZE RUNNERA 4-wide maze has one gap per middle row; find the fewest moves to go from top-left to bottom-right when the player may also shift a row's wall left or right.Medium7BFSGraph+2No attempts yet1s256 MBJudgeable
Super Cheap Party RoomsManage a row of N rooms across new/in/out queries, placing each new room in the leftmost gap of size Y and cleaning it when its guests leave.Medium7IntervalsSimulation+2No attempts yet1s512 MBJudgeable
Emergency EvacuationGiven a bus seat layout and passenger positions, compute the minimum number of synchronous steps until all passengers exit through the rear aisle.Medium7GreedySorting+2No attempts yet3s512 MBJudgeable
Get to Work, Lute!Chemicals with given viscosities travel in order through M pipes; find the completion time of each chemical given minimum-clearance waits between them.Medium7SimulationGreedy+2No attempts yet2s512 MBJudgeable
Elastic CollisionsTwo bodies on a line, mass 1 at rest and mass N^2 approaching, bounce elastically between each other and a wall; count the total collisions before both move right forever.Medium7SimulationMath+2No attempts yet3s256 MBJudgeable
Expansion GameSimulate multiple players expanding castles across a grid by up to S_i steps per turn until no one can move; report final castle counts.Medium7BFSGraph+2No attempts yet2s512 MBJudgeable
Castle DefensePlace 3 archers on the wall row so that the total number of enemies killed by their attacks before reaching the wall is maximized.Medium7Brute forceSimulation+2No attempts yet1s512 MBJudgeable
Laboratory 2Place M viruses among up to 10 candidate cells in an N×N grid with walls; minimize the time until every empty cell is infected, or report -1.Medium7BFSBrute force+2No attempts yet1s512 MBJudgeable
Laboratory 3Given a grid with walls and up to 10 viruses, choose M of them to activate simultaneously and minimize the time until the virus fills every empty cell, or print -1.Medium7BFSBacktracking+2No attempts yet0.25s512 MBJudgeable
Fine Dust, Goodbye!Simulate T seconds of dust diffusion on a grid plus the circular wind from a two-cell air purifier, then sum the remaining dust.Medium7SimulationImplementation+2No attempts yet1s512 MBJudgeable
HashgraphBuild a hashgraph from M directed communications, then decide whether one given event can reach another through the precedence (see) relation.Medium7GraphDFS+2No attempts yet1s256 MBJudgeable
Sehun's Gift ShopSimulate two workers racing to wrap gifts from a shared front queue, respecting order arrival times and a tie-break rule, then report which gift numbers each wrapped.Medium7SimulationImplementation+2No attempts yet1s512 MBJudgeable
Unify the ColorsFor each button, compute the minimum presses needed to unify all colors when allowed to press only that button. Output the leftmost button with the smallest count.Medium7ImplementationArray+2No attempts yet1s512 MBJudgeable
DVDA DVD logo rectangle bounces off the TV walls; find the earliest time its corner reaches a TV corner, or report that it never does.Medium7MathNumber theory+2No attempts yet1s512 MBJudgeable
Ant in a Hexagonal WebOn an infinite hexagonal web, count the ant walks that make exactly N turns before first revisiting a vertex, where the first step is fixed north.Medium7DFSBacktracking+2No attempts yet1s1024 MBJudgeable
Disrupting DefenseFind a sequence of n/2 attacks removing adjacent differently valued soldiers from a circular ring until all are gone, or report impossible.Medium7GreedyStack+2No attempts yet1s512 MBJudgeable
Rectilinear PolygonGiven a simple rectilinear polygon's vertices in clockwise order, find the maximum number of vertical edges a horizontal line can cross (h) and the maximum number of horizontal edges a vertical line can cross (v), then output max(h, v).Medium7GeometrySorting+2No attempts yet1s512 MBJudgeable
TrapCount the self-avoiding walks of n unit grid steps that start at (0,0) going right and are trapped: no further step can be added without self-intersection.Medium7BacktrackingDFS+2No attempts yet2s512 MBJudgeable
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.Medium7SimulationImplementation+2No attempts yet0.5s512 MBJudgeable
CarsTwo axis-aligned rectangular cars move at constant speed in a grid city for t seconds; decide whether they ever overlap in a positive-area region, treating edge-only touches as safe.Medium7GeometryImplementation+2No attempts yet1s512 MBJudgeable
AssassinsGiven chronological assassination attempts with success probabilities, find the probability each of n assassins is alive at the end, where a dead assassin's attempts are cancelled.Medium7ProbabilityDynamic programming+2No attempts yet1s512 MBJudgeable
Ladder GameGiven a ladder (Amidakuji) whose bars have depths, find every bar that can be removed without changing the permutation it induces.Medium7SimulationGreedy+2No attempts yet1s512 MBJudgeable
A+B ProblemAdd two huge integers given as run-length encoded digit blocks and print the sum in the same compressed format.Medium7ImplementationSimulation+2No attempts yet2s512 MBJudgeable
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.Medium7SimulationLinked list+2No attempts yet2s1024 MBJudgeable
MastermindGuess a hidden 4-digit sequence over six colors using at most K red/white feedback queries per game, for T games.Medium7Brute forceSimulation+2No attempts yet3s512 MBJudgeable
Gunwoo Trapped in a MazeFind the earliest day and time of day to reach the goal in an n x n maze where every m moves flip between day and night; at night he can pass through consecutive walls in a straight line.Medium7BFSGraph+2No attempts yet1s256 MBJudgeable
The Assembly CodeGiven a corrupted assembly program with five arithmetic or bitwise ops hidden behind letters A to E, plus k input-output logs, count the letter-to-operation assignments consistent with every log and print the unique one.Medium7SimulationBrute force+2No attempts yet2s512 MBJudgeable
Pawn's RevengePlace the fewest pawns on an N by N board so that every enemy piece is attacked diagonally from below, given a king that also attacks adjacent squares and blocks placement.Medium7GreedySimulation+2No attempts yet1s512 MBJudgeable
Journey to JupiterGiven a rotated equilateral triangle's normal vector and vertex A position, compute the lengths of three actuators connecting its vertices to a base point.Medium7GeometryMath+2No attempts yet6s512 MBJudgeable
Swapity Swapity SwapApply a fixed sequence of M range reversals to an array of N elements K times, and print the final arrangement; K can be up to 1e9.Medium7ImplementationMath+2No attempts yet2s512 MBJudgeable
Cowntact TracingGiven a final set of infected cows and a time-stamped list of hoof-shake pairs, count possible patient-zero cows and the range of transmission limits K consistent with the data.Medium7SimulationBrute force+2No attempts yet1s512 MBJudgeable
Japanese FoodSimulate a restaurant where the cook batches identical dishes across pending orders under per-dish limits, and report each order's completion time.Medium7SimulationImplementation+2No attempts yet1s512 MBJudgeable
Coal MineAssign each unit square one of k coal types so that the cells of type i are point-symmetric about elevator i, or report that no such assignment exists.Medium7ImplementationSimulation+2No attempts yet0.5s64 MBJudgeable
Tic-tac-toeFor each 3x3 tic-tac-toe board, decide whether it is invalid, reachable only by non-optimal play, or reachable by two perfect players.Medium7Game theorySimulation+2No attempts yet5s512 MBJudgeable
Adult SharkSimulate a grid of sharks that each move by fixed directional priorities, leave fading scent trails, and eat the weaker shark when they collide, until only shark 1 is left.Medium7SimulationImplementation+2No attempts yet1s512 MBJudgeable
BallsMaintain a set of unit-diameter balls on a line with a wall; support insertions at free spots and repeatedly roll the leftmost ball, propagating collisions until it stops, then print all final positions.Medium7SimulationHash map+2No attempts yet1s256 MBJudgeable
RumorGiven a graph and initial spreaders, each uninfected person adopts the rumor once more than half of their neighbors believe it; report the adoption minute for everyone.Medium7GraphBFS+2No attempts yet10s1024 MBJudgeable
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.Medium7Segment treeBinary search+2No attempts yet1s1024 MBJudgeable
Fuel StationFind the minimum starting fuel F so Pengu reaches distance D, where each station i adds Ai litres if the starting F is at most Bi.Medium7Binary searchGreedy+2No attempts yet3s512 MBJudgeable
Table TransformationApply up to a million row, column, and cell swaps to a large grid, then output a weighted modular checksum; the operation list is generated by a linear recurrence.Medium7SimulationArray+2No attempts yet4s512 MBJudgeable
ShadowGiven a grid room with one point light source and wall cells blocking light, compute the total area of empty cells lying in shadow.Hard8GeometrySimulation+2No attempts yet2s128 MBJudgeable
Paper FoldingGiven an N by M grid of integers, repeatedly fold it along row or column lines so overlapping cells sum, and find the maximum value obtainable in any cell.Hard8Dynamic programmingIntervals+2No attempts yet2s128 MBJudgeable
Zero Run PatternGiven two binary strings repeated in a growing pattern, find the first position within the first 10^16 characters where C consecutive zeros occur.Hard8StringBinary search+2No attempts yet2s128 MBJudgeable
FlippingGiven A zeros and B ones, find the minimum number of turns needed to flip exactly K chosen values each turn until all become 1, or -1 if impossible.Hard8BFSMath+2No attempts yet2s128 MBJudgeable
Paper RacingFind the minimum number of turns for a car with adjustable integer velocity to reach the finish, where each turn changes each velocity component by at most 1 and the straight path must avoid obstacles until it hits the finish.Hard8BFSGraph+2No attempts yet2s128 MBJudgeable
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.Hard8HeapLinked list+2No attempts yet2s128 MBJudgeable
Floor PlanGiven an outer rectangle and inner rectangles drawn inside it, count the number of enclosed office regions and find the area of the largest one.Hard8Union-findGeometry+2No attempts yet2s128 MBJudgeable
War - Water Instead of FireFind the minimum water volume poured at a map corner so that, no matter how flow ties resolve, the enemy cell's water height reaches at least k.Hard8Binary searchHeap+2No attempts yet2s128 MBJudgeable
Jinuk's FarmGiven up to 50 axis-aligned square paint operations over an N up to 1000 grid, find the largest square subregion containing no fruit type 0 and at most two distinct fruit types.Hard8Binary searchPrefix sum+1No attempts yet2s128 MBJudgeable
Quiz ShowFor N ordered quiz questions, choose right or wrong answers to maximize score: correct answers earn coins and points, hitting M coins gives a bonus, wrong answers reset coins and cost points.Hard8Dynamic programmingArray+2No attempts yet5s128 MBJudgeable
Word RollingGiven N cyclic letter wheels rotating one step per second, find the earliest time t when all wheels simultaneously display a given target string, using CRT-style reasoning, or report -1.Hard8Number theoryMath+2No attempts yet2s128 MBJudgeable
Balance ScalePlace weights 1..n into two mirror-shaped binary trees filled level by level under BST-like ordering rules so both sides balance in total weight, or report impossible.Hard8TreeSimulation+2No attempts yet1s512 MBJudgeable
Students' Study StylesGiven statements from students of four truthfulness types depending on day or night, determine which facts about identities and time must hold in every consistent scenario.Hard8Brute forceImplementation+1No attempts yet2s128 MBJudgeable
Burger KingSimulate multiple restaurant queues with dynamic employee replacements and arrivals, tracking the optimal switching strategy to find when the team can order.Hard8SimulationGreedy+1No attempts yet2s128 MBJudgeable
Cheap but SimilarGiven a mineral row, decide whether equipment covering 1-3 consecutive cells can be placed to mine at least 75% of the total, and construct a valid placement if so.Hard8GreedyDynamic programming+1No attempts yet7s16 MBJudgeable
Surveillance RobotDetermine every x-axis interval where a robot could stand so that the angular sweep order of chimneys matches a given observed shape sequence.Hard8GeometrySorting+1No attempts yet2s128 MBJudgeable