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,997 problems
TitleLevelTopicsSolvedTime limitMemory limitJudge
Word ProcessorFormat N words into lines of at most K characters using the greedy first-fit rule, then print the result.Easy3SimulationImplementation+2No attempts yet2s512 MBJudgeable
CHROMGiven two parent permutations and two crossover points n and m, build the offspring by keeping parent 1's segment [n, m) in place and filling the rest from parent 2 in order.Easy3ArrayImplementation+2No attempts yet2s512 MBJudgeable
CoffeeFor each person, add the price of their ordered coffee size to a shared delivery fee of floor(100/P), then snap the total to a multiple of 5 only when it is 1 off.Easy3Hash mapImplementation+2No attempts yet1s512 MBJudgeable
Time ZoneGiven a time in Beijing (UTC+8) and a target time zone string, print the corresponding 24-hour clock time.Easy3ImplementationMath+2No attempts yet1s256 MBJudgeable
PolynomialGiven the coefficients and degrees of a polynomial in descending order, evaluate it at x using Horner's method and print the result modulo 1e9+7.Easy3MathImplementation+2No attempts yet1s1024 MBJudgeable
EpidemiologySimulate a disease where each infected person infects R new people the next day, and find the first day the cumulative case count exceeds P.Easy3SimulationMath+1No attempts yet2s512 MBJudgeable
DatesEach input line is a date in day.month.year or month/day/year format; print both formats, validating that the date actually exists.Easy3ImplementationString+2No attempts yet1s512 MBJudgeable
Counting WordsSplit a sentence on spaces and hyphens, then split any token that looks like a French contraction (c', j', n', m', t', s', l', d', qu' followed by a vowel) into two words, and count the total.Easy3StringImplementation+2No attempts yet2s1024 MBJudgeable
Bard ProdigyGiven a poem and per-key press limits, decide whether the poem plus its derived title (first letter of each word, uppercased) can be typed, counting runs of equal keys as one press, and print the title or -1.Easy3StringImplementation+1No attempts yet1s512 MBJudgeable
StickSimulate repeatedly halving and discarding pieces of a 64 cm stick until the remaining pieces sum to X, then count how many pieces are glued together.Medium4Bit manipulationSimulation+1No attempts yet2s128 MBJudgeable
Base ConversionConvert a decimal integer to its digit representation in a given base, which may be negative, without using a minus sign.Medium4MathImplementation+1No attempts yet2s128 MBJudgeable
Digit-Power SequenceFor each N from A to B, repeatedly sum the K-th powers of its digits, detect the eventual cycle, and sum the minimum value reached over all sequences.Medium4SimulationMath+1No attempts yet2s128 MBJudgeable
Line UpReconstruct a line of N people (heights 1..N) given for each height how many taller people stand to its left, using reverse insertion.Medium4ArrayGreedy+1No attempts yet2s128 MBJudgeable
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.Medium4QueueSimulation+1No attempts yet0.15s128 MBJudgeable
Find the FractionGiven an index X, determine which fraction r/c appears at that position when all fractions r/c are enumerated in a zigzag diagonal order.Medium4MathSimulationNo attempts yet0.5s256 MBJudgeable
KickdownGiven two gear strings of 1s and 2s, slide one horizontally to minimize the combined width without any overlapping position having a tooth (2) on both.Medium4StringBrute force+1No attempts yet2s128 MBJudgeable
Pie ChartOrder class percentages around a pie chart to maximize the count of sector boundaries exactly 50% apart, forming diameter lines through the center.Medium4Brute forceCombinatorics+2No attempts yet2s128 MBJudgeable
Temporary Class PresidentGiven each student's class per grade for 5 grades, find the student who shared a class with the most distinct other students, choosing the smallest index on ties.Medium4ArrayBrute force+1No attempts yet2s128 MBJudgeable
Coffee Shop 1Simulate coffee being poured between two jars each cycle and count how many cups Dongho can still taste, printing gg if the count is 0 or over 50.Medium4SimulationMath+1No attempts yet2s128 MBJudgeable
Platform Support PillarsGiven platforms with heights and horizontal spans, compute the total length of vertical support pillars placed slightly inside each platform's ends resting on the floor or a lower platform.Medium4SimulationSorting+2No attempts yet2s128 MBJudgeable
Flammable Railway 997Given fireproof material amounts between train cars and a starting fire location, compute the time step when a target car explodes, or report it never does.Medium4Prefix sumSimulation+2No attempts yet2s128 MBJudgeable
Tournament WinnerGiven all pairwise win probabilities among 8 players in a fixed single-elimination bracket, compute each player's probability of winning the whole tournament.Medium4ProbabilityDynamic programming+2No attempts yet2s128 MBJudgeable
Text EditorSimulate a line editor with cursor movement, character deletion, and insertion commands, printing the final string.Medium4StackSimulation+2No attempts yet0.3s512 MBJudgeable
Candy RotationGiven N cells in a circle, simulate digit-sum-based clockwise moves from every starting cell and find the maximum count of distinct cells visited before a repeat.Medium4SimulationBrute force+1No attempts yet2s128 MBJudgeable
Length of a Repunit MultipleFind the minimum number of digits in a repunit (a number made only of 1s) that is divisible by a given N, or report -1 if none exists.Medium4MathNumber theory+2No attempts yet2s128 MBJudgeable
Magic Square RotationsGiven four fixed permutations that can be applied to an 8-number arrangement, find the minimum number of operations to reach a target arrangement from the initial one via BFS.Medium4BFSSimulation+1No attempts yet2s128 MBJudgeable
CandyGiven the sums of adjacent candy counts for N students seated in an odd-sized circle, recover each student's exact candy count.Medium4MathArray+1No attempts yet2s128 MBJudgeable
Card MagicFind an initial card order so that repeatedly cycling and dealing cards produces the sequence 1 to N on the table.Medium4SimulationQueue+1No attempts yet2s128 MBJudgeable
Stack SequenceDetermine if a target permutation of 1 to n can be produced by a stack pushing values in increasing order, and output the push/pop sequence if possible.Medium4StackSimulation+1No attempts yet2s128 MBJudgeable
Ripple EffectValidate a filled Ripple Effect puzzle grid by checking polyomino region digit ranges and minimum-distance spacing rules for repeated numbers in rows and columns.Medium4Union-findSimulation+1No attempts yet2s128 MBJudgeable
Snail TableFill an N x N grid with numbers 1 to N^2 spiraling outward from the center and report the row and column of a given target number.Medium4SimulationMatrix+1No attempts yet2s128 MBJudgeable
Tetrahedron EquivalenceDecide whether two tetrahedra with colored faces are equal under 3D rotation, given each as a base face plus three side faces in clockwise order.Medium4SimulationImplementation+1No attempts yet2s128 MBJudgeable
Digital ClockGiven three start-end time ranges on a 24-hour clock that may wrap past midnight, count how many seconds have a clock integer (hhmmss with colons removed) divisible by 3.Medium4SimulationMath+1No attempts yet2s128 MBJudgeable
Matchstick GridGiven an ASCII 3x3 matchstick grid, count how many matchsticks were removed and how many complete squares of any size remain.Medium4SimulationImplementation+1No attempts yet2s128 MBJudgeable
Infinite Binary TreeGiven target pair (A,B) reachable in an infinite binary tree defined by additive child rules, count the left and right moves needed via a Euclidean-like reverse process.Medium4MathNumber theory+1No attempts yet1s128 MBJudgeable
Transaction Limit CheckingParse bank customer, account, and transaction records to validate ownership and per-day, per-type transaction and exposure limits, printing a result per instruction.Medium4Hash mapSimulation+1No attempts yet1s128 MBJudgeable
Cipher DecryptionGiven a key and ciphertext produced by a columnar transposition cipher, reconstruct the original plaintext.Medium4StringSimulation+1No attempts yet2s128 MBJudgeable
Robot SimulationSimulate robots moving on a grid according to turn and move commands and report the first wall or robot collision, or OK if none occurs.Medium4SimulationImplementationNo attempts yet2s128 MBJudgeable
Popping BalloonsSimulate popping balloons arranged in a circle, moving left or right by the value on each popped balloon among remaining balloons.Medium4SimulationLinked list+1No attempts yet2s4 MBJudgeable
Shuffle SequenceGiven a permutation of size N, compute the least common multiple of its cycle lengths, which is the number of shuffles needed to restore the original order.Medium4MathArray+1No attempts yet1s128 MBJudgeable
Colored Paper PerimeterGiven up to 100 axis-aligned 10x10 black squares on a 100x100 grid, compute the total perimeter of their union.Medium4MatrixSimulation+1No attempts yet1s128 MBJudgeable
Finding RegionsGiven a grid with several rectangles marked as blocked, find the number of connected empty regions and output their areas sorted ascending.Medium4BFSArray+1No attempts yet1s128 MBJudgeable
OmokGiven a 19x19 Omok board, detect whether black or white has an exact five-in-a-row (not six or more) and output the winning color and the starting coordinate of that line.Medium4MatrixSimulation+1No attempts yet1s128 MBJudgeable
Drawing PolygonsGiven a reference closed-path digit sequence tracing a polygon, find which candidate sequences represent the same polygon allowing rotation of starting point and direction reversal but not geometric rotation or reflection.Medium4String matchingString+1No attempts yet1s128 MBJudgeable
Clock Card RankGiven four clockwise digits on a card, compute the minimal rotation (clock number) and find its rank among all distinct clock numbers from digits 1-9.Medium4Brute forceSimulation+1No attempts yet1s128 MBJudgeable
FaxImplement run-length encoding with specific bit-packed run and literal prefix formats, splitting long runs and literal blocks according to size limits.Medium4SimulationString+2No attempts yet1s128 MBJudgeable
Polycube Surface AreaValidate that unit cubes placed in a given order always connect by a face to a prior cube starting at the origin, then output the polycube's surface area or the index of the first invalid cube.Medium4SimulationHash map+1No attempts yet1s128 MBJudgeable
Kyuhyun's Secret Text MessageConvert each character to a 5-bit code, fill an R by C matrix in clockwise spiral order with the concatenated bits (padding with zeros), then print the matrix read row by row.Medium4MatrixSimulation+1No attempts yet1s128 MBJudgeable
Chip Stack ShuffleSimulate repeated riffle shuffles of two chip stacks and find the minimum number of shuffles to reach a target stack, or report -1.Medium4SimulationStringNo attempts yet1s128 MBJudgeable
Brainf*ck InterpreterImplement a Brainfsck interpreter that parses a program per test case, checks bracket matching, and executes it printing output or a compile error.Medium4StackSimulation+1No attempts yet1s128 MBJudgeable
Stacking DrumsGiven bottom-row circle centers of drums stacked pyramid-style each resting on two below, compute the final top drum's center coordinates.Medium4GeometrySimulation+1No attempts yet1s128 MBJudgeable
Pancake FlippingSort a stack of N distinct pancakes into increasing order from top using prefix reversals, within a bound of 2N-3 flips.Medium4GreedySimulation+1No attempts yet1s128 MBJudgeable
Candy Sharing GameSimulate a circle of students repeatedly halving and passing candies right, rounding odd counts up, until all counts equalize, then report the round count and final value.Medium4SimulationArrayNo attempts yet1s128 MBJudgeable
ALPS-Style VotingSimulate a D'Hondt-style seat allocation: filter staff by a 5% vote threshold, generate divided scores, pick the top 14, and count chips per staff sorted by name.Medium4SimulationSorting+1No attempts yet1s128 MBJudgeable
When Homework Feels ImpossibleSimulate a die rolling boustrophedon-style across an R by C grid and sum the top face values recorded at each visited cell.Medium4SimulationMath+1No attempts yet1s128 MBJudgeable
Apple Catching GameMove a fixed-size basket left or right along N cells to catch a sequence of falling apples with minimum total movement distance.Medium4Dynamic programmingGreedy+1No attempts yet1s128 MBJudgeable
Box SortingSort an array into increasing order using the minimum number of cyclic-rotation commands, following a specified cycle-decomposition construction.Medium4ArraySimulation+1No attempts yet1s128 MBJudgeable
Basketball Lead TimeGiven timestamped scoring events over a 48 minute game, compute the total time each team held the lead.Medium4SimulationSorting+1No attempts yet1s128 MBJudgeable
Kayaks and the Strong WindGiven broken and spare-carrying teams in a line, assign each spare kayak to an adjacent broken team to minimize the number of teams left unable to start.Medium4GreedyBrute force+1No attempts yet1s128 MBJudgeable
Solve Sudoku by Cross-HatchingSimulate repeated Sudoku cross-hatching (single-candidate-per-box scan) on a given grid, filling cells until no more moves apply, and detect rule violations or contradictions.Medium4SimulationMatrix+1No attempts yet1s128 MBJudgeable
Infinite Binary Tree TraversalGiven a string of L/R/P/* moves in an infinite binary tree, sum the node values over all traversals from expanding each '*' into L, R, or P.Medium4MathString+1No attempts yet1s128 MBJudgeable
Three KangaroosGiven three sorted integer positions, compute the maximum number of jumps where an outer point can move to any free integer strictly between the other two.Medium4MathGreedy+1No attempts yet1s128 MBJudgeable
Peg Move CountGiven a 7-line cross-shaped peg board, count how many single peg-jump moves are currently legal.Medium4SimulationMatrix+1No attempts yet1s128 MBJudgeable
CampfireSimulate campfire nights where Sunyoung's presence introduces a new song and other nights merge attendees' known songs, then output everyone who ends up knowing all songs.Medium4SimulationHash map+1No attempts yet1s128 MBJudgeable
AntsSimulate two colliding groups of ants swapping adjacent opposite-direction ants each second and output the arrangement after T seconds.Medium4SimulationArrayNo attempts yet1s128 MBJudgeable
Greedy PigsSimulate a circular 6-pig feeding process where each pig's next demand is the sum of 4 previous values, and find the first day the total demand exceeds the fixed daily feed supply N.Medium4SimulationMathNo attempts yet1s128 MBJudgeable
Candy GameGiven a colored N×N grid, determine the longest same-color run achievable in any row or column after performing exactly one swap of two adjacent different-colored cells.Medium4SimulationBrute force+1No attempts yet1s128 MBJudgeable
Rabbit MovementSimulate a rabbit walking on an N×N zigzag-diagonal numbered grid following given moves and sum all visited cell values.Medium4MatrixSimulation+1No attempts yet1s128 MBJudgeable
Woncheol's RebellionSimulate a grid walker's rotations and moves, then find the minimum distance to a target by optionally changing one command to another direction.Medium4SimulationGeometry+1No attempts yet1s128 MBJudgeable
Remaining Letters in a Word SearchGiven a letter grid and a word list, find every 8-direction occurrence of each word, cross out those letters, and print the remaining letters in row-major order.Medium4MatrixString matching+2No attempts yet1s128 MBJudgeable
Election WinnersGiven M ranked ballots over N candidates, compute pairwise head-to-head wins to find the candidate(s) with the highest number of defeated opponents.Medium4SimulationMath+1No attempts yet1s128 MBJudgeable
SheepUse flood fill to split a grid into fenced regions, then for each region compare sheep and wolf counts to decide survivors, ignoring regions touching the border.Medium4BFSGraph+1No attempts yet1s128 MBJudgeable
Quiz HintsGenerate three progressive hint strings for a text answer by masking letters with dots and revealing them in stages based on rounded fractional counts.Medium4StringSimulation+1No attempts yet1s128 MBJudgeable
Urinal Flush ScheduleSimulate a sensor log to detect when a urinal usage streak of K seconds is followed by an absence streak of L seconds, printing each flush time or NIKAD.Medium4SimulationString+1No attempts yet1s128 MBJudgeable
Kkung the ShepherdUsing grid flood-fill to find fenced regions, determine for each region whether sheep or wolves survive by comparing counts, then output totals.Medium4BFSArray+1No attempts yet1s128 MBJudgeable
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.Medium4SimulationQueue+1No attempts yet1s128 MBJudgeable
Race RankingSimulate M checkpoint messages in order, keep only valid sequential checkpoint passes per driver, and print final ranking by progress and recency.Medium4SimulationImplementation+1No attempts yet1s128 MBJudgeable
Programming Language ZParse and simulate a tiny toy language with variable assignments, nested REPEAT loops, and PRINT statements, applying mod-10000 arithmetic.Medium4SimulationImplementation+1No attempts yet2s128 MBJudgeable
DownloadGiven download times and playback durations of sequential song pieces, compute the earliest start time so playback never stalls waiting for a piece.Medium4GreedyPrefix sum+1No attempts yet1s128 MBJudgeable
MOSimulate an alternating stone-placing game on a 1D board where placing a stone can capture an enclosed run of opponent stones, then count remaining stones of each color.Medium4SimulationArray+1No attempts yet1s128 MBJudgeable
Who Wins Gold, Silver, and Bronze?Given each athlete's live rank as they finish two sequential races, reconstruct final standings from the second race and output the top three athlete numbers.Medium4SimulationArray+1No attempts yet1s128 MBJudgeable
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.Medium4QueueSimulation+1No attempts yet1s128 MBJudgeable
SpiesSimulate a walk on a grid and report which given spy coordinates ever fall within Chebyshev distance 1 of the walker's path.Medium4SimulationArrayNo attempts yet1s128 MBJudgeable
SearchTrack all reachable cells on a grid as a car moves in given directions by at least one free cell each step, then mark final possible positions.Medium4SimulationArray+1No attempts yet1s128 MBJudgeable
CountriesFor each city, compute which other city exerts the strongest gravity-like influence on it, then label it king, democracy, or trace the chain of surrender to find its ultimate capital.Medium4SimulationMath+1No attempts yet1s128 MBJudgeable
Calculator GameGiven K up to 999, find the smallest multiple of K whose decimal digits are all identical, printing the digit and its count or 'Impossible'.Medium4MathBrute force+1No attempts yet1s128 MBJudgeable
Weird NumbersConvert numbers between decimal and a given negative base representation, in both directions, for multiple queries until an end marker.Medium4MathImplementation+1No attempts yet1s128 MBJudgeable
Homo or Hetero?Maintain a list under insert and delete-first-occurrence operations and classify it after each step as homogeneous, heterogeneous, both, or neither.Medium4Hash mapImplementation+1No attempts yet3s256 MBJudgeable
iSharpParse a C-like multi-variable type declaration with pointer, reference, and array symbols, then print each variable on its own line with its symbols moved to the front in reversed order.Medium4StringImplementation+1No attempts yet1s128 MBJudgeable
Access Control ListsParse an ordered ACL of allow/deny IP network rules and, for each query IP, output whether the first matching rule grants or denies access.Medium4Bit manipulationString+2No attempts yet3s256 MBJudgeable
The Bird TreeGiven a reduced fraction, reconstruct its path of L/R moves in the Stern-Brocot style Bird tree using a Euclidean-like process.Medium4MathGreedy+1No attempts yet1s128 MBJudgeable
Movie CollectionGiven a stack of DVDs and a sequence of watched movie numbers, output for each watch how many DVDs sat above it before moving it to the top.Medium4ArraySimulation+1No attempts yet1s256 MBJudgeable
Parking BuildingSimulate an elevator and rotating conveyor belts to compute total retrieval time for cars fetched in customer order.Medium4SimulationImplementation+1No attempts yet1s128 MBJudgeable
Leonardo's NotebookDetermine whether a given permutation of the alphabet can be expressed as some permutation applied twice (its functional square).Medium4MathCombinatorics+1No attempts yet1s128 MBJudgeable
LaserboxSimulate a laser beam bouncing off right-turning mirrors on a grid until it exits the board or loops forever.Medium4SimulationImplementationNo attempts yet1s128 MBJudgeable
TableGiven an N by M table, compute each column's product and output the column index (largest index on tie) with the maximum product, handling big products across up to 1000 rows.Medium4MathSimulation+1No attempts yet1s128 MBJudgeable
KCPCFrom a submission log, compute each team's best-per-problem total score, break ties by submission count then last submission time, and output a given team's rank.Medium4SimulationHash map+1No attempts yet1s128 MBJudgeable
ManagerSimulate a priority-based queue manager that adds costs, removes min or max cost per current policy, and prints results only for specified removal request indices.Medium4HeapSimulation+1No attempts yet1s128 MBJudgeable
Peer ReviewGiven each author's institution and their K assigned papers to review, count how many papers violate review-count, self-review, collaborator, or duplicate-review rules.Medium4Hash mapSimulation+1No attempts yet1s128 MBJudgeable
Condorcet ParadoxGiven b ranked ballots over c candidates, find the candidate who beats every other candidate head to head on more than half the ballots.Medium4ArraySimulation+2No attempts yet5s128 MBJudgeable