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 results1,802 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Box PackingGiven box sizes in order, find the longest subsequence where each box is strictly smaller than the next, counting boxes in the pile. | Medium4 | Dynamic programmingBinary search+2 | No attempts yet | 2s | 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 |
| Stretch Rope (Small)N is at most 10, so enumerate subsets of bands and find the cheapest subset whose summed intervals contain L and whose total price is within M. | Medium4 | Brute forceArray+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Hoof, Paper, Scissors (Silver)Given FJ's sequence of N gestures, find the most games Bessie can win if she switches her own gesture at most once. | Medium4 | Prefix sumBrute force+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Cow TippingGiven an N by N grid of 0s and 1s, find the minimum number of upper-left rectangles to toggle so all cells become 0. | Medium4 | GreedyArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Why Did the Cow Cross the Road IIGiven a 52-character string where each of the 26 letters appears twice, count pairs of letters whose chord crossings force their paths to intersect. | Medium4 | ArrayImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Point CardGiven M cards with A wins out of 2N cells, pay 1 yen per flipped stamp to make at least M-1 cards hold N or more wins; minimize total cost. | Medium4 | GreedySorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Ingenious Lottery TicketsCount how often each number 1 to 49 appears across n lottery entries, then pick the six most frequent, breaking ties by favoring 7 and then smaller numbers. | Medium4 | SortingArray | No attempts yet | 2s | 512 MB | Judgeable |
| Wookje Is a Devoted Son!!Given edge costs of a cycle of n villages, find the minimum total cost for three travelers starting at one village to collectively visit every village. | Medium4 | GreedyImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Rolling a DiceRoll a dice on an N by M grid, updating the cell under it and the dice faces each move, and print the top face after every successful move. | Medium4 | SimulationImplementation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Robot Vacuum CleanerSimulate a robot vacuum that cleans cells, rotating counterclockwise and moving forward or backward, and count how many cells it cleans before stopping. | Medium4 | SimulationImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Tofu GameSimulate the tofu game: each shouted block number selects the next reference, and print which person holds it, stopping at the terminal value. | Medium4 | SimulationImplementation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Club Room Project (Large)For each action, remove all walls between rooms x and y; print how many connected room blocks remain. | Medium4 | Union-findArray | No attempts yet | 1s | 512 MB | Judgeable |
| Wookje's Dinner WheelGiven a sequence where each menu number appears exactly twice, find the maximum number of values seen once but not yet seen twice at any point. | Medium4 | ArrayHash map+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Juno hates birds!!Given an n by m grid of numbers, remove the row or column containing the most digit 9s (ties broken by scanning order) and count the remaining 9s. | Medium4 | ArrayImplementation | No attempts yet | 2s | 256 MB | Judgeable |
| A Taste of QueriesGiven a sequence of n numbers, process q queries that either report a range sum and then swap two positions, or report one range sum minus another. | Medium4 | ArrayPrefix sum+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Stephen QuerySimulate N rounds of survival rock paper scissors and report the longest number of consecutive wins by any single player. | Medium4 | SimulationImplementation+1 | No attempts yet | 2s | 256 MB | Judgeable |
| The TA is a sadist!!Given a permutation of 1 to N, find the minimum number of elements to remove so the remaining values increase from front to back. | Medium4 | Dynamic programmingBinary search+2 | No attempts yet | 2s | 256 MB | Judgeable |
| STOP USING MONEYSort N games by satisfaction-to-price ratio, then by lower price, then by game number, and print the first K game numbers. | Medium4 | SortingMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| The Seven WarlordsGiven up to ten million student grades, output the seven lowest grades in increasing order, one per line. Ties on the cut line still yield exactly seven grades. | Medium4 | SortingHeap+2 | No attempts yet | 10s | 256 MB | Judgeable |
| Venue Rental (Small)Given up to 100 axis-aligned rectangles, find the area of the union of all rectangles. | Medium4 | ArrayImplementation+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Pizza BoxesGiven a grid of distinct pile heights, find how many boxes can be removed while keeping the per-row and per-column maxima unchanged. | Medium4 | ArrayGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| GearsSimulate K gear turns; each turn makes a named gear rotate and may propagate to neighbors when the touching poles differ, then print a weighted score from the four top teeth. | Medium4 | ImplementationSimulation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Sum of all pairwise productsGiven n integers, compute the sum of x_a * x_b over all pairs with a < b. | Medium4 | MathPrefix sum+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sogang GroundGiven a weighted undirected graph, find a region whose total item count within distance m is largest. | Medium4 | GraphShortest path+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Taro's ShoppingGiven item prices and a budget, find the largest sum of two distinct items that does not exceed the budget. | Medium4 | Two pointersSorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Forest PictureDraw an ASCII forest on an M by M canvas from tree or stump coordinates, clipping shapes that fall outside and framing the result with asterisks. | Medium4 | ImplementationSimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Dark Ride with MonstersGiven a permutation of misplaced monsters, find the minimum number of swaps needed to sort all monsters into their correct chambers. | Medium4 | ArrayGraph+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Complete Naebbirac's sequenceGiven a multiset of values 1..K, find the single add, remove, or replace operation that makes every value appear equally often. | Medium4 | ArrayHash map+1 | No attempts yet | 1s | 1024 MB | Judgeable |
| Byte Me!Given N data bytes and a parity byte, find the parity type, the one data byte with wrong popcount parity, and the flipped bit position. | Medium4 | Bit manipulationImplementation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Wet Rock Peg PlanSimulate a sequence of peg placements and removals on a dependency DAG, tracking peak peg count and the first wet-rule violation. | Medium4 | SimulationGraph+2 | 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 |
| Frosh WeekGiven task durations and quiet-interval lengths, each between 100000 and 199999, pair tasks with intervals that fit them and maximize the number of completed tasks. | Medium4 | GreedyTwo pointers+2 | No attempts yet | 4s | 512 MB | Judgeable |
| Frosting on the CakeGiven vertical stripe widths A and horizontal stripe heights B, find the total area of each of the three colors where each cell's color is (i+j) mod 3. | Medium4 | ArrayMath+2 | No attempts yet | 5s | 512 MB | Judgeable |
| The Bovine ShuffleGiven a permutation describing one shuffle and the cow order after three shuffles, recover the original order before the shuffles. | Medium4 | ArrayImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Milk MeasurementThree cows start at 7 gallons; apply N dated changes in chronological order and count the days on which the set of cows holding the top output changes. | Medium4 | SimulationSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Coloring IntervalsGiven n closed intervals with distinct endpoints, find the minimum number of colors so that overlapping intervals get different colors. | Medium4 | SortingIntervals+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Maximum of A[j]-A[i]+A[l]-A[k]Given an array, choose four increasing indices i<j<k<l maximizing A[j]-A[i]+A[l]-A[k]. | Medium4 | Dynamic programmingArray+1 | No attempts yet | 2s | 512 MB | Judgeable |
| WindowGiven N panes of size W by H, slide odd-indexed panes east and even-indexed panes west by given distances, then compute the uncovered window area. | Medium4 | ArraySimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| TimoviKids are dealt into N teams in a bouncing 1..N..1 order, K per visit, until fewer than K remain; report each team's final count. | Medium4 | MathSimulation+2 | No attempts yet | 1s | 64 MB | Judgeable |
| Out of PlaceGiven a row that came from a sorted row with one cow moved, find the minimum number of arbitrary swaps to sort it. | Medium4 | SortingGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Divisor PairsGiven n integers, count ordered pairs (i, j) with i != j such that a_i divides a_j. | Medium4 | MathArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Word Search in a GridDecide whether a word appears in a grid along a straight line of neighboring cells in any of the eight directions. | Medium4 | ArraySimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| JujisuGiven an N by M grid of populations, answer K queries for the sum of people inside each requested rectangle. | Medium4 | Prefix sumArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Taming the HerdGiven a partial daily log of days-since-breakout values with a breakout on day 1, find the minimum and maximum possible breakouts. | Medium4 | GreedyArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Lemonade LineGiven each cow's maximum tolerated queue length, choose an arrival order that minimizes how many cows end up waiting in line. | Medium4 | GreedySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| SegmentationTrack visits per user over time and answer queries by mapping each user's recency and frequency to one of 12 RF segments. | Medium4 | Hash mapImplementation+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Aku NegarakuFor each N and M, simulate Josephus elimination around a circle and report the last remaining trainee's number. | Medium4 | SimulationArray+1 | No attempts yet | 3s | 512 MB | Judgeable |
| Au au ua ui ya!!Given N segments [x, y] already sorted by x, compute the total length covered by their union on the number line. | Medium4 | IntervalsSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Drawing ArrowsEach point shoots an arrow to the nearest same-colored point; find the total length of all N arrows. Points are given unsorted, so sort them by position first. | Medium4 | SortingHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Drawing ArrowsEach point shoots an arrow to the nearest same-colored point; compute the total length of all arrows. | Medium4 | SortingHash map+2 | No attempts yet | 1s | 256 MB | Judgeable |
| ÜberwatchGiven a sequence of opponent counts over n time slices and a cooldown m, choose firing times at least m slices apart to maximize total opponents defeated. | Medium4 | Dynamic programmingArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| It's Time for a MontageEach day every hero gains 1 power; find the minimum number of days until the heroes win the ordered rival showdown. | Medium4 | ImplementationGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Dormvival GamesSimulate M weeks of adjacent room swaps driven by weekly merit and demerit scores, tracking how often the gap between Hong and Cho stays within B. | Medium4 | SimulationImplementation+1 | No attempts yet | 0.5s | 128 MB | Judgeable |
| Human-Computer InteractionCount how often a given lowercase letter appears inside each query interval [l, r] of a fixed string S, answering up to 200,000 queries. | Medium4 | Prefix sumArray+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Gun ControlGiven each lawmaker's defeat cost and compromise value, pick a subset whose costs sum to more than B with minimum total compromise. | Medium4 | Dynamic programmingArray | No attempts yet | 2s | 512 MB | Judgeable |
| Gahui and the 3-Step High NoteGiven a sequence of notes and an arithmetic progression with first term A and difference D, find the largest number of terms of the progression that appear as a subsequence in order. | Medium4 | GreedyArray+2 | No attempts yet | 1.5s | 256 MB | Judgeable |
| HackathonPartition N students into the fewest teams so each student's team size does not exceed their limit Xi. | Medium4 | GreedySorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| ZamjenaGiven two arrays of numbers and variables, decide if one assignment of integers to variables makes corresponding positions equal. Consistent positions give constraints; any conflict answers NE. | Medium4 | Hash mapImplementation+1 | No attempts yet | 1s | 64 MB | Judgeable |
| Drawing LinesGiven N segments on a number line, find the total length of their union, counting overlaps once and printing it as an integer. | Medium4 | SortingIntervals+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Hard Prime FactorizationFactor each of up to one million numbers up to 5,000,000 and print its prime factors in increasing order. | Medium4 | Number theoryArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Binary KingdomMaintain a binary array under requests that set a cell to 1 and report how many runs of consecutive 1s exist. | Medium4 | ArrayImplementation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| A Study on GroupsSplit the N integers into M groups whose sizes differ by at most one, then compute the smallest and largest possible sums of the group minima. | Medium4 | ArrayGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| LapsGiven per-minute track positions from a monotone run on an n-metre loop, find the smallest possible total forward distance modulo n in laps. | Medium4 | ArrayMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Finding LoveSimulate sliding contests of M people, each eliminating one person at rank V, then print the last M-1 skills sorted ascending. | Medium4 | SimulationSorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Generic QueriesGiven an array and range queries, compute each interval XOR and output the XOR of all answers mixed with the given k values. | Medium4 | Prefix sumBit manipulation+2 | No attempts yet | 2.5s | 512 MB | Judgeable |
| Gyeol! Hap!Score a Set-like game by checking each called triple against the hap rule and each gyeol against remaining uncalled haps. | Medium4 | Brute forceImplementation+1 | No attempts yet | 1s | 256 MB | Judgeable |
| PismoGiven an array of N integers, find two positions L < R minimizing the difference between the maximum and minimum of the subarray A[L..R]. | Medium4 | ArraySorting+1 | No attempts yet | 1s | 512 MB | Judgeable |
| The Ups and Downs of InvestingCount price peaks needing n rising and n falling days and valleys needing m falling and m rising days. | Medium4 | ArrayImplementation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| BombermanSimulate Bomberman's bomb placement and explosion cycle on a grid and print the state after N seconds. | Medium4 | SimulationImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Surface AreaGiven a grid of cube stack heights, compute the total surface area of the resulting 3D figure, including the top, bottom, and exposed side faces. | Medium4 | ImplementationMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Block PlayEach tower can be changed to any height at least 1 in one minute. Find the fewest towers to change so that consecutive heights differ by K. | Medium4 | MathImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Omok: Can Kyusagwa Win?On a 10x10 omok board, decide whether Kyusagwa, moving next with X stones, can place one stone to make five in a row. | Medium4 | ImplementationSimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Tabs vs SpacesFor each of up to 366 days, count tab and space guests from N intervals, then report occupancy days, peak headcount, fight-free days, peak headcount among those, and the longest stay length. | Medium4 | ArraySimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sequence and Queries 21Support range-add updates and point queries on an array of up to 100,000 elements with up to 100,000 operations. | Medium4 | ArrayPrefix sum+1 | No attempts yet | 2s | 512 MB | Judgeable |
| JarvisPick one integer X added to every factory frequency so that the count of indices with Ai + X = Bi is as large as possible. | Medium4 | Hash mapArray+2 | No attempts yet | 1s | 512 MB | Judgeable |
| SortingGiven an array, count how many single elements can be removed so that the remaining N-1 elements are in nondecreasing order. | Medium4 | ArrayImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Three FriendsGiven a sparse undirected graph, find three mutually adjacent vertices minimizing the sum of their degrees excluding the other two chosen vertices. | Medium4 | GraphBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Array PlayGiven an N by N grid and M rectangle-add operations, output the final sum of each row and each column. | Medium4 | Prefix sumArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Two ArraysFor each element of A, find the element of B closest in value (smallest on ties) and print the sum of these chosen values. | Medium4 | Binary searchSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Magician Nam JeonghunApply a sequence of up to 10 million suit-changing and rotation commands to 26 cards, printing the arrangement whenever a show command appears. | Medium4 | ImplementationString+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Good Pizza, Great PizzaGiven N points, find the area of the smallest 45-degree tilted square (rhombus) that contains all of them. | Medium4 | GeometryMath+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Overflowing FandomGiven N intervals during which fans are at school, find the minimum length of a single visit window that meets every interval. | Medium4 | IntervalsGreedy+2 | No attempts yet | 1s | 256 MB | Judgeable |
| PatternGiven a sequence of grid points, decide whether it is a valid Android unlock pattern under the no-repeat and no-skipped-point rules. | Medium4 | ImplementationSimulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Sequence and Shift QueriesMaintain a sequence under point additions and cyclic rotations by s positions to the right or left, then print the final array. | Medium4 | ArrayImplementation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Inquiry ISplit the array into a prefix and a suffix at some index k; maximize the sum of squares of the prefix times the sum of the suffix. | Medium4 | Prefix sumArray+2 | No attempts yet | 3s | 512 MB | Judgeable |
| City of LightsGiven N lights initially on and k toggles where toggle i flips every multiple of i, find the maximum number of lights that are off at any point during the sequence. | Medium4 | ArrayImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Bus LogicGiven a starting stop and bus routes as bit strings of length s, find the maximum number of other stops reachable by choosing exactly one bus that serves the starting stop. | Medium4 | Bit manipulationImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Last WordGiven a string and a sequence of substring(start, length) operations, output the characters that survive after all operations are applied in order. | Medium4 | StringSimulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| On-Screen KeyboardGiven a grid keyboard with a highlighted cell, find the total minimum button presses to type a string, where each character's cost is the Manhattan distance plus one for OK. | Medium4 | ImplementationArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Cap SizeGiven cap sizes tried on with fit feedback, count how many untried sizes could still fit, or report inconsistent feedback. | Medium4 | ImplementationSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Pocket MoneyChoose banknotes from the wallet so the total is even and as large as possible, using any subset; print NIESTETY if only odd totals are reachable. | Medium4 | GreedyMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Feeding SealsEach volunteer can carry one or two buckets as long as their combined weight stays within capacity c. Find the minimum number of volunteers needed to move all buckets. | Medium4 | GreedyTwo pointers+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Rotating DisksSimulate T rounds of rotating selected concentric disks, erasing adjacent equal numbers, or adjusting all numbers toward the average, then report the final sum. | Medium4 | SimulationImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Diamonds Are for EversDecode a message written into a square grid along nested diamond diagonals, given the row-by-row concatenation of all cells. | Medium4 | ImplementationMatrix+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Flight TurbulenceA permutation maps each seat to the passenger sitting there; count how many passengers shift when one passenger demands their assigned seat. | Medium4 | ArraySimulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Hardware SalesGiven three lists of (item ID, units) purchases, count items whose total units reach 20 or more in all three stores, printing IDs in first-appearance order. | Medium4 | Hash mapImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Integer DivisionCount pairs of indices whose values give the same quotient when both are divided by d using floor division. | Medium4 | Hash mapMath+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Tired TerryGiven a circular sleep pattern of length n, count for how many seconds i the preceding p seconds contain fewer than d seconds of sleep. | Medium4 | Sliding windowPrefix sum+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Short SellGiven N daily prices and a daily interest K per 100 borrowed coins, pick a borrow day and a repay day to maximize profit. | Medium4 | ArrayPrefix sum+2 | No attempts yet | 1s | 512 MB | Judgeable |