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 results3,779 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| AB StringFind the length-N A/B string whose number of (A before B) pairs equals K, choosing the lexicographically smallest such string. | Medium4 | GreedyCombinatorics+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Wolves and Proper WordsGiven a word of w, o, l, f, decide whether it is a concatenation of blocks w^n o^n l^n f^n for n >= 1. | Medium4 | StackGreedy | No attempts yet | 2s | 512 MB | Judgeable |
| Important TestFor each variant, find the longest prefix solvable in t minutes given he may replace at most one task time with t0. Since order is fixed, choose the single task in that prefix whose copying saves the most time. | Medium4 | ArrayPrefix sum+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Do Not Touch AnythingGiven an R by C grid and an N by N square, find the fewest squares needed to cover the whole grid, allowing overhang and overlap. | Medium4 | MathGreedy | No attempts yet | 1s | 32 MB | Judgeable |
| HoneyGiven N hives with honey amounts, a pot of capacity M, and at most K trips, maximize the total honey collected. | Medium4 | GreedySorting+1 | No attempts yet | 1s | 64 MB | Judgeable |
| Harps and TailsFlip any subset of columns of an H/T grid; find the maximum number of rows that can be made all-H. | Medium4 | Hash mapGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Stacking BlocksGiven a 0/1 top view plus front and side height maxima, output the tallest cube stack arrangement matching all three views, or -1. | Medium4 | GreedyMatrix+1 | No attempts yet | 1s | 128 MB | Judgeable |
| RearrangeChoose an ordering of the array, subtract elements from n in that order until n drops to 0 or below, and report the smallest achievable result. | Medium4 | GreedySorting | No attempts yet | 1s | 512 MB | Judgeable |
| Lab SchedulePick days to experiment so no two chosen days are within two days of each other, maximizing the sum of visit probabilities. | Medium4 | Dynamic programmingGreedy | No attempts yet | 2s | 512 MB | Judgeable |
| Card StringGiven uppercase letters taken left to right, each new card is placed at the front or back of the growing string; find the lexicographically smallest result. | Medium4 | GreedyString+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Battle SimulationRead a monster attack string and output the mech's counters, merging each earliest triple of R, B, L into one C. | Medium4 | StackString+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Sticky SituationGiven N stick lengths, decide whether some three of them can form a triangle with positive area. | Medium4 | SortingGreedy | No attempts yet | 2s | 512 MB | Judgeable |
| Fridge MagnetsGiven a multiset of digit magnets, find the smallest positive integer that cannot be assembled from them, where the answer can exceed 64-bit range. | Medium4 | GreedyMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Stick GameGiven counts of sticks of distinct lengths, find the maximum number of rectangles (squares allowed) that can be built using each stick at most once. | Medium4 | GreedySorting | No attempts yet | 2s | 512 MB | Judgeable |
| Mismatched SocksGiven counts of socks per color, find the maximum number of pairs where each pair uses two different colors and every sock is in at most one pair. | Medium4 | GreedyMath+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Pokemon TradingWith a fixed budget, buy on one day and sell on a later day to maximize profit; report the best result rounded to two decimals. | Medium4 | ArrayGreedy+1 | No attempts yet | 0.3s | 4 MB | Judgeable |
| Delete and Append SortEach operation moves one element to the end. Find the minimum number of such moves needed to sort the array. | Medium4 | GreedySorting | No attempts yet | 2s | 512 MB | Judgeable |
| Merging Files 3Given K file sizes, find the minimum total cost of repeatedly merging two files where each merge costs the sum of their sizes. | Medium4 | HeapGreedy | No attempts yet | 2s | 512 MB | Judgeable |
| Contest ScoreSimulate reading problems in order but solving the shortest available one first, keeping at most k in memory, and report the total submission time. | Medium4 | SimulationHeap+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Tandem BicyclePair each Dmojistan rider with a Pegland rider to minimize or maximize the sum of the larger speed in each pair. | Medium4 | GreedySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| HyperloopFor odd N, print (N-1)/2 Hamiltonian cycles on the complete graph of N cities that partition all edges, using the given seat-walk construction. | Medium4 | GreedyMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TunnelGiven the entry order and exit order of N cars through a tunnel, count how many cars must have overtaken another car. | Medium4 | ArrayHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Packing snack sticksGiven n and m, decide whether an n by m grid can be tiled exactly with 3-cell straight bars and L trominoes that may be rotated. | Medium4 | MathGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 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 |
| Christmas GiftsProcess visits in order: depots add gifts to Santa's collection, and each child takes the largest gift currently held. | Medium4 | HeapSimulation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Merging SlimesMerge N slimes two at a time, scoring the product of merged sizes, and maximize the total score. | Medium4 | GreedySorting | No attempts yet | 2s | 512 MB | Judgeable |
| Build a treeConstruct a tree on n nodes with exactly m leaves whose sorted edge list is lexicographically smallest, and print its n-1 edges. | Medium4 | TreeGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Close Match (Small)Fill in the question marks in two equal-length digit strings to minimize the absolute difference between the values, breaking ties by minimizing the first then the second. | Medium4 | Brute forceImplementation+2 | No attempts yet | 5s | 512 MB | Judgeable |
| The Last Word (Large)Insert each letter of S at the front or back of the growing word so the final string is as large as possible lexicographically. | Medium4 | GreedyString+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Revenge of the Pancakes (Small)Given a stack of pancakes as a + and - string, find the fewest top-prefix flips that make every pancake happy side up. | Medium4 | GreedyString | No attempts yet | 5s | 512 MB | Judgeable |
| Revenge of the Pancakes (Large)Given a stack of pancakes as a string of + and -, find the minimum number of top-prefix flips needed to make every pancake show its happy side. | Medium4 | GreedyString+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Resource MiningA robot walks from the top-left to the bottom-right cell of an N by M grid using only right and down moves; find the largest number of resource cells it can pass through. | Medium4 | Dynamic programmingMatrix+2 | No attempts yet | 2s | 256 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 |
| 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 |
| 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 |
| GwailnoriGiven each segment's bot cycle of a seconds with b active, find the earliest time to traverse all N segments in order, waiting whenever a segment is active on arrival. | Medium4 | SimulationMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Yin and Yang StonesGiven a circular string of black and white stones, decide whether repeated merges can reduce it to one black and one white stone. | Medium4 | StringGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Pizza (Large)Split a tower of N into unit towers, scoring the product of the two parts at each split, and maximize the total score. | Medium4 | GreedyMath+2 | 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 |
| MultiMaxGiven n cards with values in [-1000, 1000], pick two or three so their product is maximized. | Medium4 | SortingGreedy+1 | No attempts yet | 1s | 512 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 |
| Party GamesFor each test case, find the shortest string that splits the sorted guest names into two equal halves, choosing the alphabetically first if several have that length. | Medium4 | StringSorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Bathroom Stalls (Small1)Simulate K people choosing stalls by a fixed farthest-from-others rule and report the distances around the stall the last person takes. | Medium4 | SimulationImplementation+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Steed 2: Cruise Control (Small)Given horses ahead on a one-way road that slow to match slower horses they catch, find the fastest constant speed Annie can hold to her destination without ever passing one. | Medium4 | MathImplementation+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Frog LeapsFind the minimum sum of squared jump distances to travel from the first stop to the last, given sorted positions. | Medium4 | GreedyDynamic programming+1 | No attempts yet | 2s | 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 |
| Auxiliary ProjectChoose any multiset of digits whose total lit segments equals n, and maximize the sum of the digits. | Medium4 | GreedyMath | No attempts yet | 3s | 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 |
| ZigZagGiven K words and N letters, output for each letter the word starting with it that has been used fewest times, breaking ties alphabetically. | Medium4 | SortingHash map+2 | No attempts yet | 2s | 64 MB | Judgeable |
| Street LightsGiven existing street lights that each cover K metres to both sides, find the minimum number of extra lights needed to light every metre from 1 to N. | Medium4 | GreedySorting+2 | No attempts yet | 1s | 64 MB | Judgeable |
| How to Eat at a BuffetGiven a plate area and items with value per area and available area, pick fractions to maximize total value on the plate. | Medium4 | GreedySorting | 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 |
| 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 |
| GlenGiven a target pattern of marks on an N by M grid, produce the fixed boustrophedon walk that flips tiles down-and-back to match the pattern. | Medium4 | SimulationImplementation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| HoofballSort cows by position, then find the minimum number of starting balls so every cow receives the ball at least once under the nearest-cow passing rule. | Medium4 | SortingGraph+1 | 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 |
| Harmonic numberCompute the numerator and denominator of the harmonic number H_N as an irreducible fraction for N up to 10000. | Medium4 | MathNumber theory+2 | No attempts yet | 1s | 512 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 |
| You Are Fired!Pick at most k employees whose salaries sum to at least d, minimizing the number fired, or report that it cannot be done. | Medium4 | GreedySorting+1 | 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 |
| 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 |
| Card PickingGiven N cards with M front O's, choose exactly K off sameSymbol cards get an O on the back and the rest an X to maximize front-back matches. | Medium4 | MathGreedy+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Roll CakeGiven up to M cuts across cakes of length at most 1000, maximise how many length-10 pieces you can cut out of them. | Medium4 | MathGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| EagleEach day pick one cell, route from an edge, empty every cell passed over, and lose one sheep per cell at night; maximize the sheep eaten. | Medium4 | SimulationGreedy | No attempts yet | 2s | 512 MB | Judgeable |
| SpaceshipReorder n enemy powers so that the last one equals the sum of all the others. | Medium4 | MathSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Martian VolleyballGiven a volleyball score k x y, find the fewest remaining balls until one team wins by reaching k with a 2-point lead. | Medium4 | MathGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Code CleanupsGiven days of dirty pushes, clean up as late as possible at day end so dirtiness (sum of push ages) stays below 20; count cleanup phases. | Medium4 | SimulationGreedy | No attempts yet | 1s | 512 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 |
| Planet ConnectionGiven a complete symmetric cost matrix, find a minimum spanning tree connecting all planets and output its total maintenance cost. | Medium4 | Minimum spanning treeGraph+2 | No attempts yet | 1s | 256 MB | Judgeable |
| SnakebirdGiven N fruits at heights h_i and a snake of length L, grow by eating any fruit of height at most the current length and output the maximum length reached. | Medium4 | GreedySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Make the Largest NumberGiven up to 1000 non-negative integers, order the pieces so their concatenation is the largest possible number, and print it without leading zeros. | Medium4 | GreedySorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Heroes of the Storm ProgamerGiven N character levels and a total increase K, raise levels to maximize the minimum of the chosen sequence. | Medium4 | GreedySorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Enviska's SoulGiven N people ahead and jump sizes a and b, find the smallest time to reach the front using zero-time jumps or waiting. | Medium4 | MathGreedy+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 |
| InflationPair canister amounts with balloon sizes 1 to n so the minimum fill fraction is as large as possible without exceeding any capacity. | Medium4 | GreedySorting | No attempts yet | 2s | 512 MB | Judgeable |
| Judging DivisionalsGiven ranked teams with a division and university, apply two selection steps with university limits and output the 12 advancing teams by rank. | Medium4 | SimulationImplementation+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 |
| Easy ChessFind a path of exactly n rook moves on an 8x8 board from a1 to h8 that visits n+1 distinct cells. | Medium4 | ImplementationBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| LazylandEach of n workers wants one of k jobs and costs b_i to reassign. Keep one worker per chosen job and reassign the cheapest extras to cover every missing job. Return the minimum total cost. | Medium4 | GreedySorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Devil GameFind a dictionary word containing the original word as a subsequence and maximize mood-killing degree per inserted letter, breaking ties by input order. | Medium4 | StringTwo pointers+1 | No attempts yet | 1s | 256 MB | Judgeable |
| GuruGuruCount disjoint substrings of an L/R command string that complete one full clockwise rotation from north with the required non-north directions visited. | Medium4 | StringGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| An I for an EyeApply a fixed table of text abbreviations to each line, scanning left to right and always taking the longest match at a position, with case handling. | Medium4 | StringSimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Grass PlantingGiven a tree with N fields, plant grass so that no two fields at distance one or two share a type, and output the minimum number of types needed. | Medium4 | TreeGreedy+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 |
| Hide and Seek 6Given Subin's position S and the positions of N siblings, find the largest step size D such that repeated moves of +D or -D from S can reach every sibling. | Medium4 | MathNumber theory+2 | No attempts yet | 1s | 512 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 |
| But can you do it in 0.5x A presses?Given the A-press cost of each stage as a multiple of 0.5, find the minimum total presses to clear all stages in order, since holding A carries between stages. | Medium4 | GreedyMath+1 | No attempts yet | 1s | 512 MB | Judgeable |
| BitberryGiven P bits, Q berries, and exchange rates A, B, C, D, find the maximum number of bitcoins obtainable, where each bitcoin costs 1 bit and 1 coin. | Medium4 | MathGreedy+1 | No attempts yet | 1s | 1024 MB | Judgeable |
| 6789Each cell holds a card 6, 7, 8, or 9; turning a card rotates it (6 and 9 swap, 8 and 7 stay). Find the minimum number of turns so the grid stays the same after a 180-degree rotation, or -1 if impossible. | Medium4 | ImplementationGreedy+1 | No attempts yet | 1s | 1024 MB | Judgeable |
| And the Winner Is... Ourselves!Given 11 problems that are all solved, choose the solving order that minimizes total penalty, where each problem contributes its finish time plus 20 times its wrong submissions. | Medium4 | GreedySorting+2 | No attempts yet | 4s | 1024 MB | Judgeable |
| ArchitectureGiven the R row maxima and C column maxima of a grid, decide whether any grid of heights can realize both sets of maxima. | Medium4 | GreedyImplementation+2 | No attempts yet | 1s | 512 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 |
| 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 |
| 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 |
| Breaking BranchesTwo players alternately split pieces of a length n branch into integer parts; the last to move wins. Decide the winner and give Alice's winning first move. | Medium4 | Game theoryMath+2 | No attempts yet | 1s | 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 |
| 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 |