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
World's Worst Bus ScheduleGiven each bus's repeating route durations and your arrival time, compute how long you wait for the next bus to reach the station.Easy3SimulationMathNo attempts yet1s128 MBJudgeable
Frogger's For DinnerSimulate a frog walking down a 10 by 10 road while cars wrap around their lanes and decide if any starting column reaches the far side alive.Easy3SimulationBrute force+1No attempts yet1s128 MBJudgeable
Reordering the CowsGiven the current and target cow orders, count the permutation cycles longer than one and report the longest cycle length.Easy3ArraySimulationNo attempts yet1s128 MBJudgeable
Seat AssignmentFind the (x, y) seat of the K-th person placed in a clockwise inward spiral from the bottom-left corner of a C by R grid, or print 0 when K exceeds capacity.Easy3SimulationNo attempts yet1s256 MBJudgeable
Colored PaperCompute the area of each of N overlapping axis-aligned rectangles that stays visible after later rectangles cover it.Easy3SimulationMatrix+1No attempts yet1s64 MBJudgeable
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.Easy3SimulationQueueNo attempts yet1s256 MBJudgeable
Underwater TripSimulate each steering sequence through the tunnel and report whether it reaches the end or crashes into the ceiling, floor, or a stalagmite.Easy3SimulationImplementationNo attempts yet1s256 MBJudgeable
Theseus and the MinotaurWalk each path on the grid, toggle every used corridor, and answer Yes when no corridor stays unwound.Easy3SimulationHash mapNo attempts yet1s256 MBJudgeable
The Trojan HorseMark all cells visited by patrol routes on an h by w grid, then count 4-connected unvisited regions with at least s cells.Easy3DFSSimulation+1No attempts yet1s256 MBJudgeable
MemoryPlay Memory with 50 face-down cards (25 letter pairs) by calling faceup(C); find each matching pair so Jack collects all 25 candies.Easy3SimulationImplementation+2No attempts yet1s256 MBJudgeable
Chain Disappearance PuzzleRepeatedly remove horizontal runs of three or more equal digits from a 5-column board, drop stones above into gaps, and sum the removed digits.Easy3SimulationMatrix+1No attempts yet1s256 MBJudgeable
HenryRun the greedy unit-fraction expansion of each given fraction and print its last denominator.Easy3GreedyMath+1No attempts yet1s256 MBJudgeable
Spiral Area DivisionGiven up to 100 points in an 80 by 80 square cut into 15 labeled pieces by alternating 3-to-1 splits, output the label containing each point.Easy3GeometrySimulation+1No attempts yet1s64 MBJudgeable
Fun HouseTrace a beam from the entry through slash mirrors on a grid and mark the first wall it reaches as the exit.Easy3SimulationNo attempts yet1s256 MBJudgeable
Word CloudCompute each word font size from its count, pack words in order into rows of width W, and output the summed row heights.Easy3SimulationMathNo attempts yet1s256 MBJudgeable
Pantun GraderScore the first four verses of each pantun on syllable count, rhyme pairs and matching lengths, then subtract penalties for extra verses.Easy3StringImplementation+1No attempts yet1s256 MBJudgeable
Line Up Back StepsYou simulate the lineup rule for 20 students arriving in a given order and count the total backward steps.Easy3SimulationBrute forceNo attempts yet1s256 MBJudgeable
Happy PrimeDecide whether each given number is both prime and happy under repeated digit-square sums, and print the result with its case number.Easy3SimulationHash map+1No attempts yet1s256 MBJudgeable
Algorist ClubThe program gives each unfamiliar pair in input order the lowest free of max-degree-plus-one slots and prints zeros when a pair fits nowhere.Easy3SimulationGraphNo attempts yet1s256 MBJudgeable
Rolling EncryptionEncrypt a lowercase string by leaving the first k letters unchanged and shifting each later letter by the most frequent of the k original letters before it.Easy3Sliding windowArray+1No attempts yet1s256 MBJudgeable
Cross FlipFind the fewest cross-shaped clicks that turn an all-white 3x3 board into each given target pattern.Easy3Brute forceSimulationNo attempts yet1s256 MBJudgeable
Refueling StopsSimulate the farthest-reachable greedy rule over ordered stations to list minimum refuel stops or report running out of petrol.Easy3GreedySimulationNo attempts yet1s256 MBJudgeable
Hyacinth frequency assignmentAssign one frequency to each edge of a tree by the stated DFS rule so each node uses at most two frequencies.Easy3TreeDFS+1No attempts yet1s256 MBJudgeable
DOM TV ChannelsPensioners switch the TV from each hated channel to the youngest hater's favorite, and you count switches until the channel stabilizes or repeats.Easy3GraphSimulationNo attempts yet1s256 MBJudgeable
Skyscraper SilhouetteRebuild the skyline picture from N ground-based rectangles, mark the border cells, and report the perimeter without the ground side.Easy3SimulationArray+1No attempts yet1s32 MBJudgeable
Knockout RacingCount the cars whose back-and-forth motion between two points puts them inside each queried interval at the given time.Easy3SimulationMathNo attempts yet1s256 MBJudgeable
Ideal ScoreboardTrack contest solves in time order and report the interval during which every team and every problem has a solve but none has all.Easy3SimulationSortingNo attempts yet2s256 MBJudgeable
A Population of RabbitsCount rabbit pairs alive in month M given lifespan D and breeding ages up to R, starting from one newborn pair.Easy3Dynamic programmingSimulationNo attempts yet1s256 MBJudgeable
MeteorShift the connected meteor cells straight down until they rest on the ground and print the final grid.Easy3SimulationMatrix+1No attempts yet1s256 MBJudgeable
Big Integer AdditionAdd two decimal integers with up to 100000 digits given on one line and print their exact sum.Easy3StringSimulationNo attempts yet1s256 MBJudgeable
Milling machinesThe program cuts each workpiece column down to the lowest cutter height from any step and prints the heights that remain.Easy3SimulationImplementationNo attempts yet2s256 MBJudgeable
Simple ArithmeticEvaluate single-digit expressions with usual precedence and floor division, printing WRONG INPUT for bad forms or division by zero.Easy3StackSimulation+1No attempts yet1s128 MBJudgeable
Short PhraseFind the earliest starting word of a contiguous block whose words split into five groups totaling 5, 7, 5, 7, and 7 letters.Easy3SimulationBrute forceNo attempts yet1s256 MBJudgeable
Palindrome in Some BaseFor each N, decide whether its base B representation is a palindrome for some B from 2 to 64.Easy3MathBrute force+1No attempts yet1s256 MBJudgeable
Abandon ShipProcess each damage report in order and print the recalibrate, invert, divert, or abandon ship order for its category.Easy3SimulationHash mapNo attempts yet1s256 MBJudgeable
Battle SheepSimulate Alice and Bob's preplanned Battleship shots, granting another turn after each sinking, and list the sunk ships in order and the winner.Easy3SimulationImplementationNo attempts yet1s256 MBJudgeable
Choosing Pizza ToppingsSimulate the given repair loop that flips one unfulfilled topping of the first unhappy friend until every friend has more than a third of wishes met.Easy3SimulationImplementation+1No attempts yet1s256 MBJudgeable
Hydraulic ArmDecide whether each given box sequence can reach the right belt in increasing height using one shelf as a stack.Easy3StackSimulationNo attempts yet1s256 MBJudgeable
Dyeing DiceSimulate the die rolling along the given path, dye each bottom face on painted squares, and output the six face colors or zeros on failure.Easy3SimulationImplementationNo attempts yet1s256 MBJudgeable
Waiting for ChangeSimulate book sales across two queues with limited five-dollar change and report line B at its longest moment.Easy3SimulationQueueNo attempts yet1s256 MBJudgeable
Folding a Paper StripeSimulate the K given half-folds of a 2^K-cell stripe and print the cell numbers from top to bottom.Easy3SimulationArrayNo attempts yet1s256 MBJudgeable
NimioneseEach word is rewritten by mapping its first letter to the nearest hard consonant, copying it over later hard consonants, and adding a vowel if it ends in one.Easy3StringSimulationNo attempts yet1s256 MBJudgeable
ACM Contest ScoringProcess the team's submission log in order and report the number of solved problems and the total penalty including 20 minutes per prior wrong attempt.Easy3SimulationHash mapNo attempts yet1s256 MBJudgeable
The Game of DeathStarting from player 1, follow the pointed-to players and report the first step that reaches player N, or 0 when it never does.Easy3GraphSimulationNo attempts yet1s256 MBJudgeable
FootprintsCount distinct grid cells visited when walking L steps from the origin following N, S, E, and W commands.Easy3SimulationHash mapNo attempts yet2s256 MBJudgeable
Chicken Top NPrint the row after one bottom-up merge sort stage by merging each pair of sorted groups of length N/(2k) into one sorted group of length N/k.Easy3SimulationSortingNo attempts yet5s256 MBJudgeable
BlurBlur a binary image up to nine times with a wrapping 3 by 3 average and count how many distinct gray values remain.Easy3SimulationMatrix+1No attempts yet2s256 MBJudgeable
Shuffling AlongGiven a deck size and shuffle type, count how many repeated perfect shuffles restore the original order.Easy3SimulationMathNo attempts yet1s256 MBJudgeable
What's on the Grille?Recover the original grid message from the encrypted letters by rotating the grille, or report that the grille is invalid.Easy3SimulationMatrixNo attempts yet1s256 MBJudgeable
Document signaturesSchedule N officials in fixed order on their accepted weekdays to minimize the total days from the first Monday.Easy3GreedySimulationNo attempts yet1s256 MBJudgeable
ColliderMove the particle at position i to position j on each exposure and report the particle type at position k for each query.Easy3ArraySimulationNo attempts yet2s256 MBJudgeable
Josephus PermutationRemove every Kth person from a circle of N people and print the removal order in angle brackets.Easy3QueueSimulationNo attempts yet2s512 MBJudgeable
Forest FruitsChoose a starting fruit, then walk forward eating each fruit that still fits within capacity C, and report the largest count.Easy3SimulationBrute forceNo attempts yet1s64 MBJudgeable
ACM-ICPC ScoreboardReplay the judging log to count each team's solved problems and penalty time, then print all teams in rank order.Easy3SimulationSortingNo attempts yet1s128 MBJudgeable
Pretty printing arraysReprint the given brace array so each word and brace sits on its own line with two-space indent per nesting level.Easy3StackSimulationNo attempts yet1s64 MBJudgeable
Contaminated MilkFrom drink and sickness logs, keep each milk every sick person drank before falling sick and report the largest drinker count.Easy3SimulationBrute forceNo attempts yet2s512 MBJudgeable
Angry Cows (Bronze)Starting from the best bale, count how many bales explode as the blast radius grows by one each step.Easy3SimulationSortingNo attempts yet2s512 MBJudgeable
Mowing the FieldSimulate the grid walk and report the smallest time gap between two visits to the same cell, or -1 when no cell repeats.Easy3SimulationHash mapNo attempts yet2s512 MBJudgeable
Bull in a China Shop (Bronze)Pick the two pieces from K candidates that shift without rotation to cover the original grid exactly once.Easy3Brute forceSimulationNo attempts yet2s512 MBJudgeable
gRanks (Small)Rank every athlete by summing only their M highest weighted place points, breaking ties alphabetically with skipped ranks.Easy3SortingHash map+1No attempts yet5s512 MBJudgeable
Googol String (Small)Build the recursive 0/1 string defined by S with a middle 0 plus a switched reversal, then answer the Kth character for each test case.Easy3RecursionSimulationNo attempts yet5s512 MBJudgeable
Crane Truck (Small)Run each crane program on 240 circular cells with wrapping crate counts and count the truck's forward and backward moves.Easy3SimulationImplementationNo attempts yet10s512 MBJudgeable
Mushroom Monster (Small)Given plate counts at 10-second intervals, compute the minimum eaten under free eating and under a constant eating rate.Easy3SimulationGreedyNo attempts yet5s512 MBJudgeable
One move captures (small)Count all ordered pairs of chess pieces where one can capture the other in a single legal move with blocking.Easy3SimulationBrute forceNo attempts yet5s512 MBJudgeable
Captures in One MoveCount ordered capture pairs on an 8x8 board by applying each chess piece's capture rules with blocking for sliders.Easy3SimulationImplementationNo attempts yet5s512 MBJudgeable
Super 2048 (Small)The program slides all tiles of an N by N 2048 board one move in the given direction, merging equal pairs once with leading tiles first.Easy3SimulationMatrixNo attempts yet5s512 MBJudgeable
Super 2048 (Large)Slide every tile on an N by N 2048 board in the given direction, merging equal neighbours once per move.Easy3SimulationMatrixNo attempts yet5s512 MBJudgeable
Cross the maze (Small)Simulate the left-hand wall-following robot for up to 10000 steps and report whether it reaches the exit with its path.Easy3SimulationNo attempts yet5s512 MBJudgeable
Cross the maze (large)Simulate a left-hand wall-following robot in an N by N maze for up to 10000 steps and print the step count and path if it reaches the exit.Easy3SimulationMatrixNo attempts yet5s512 MBJudgeable
Hedgemony (Large)Simulate one left-to-right pass that trims each bush to the average of its neighbors when taller, then report the final height of bush N-1 with six decimals.Easy3SimulationMathNo attempts yet5s512 MBJudgeable
Aerobics Mat PlacementPlace disc centers row by row with the given greedy rule along the longer side of the mat and print the coordinates.Easy3SimulationGreedyNo attempts yet5s512 MBJudgeable
Aerobics (Large)Sort students by reach, largest first, then place them line by line on the mat following the prescribed packing rule.Easy3SimulationSortingNo attempts yet5s512 MBJudgeable
Commute War (Small)Walk the single chain of hourly rides from home to the office, adding each wait, ride time, and geometric checkpoint delay for the expected arrival time.Easy3ProbabilitySimulation+1No attempts yet5s512 MBJudgeable
New Calendar (Small)Given months per year, days per month and days per week, count calendar rows when each month starts after the previous month and never shares a row.Easy3SimulationMathNo attempts yet5s512 MBJudgeable
Snapper Chain (Small)Decide whether N chained toggle switches all turn on after K snaps, which lights the bulb.Easy3Bit manipulationSimulationNo attempts yet5s512 MBJudgeable
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.Easy3SimulationQueueNo attempts yet5s512 MBJudgeable
Perpetual Motion (Small)Count assignments of a direction to each oriented belt on a grid of at most 4 by 4 so no two lemmings land on the same square, modulo 1000003.Easy3Brute forceSimulationNo attempts yet5s512 MBJudgeable
Ratings Percentage IndexGiven the win-loss matrix of every team, compute each team's RPI from win percentages and opponents' averages and print each as a reduced fraction.Easy3SimulationMath+1No attempts yet5s512 MBJudgeable
RPI (Large)Compute every team RPI rating from the win-loss schedule using own, opponents, and opponents-of-opponents win rates.Easy3SimulationMathNo attempts yet5s512 MBJudgeable
Button-Pressing RobotsTwo robots walk through separate hallways in parallel and press one shared ordered list of buttons in the shortest total time.Easy3SimulationGreedyNo attempts yet5s512 MBJudgeable
Two Button-Pressing RobotsTwo robots starting at button 1 share one ordered press sequence and move or press each second, so compute the minimum time to finish it.Easy3SimulationGreedyNo attempts yet5s512 MBJudgeable
Magicka (Small)Simulate invocations in order, combining the last two list elements when a rule matches and clearing the whole list when opposed elements meet.Easy3SimulationStackNo attempts yet5s512 MBJudgeable
Magicka Element CombiningInvoke each base element in order, merging the last two entries when they combine and clearing the list when opposed elements meet, then report the final list.Easy3SimulationStackNo attempts yet5s512 MBJudgeable
Rotate the BoardRotate the board 90 degrees clockwise, let every piece fall to the lowest empty cell, then report whether Red, Blue, both, or neither has K in a row.Easy3SimulationMatrix+1No attempts yet5s512 MBJudgeable
Board RotationRotate each board 90 degrees clockwise, let gravity settle the pieces, then report whether Red, Blue, both, or neither has K in a row.Easy3SimulationMatrix+1No attempts yet5s512 MBJudgeable
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.Easy3SimulationQueueNo attempts yet5s512 MBJudgeable
T9 SpellingGiven messages, output the keypad press sequences that type them, inserting a space between consecutive presses on the same key.Easy3StringImplementation+2No attempts yet5s512 MBJudgeable
Ping Pong Balls (Small)Given two fixed displacement vectors, simulate the chain reaction from one starting trap and count how many distinct traps fire.Easy3SimulationBFS+2No attempts yet5s512 MBJudgeable
Coin mazeFor each n, m, k, print either a hardcoded special maze for the two given triples or a wall-free grid with the base at (1,1) and coins in row-major order.Easy3ImplementationSimulation+2No attempts yet1s512 MBJudgeable
The Fancy TavernTwo cards hit each other simultaneously until at least one dies; decide which card survives.Easy3SimulationMathNo attempts yet1s128 MBJudgeable
Tic! Tac! Toe!Given the first player and the nine moves in order, report the player who first completes a row, column, or diagonal, or 0 for a draw.Easy3SimulationImplementation+1No attempts yet1s128 MBJudgeable
Who is the final winner?Each of N players holds M cards; every round all players play their largest remaining card and whoever plays the highest value scores a point. Report the player(s) with the most points.Easy3SortingSimulation+2No attempts yet1s128 MBJudgeable
Peter and the TextbookSimulate a textbook where tearing out page i also removes page n-i+1, and answer which page sits at position p among the pages still present.Easy3SimulationImplementation+1No attempts yet2s256 MBJudgeable
Hongjun likes FFTGenerate permutations a and b with the given pseudocode, then compute c[i] = max over valid j of a[j]*b[i-j].Easy3ArraySimulation+1No attempts yet2s512 MBJudgeable
Dance on the CircleSimulate N men dancing around a circle of N women through rotation moves and adjacent swaps, then report which man faces each woman at the end.Easy3SimulationImplementation+1No attempts yet2s512 MBJudgeable
Star Pattern 23Infer the star-printing rule from the sample output and reproduce the pattern for a given N between 2 and 100.Easy3ImplementationSimulation+2No attempts yet2s512 MBJudgeable
Mountains Beyond MountainsGiven column heights, a highway row, and pier rules, print the N by M picture of rock, tunnel, bridge, and pier cells exactly as specified.Easy3SimulationImplementation+1No attempts yet1s64 MBJudgeable
Router 1Print either a star-shaped router with one internal hub or a fully connected bipartite router, depending on whether N*N exceeds P_lim.Easy3GraphImplementation+1No attempts yet2s512 MBJudgeable
Router 3Build a router with g groups per layer by printing 2Ng directed edges from inputs to internal nodes and from internal nodes to outputs.Easy3GraphImplementation+2No attempts yet2s512 MBJudgeable
Badminton Match ScoreGiven a rally-by-rally scoring string, replay a best-of-three badminton match and print each completed game's score plus the match winner.Easy3SimulationString+1No attempts yet1s64 MBJudgeable