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,769 problems
TitleLevelTopicsSolvedTime limitMemory limitJudge
Flipping CoinsCount the heads and tails and flip the coins on the less frequent side so all coins show the same face.Easy1GreedyArrayNo attempts yet1s128 MBJudgeable
Choosing subjectsPick the three highest scores among the four science subjects and the higher of history and geography, then print their sum.Easy1GreedySortingNo attempts yet2s512 MBJudgeable
The group project starts and the team leader is goneGiven a distance L, Sungwoo covers 1 to 5 per minute; print the smallest integer number of minutes needed to reach Mingeon.Easy1MathImplementation+1No attempts yet1s128 MBJudgeable
Barn LotteryGiven N cows and a W by H barn, find how many L by L square spaces fit inside the barn, capped at N.Easy1MathImplementation+2No attempts yet1s1024 MBJudgeable
Chicken CouponsGiven n chicken coupons and a stamp-to-coupon exchange rate k, compute the maximum chickens obtainable by repeatedly redeeming stamps for new coupons.Easy2MathSimulation+1No attempts yet2s128 MBJudgeable
Packing Books into BoxesGiven book weights in order and a per-box weight limit, compute the minimum number of boxes needed by greedily filling each box in sequence.Easy2GreedyArray+1No attempts yet2s128 MBJudgeable
PlugsGiven N power strips each with a plug capacity, compute the max number of computers powered when strips are chained from one wall outlet.Easy2MathGreedy+1No attempts yet2s256 MBJudgeable
Laundry Owner DonghyukGiven a number of cents, output the minimum count of quarters, dimes, nickels, and pennies using a greedy coin breakdown.Easy2GreedyMath+1No attempts yet1s128 MBJudgeable
Triangular Gimbap Price ComparisonGiven several price rates for gimbap, compute the cheapest cost to buy exactly 1000 grams using the best per-gram rate among all stores.Easy2MathGreedy+1No attempts yet1s128 MBJudgeable
Sugar DeliveryFind the minimum number of 3kg and 5kg bags that sum to exactly N kilograms, or -1 if impossible.Easy2GreedyMathNo attempts yet1s128 MBJudgeable
Difference Between 5 and 6Given two integers, compute the minimum and maximum possible sums after freely swapping digits 5 and 6 in each number.Easy2StringGreedy+1No attempts yet1s128 MBJudgeable
Chessboard PiecesGiven N straight guillotine cuts through a rectangular board, compute the maximum number of resulting pieces.Easy2MathGreedyNo attempts yet1s128 MBJudgeable
Vacation HomeworkGiven L vacation days and per-day limits C and D, find the most free days after finishing A Korean and B math pages.Easy2MathGreedy+1No attempts yet1s128 MBJudgeable
ChangeGiven a purchase amount below 1000 yen paid with a 1000-yen bill, find the minimum number of coins in the change.Easy2GreedyMath+1No attempts yet1s128 MBJudgeable
Papaya JungleBessie moves greedily through a grid, always stepping to the adjacent square with the most uneaten papayas, and we sum the fruit she eats until she reaches the bottom-right corner.Easy2SimulationArray+2No attempts yet1s128 MBJudgeable
TV ReportsTrack daily Dollar prices against the previous day and the running all-time high, printing NTV drop headlines and BBTV record headlines in day order.Easy2ImplementationSimulation+2No attempts yet1s128 MBJudgeable
Time on TaskGiven a time limit and chore durations, find the largest number of chores that can be completed in any order.Easy2GreedySortingNo attempts yet1s128 MBJudgeable
ChessEach row holds at most one rook, so take the largest value in every row with a positive maximum and add them.Easy2GreedyArrayNo attempts yet1s128 MBJudgeable
DisplayFit the words of a space-separated text into the fewest rows of width w, breaking a row only when the next word does not fit.Easy2GreedySimulationNo attempts yet1s128 MBJudgeable
Fast Food PrizesAdd up, over disjoint prize sets, the prize value times the smallest sticker count among its required kinds.Easy2GreedyMath+1No attempts yet2s128 MBJudgeable
Arrangement of ContestCount the titles that form the longest unbroken run from A onward, using each title's first letter and stopping at the first missing letter.Easy2GreedyString+1No attempts yet2s256 MBJudgeable
Kids love candyEach test case gives candy piles and K, and asks for the most children who can each receive at least K pieces of a single kind.Easy2MathGreedyNo attempts yet1s128 MBJudgeable
The KingPick any subset of up to 100 values from minus 3 to 3 so the sum of the chosen values raised to the given power 1 to 3 is as large as possible.Easy2GreedyMathNo attempts yet2s128 MBJudgeable
Microwave ButtonsPress the 5-minute, 1-minute, and 10-second buttons to total exactly T seconds with the fewest presses, or print -1 when impossible.Easy2GreedyMathNo attempts yet1s64 MBJudgeable
The return of the KingSplit the digit string into grades of 1 to 10 in the single valid way and print the average rounded to two decimals.Easy2StringGreedyNo attempts yet1s256 MBJudgeable
Three Kangaroos 2Three kangaroos on integer points let an outer one jump between the other two, and each test case asks for the largest possible number of jumps.Easy2GreedyMathNo attempts yet1s256 MBJudgeable
AmpelmännchenFor each item pick the West or East version that gives the larger population-weighted happiness total.Easy2GreedyImplementationNo attempts yet1s256 MBJudgeable
FloodFollow the given greedy procedure to build a permutation histogram with trapped-water capacity X, or print -1 when it fails.Easy2GreedyImplementationNo attempts yet1s64 MBJudgeable
Stock InvestmentGiven each day's profit for three stocks, pick at most one stock per day and maximize the total profit.Easy2ArrayGreedyNo attempts yet1s128 MBJudgeable
Graph Maximum MatchingGiven a small graph, decide whether some edges can be kept so every vertex has degree exactly 1.Easy2GraphBacktracking+1No attempts yet2s512 MBJudgeable
Life SavingsCompare the savings from one 20%-style whole-purchase coupon against the best way to spend two one-item coupons on two of three items, then print the winning plan and its savings.Easy2Brute forceMath+2No attempts yet2s512 MBJudgeable
Analysis of Advanced AnalyticsGiven daily page counts and a fixed notebook size, count how many notebooks are needed when each day's notes must fit in one notebook without splitting.Easy2SimulationGreedy+1No attempts yet1s512 MBJudgeable
Master Manager Nam JeonghunGiven L left-footed, R right-footed, and A two-footed players, find the largest even team size with equal left and right counts.Easy2MathGreedyNo attempts yet1s128 MBJudgeable
TeleportationGiven start a, end b, and a bidirectional teleporter linking x and y, find the minimum tractor distance to move from a to b, with the option to skip the teleporter.Easy2MathImplementation+2No attempts yet2s512 MBJudgeable
What Does UCPC Stand For?Given one string, decide whether deleting some characters can leave exactly the subsequence UCPC, case sensitive.Easy2StringGreedy+1No attempts yet1s512 MBJudgeable
BagsGiven n waste pieces with identifiers, find the minimum number of bags so that each bag holds pieces of only one identifier.Easy2Hash mapImplementation+2No attempts yet1s512 MBJudgeable
TreasureGiven two arrays A and B, rearrange A (B stays fixed) to minimize the sum of elementwise products, using the sorted pairing strategy.Easy3GreedySorting+1No attempts yet2s128 MBJudgeable
Guitar StringsBuy at least N guitar strings using packages of 6 or single strings from M brands at given prices, minimizing total cost.Easy3Brute forceGreedy+1No attempts yet2s128 MBJudgeable
Castle GuardsGiven a grid of guards, compute the minimum number of guards to add so every row and column has at least one, which equals the max of empty-row count and empty-column count.Easy3ArrayGreedy+1No attempts yet2s128 MBJudgeable
Repairing Pipe LeaksGiven leak positions and a fixed tape length, compute the minimum number of length-L tapes needed so each leak is covered with at least 0.5 margin on both sides.Easy3GreedySorting+1No attempts yet2s128 MBJudgeable
WalkingCompute the minimum time to walk from (0,0) to (X,Y) on a grid where straight moves cost W and diagonal moves cost S.Easy3MathGreedyNo attempts yet2s128 MBJudgeable
Maximum ProductSplit S into K positive integers as equal as possible to maximize their product, given S and K up to 100 and 20.Easy3MathGreedyNo attempts yet2s128 MBJudgeable
Lost ParenthesesGiven an arithmetic expression with only plus and minus signs, place parentheses to minimize the evaluated result.Easy3GreedyString+1No attempts yet2s128 MBJudgeable
Common PermutationFor each pair of input strings, count letter frequencies and output the multiset intersection sorted alphabetically as the longest common rearranged subsequence.Easy3Hash mapString+1No attempts yet2s128 MBJudgeable
Garbage CollectionSimulate a garbage truck visiting points in order, returning to the dump when its load is full or would overflow, and compute the total distance traveled.Easy3SimulationImplementation+2No attempts yet1s128 MBJudgeable
Card Bundle SortingGiven N sorted card bundle sizes, find the minimum total comparisons to merge them all into one bundle using an optimal merge strategy (classic huffman-like heap problem).Easy3HeapGreedyNo attempts yet2s128 MBJudgeable
Sum of Distinct NumbersGiven a sum S, find the largest number of distinct positive integers that can add up to exactly S.Easy3MathBinary search+1No attempts yet2s128 MBJudgeable
Repairing a Mud RoadGiven non-overlapping puddle intervals and fixed-length planks, find the minimum number of planks needed to cover all puddles.Easy3GreedyIntervalsNo attempts yet2s128 MBJudgeable
Meeting Room SchedulingGiven N meetings with start and end times, select the maximum number of non-overlapping meetings using a classic greedy interval scheduling approach.Easy3GreedySorting+1No attempts yet2s128 MBJudgeable
DNAGiven N DNA strings of length M, construct the string minimizing total Hamming distance to all, breaking ties lexicographically, and output that distance.Easy3StringGreedy+1No attempts yet2s128 MBJudgeable
Drawing LinesGiven N line segments on a number line, compute the total length covered by at least one segment, merging overlaps.Easy3IntervalsSorting+1No attempts yet1s192 MBJudgeable
RopesChoose a subset of ropes so that each rope's capacity times the count of chosen ropes is maximized, to find the greatest liftable weight.Easy3SortingGreedyNo attempts yet2s192 MBJudgeable
Making Equal-Length SticksGiven piece lengths, find the smallest stick length such that all pieces can be regrouped into sticks of that equal length (the sum divided by a suitable divisor, bounded by the maximum piece).Easy3MathGreedy+1No attempts yet3s128 MBJudgeable
Pancake LoveGiven raw ingredient counts, compute the maximum batter portions (limited by a scaling factor) and topping-based pancake counts, then output the minimum of total toppings possible and batter portions.Easy3MathGreedy+1No attempts yet1s128 MBJudgeable
Asian Informatics OlympiadSort students by descending score and pick the top three medalists while capping each country to at most two medals.Easy3SortingGreedy+1No attempts yet1s128 MBJudgeable
Equal-Sum SegmentsSplit an array into contiguous segments with equal sums and output the smallest possible such common sum.Easy3Prefix sumGreedy+1No attempts yet1s128 MBJudgeable
Contest or InternshipGiven female and male student counts and a number who must leave for internship, decide who to remove to maximize teams of 2 females and 1 male each.Easy3GreedyMath+1No attempts yet1s128 MBJudgeable
Chocolate LunchGiven K, find the smallest power-of-two chocolate bar size and the minimum number of halving splits needed to obtain exactly K unit pieces.Easy3Bit manipulationMath+1No attempts yet1s128 MBJudgeable
Machine CodeGiven a sequence of instructions with parameters, compute the minimum NOPs needed so each instruction starts at an address divisible by 4.Easy3GreedySimulation+1No attempts yet1s128 MBJudgeable
Rock-Paper-Scissors ScoreGiven a player's rock-paper-scissors choices against several friends over multiple rounds, compute the actual score and the best possible score with foreknowledge each round.Easy3SimulationGreedy+1No attempts yet1s128 MBJudgeable
Croatian AlphabetParse a string left to right, greedily matching multi-character Croatian letter codes (like c=, dz=, lj), and count total letters.Easy3StringGreedy+1No attempts yet1s128 MBJudgeable
Cutting ChocolateGiven an N by M chocolate bar, find the minimum number of square pieces obtained by repeatedly cutting it fully along rows or columns.Easy3MathNumber theory+1No attempts yet1s128 MBJudgeable
PizzaGiven each friend's pizza appetite of 1/4, 1/2, or 3/4, compute the minimum number of whole pizzas needed to serve exact slices to all.Easy3GreedyMath+1No attempts yet1s128 MBJudgeable
DollarsSimulate converting between dollars and marks daily using given rates to maximize final dollar amount, truncated to two decimals.Easy3GreedySimulation+1No attempts yet1s128 MBJudgeable
PolygonDecide whether N given segment lengths can form the sides of some convex polygon, which reduces to checking that the largest length is smaller than the sum of the rest.Easy3GreedyMathNo attempts yet1s128 MBJudgeable
HolesFind the smallest non-negative integer without leading zeros whose digits produce exactly h holes, where 0,4,6,9 give one hole and 8 gives two.Easy3GreedyMathNo attempts yet3s256 MBJudgeable
Journey with PigsGiven pig weights and per-village net price coefficients, assign pigs to villages one-to-one to maximize total revenue (sort and multiply greedily).Easy3GreedySorting+1No attempts yet2s64 MBJudgeable
Building a Swimming PoolCompute the minimum cost to convert a grid into grass/hole cells, forcing the border to be grass and charging per boundary edge between grass and hole.Easy3ArrayGreedy+1No attempts yet2.5s128 MBJudgeable
Control PointsGiven sorted coordinates of control points, find the minimum number of length-1 half-open intervals needed to cover all points using a greedy sweep.Easy3GreedySorting+1No attempts yet1s128 MBJudgeable
ProfitGiven a sequence of daily profits, find the maximum total over any non-empty stretch of consecutive days, across several test cases.Easy3ArrayDynamic programming+1No attempts yet1s256 MBJudgeable
AntsGiven ant positions on a rod of length l, choose each ant's initial direction to minimize and maximize the time for all ants to fall off.Easy3MathGreedy+1No attempts yet1s128 MBJudgeable
Car RacingGiven the order in which cars arrive, decide whether a single FIFO bypass lane can reorder them to increasing order.Easy3StackSimulation+1No attempts yet1s128 MBJudgeable
Patterns and PicturesFor each data set, compute the total area of one full set, then find how many full sets fit in one, two, and three square yards.Easy3MathImplementation+2No attempts yet1s128 MBJudgeable
Carbonated DrinksGiven starting empties, empties found, and the empties needed per exchange, count how many drinks Junmin can obtain and drink in total.Easy3MathSimulation+2No attempts yet1s128 MBJudgeable
The God of ParkingGiven shop coordinates on a line, pick an integer parking spot and visit all shops, returning to the car, to minimize total walking distance.Easy3MathGreedy+2No attempts yet1s128 MBJudgeable
Longest Decreasing SuffixFor each string, print its longest suffix whose characters strictly decrease from left to right.Easy3StringImplementation+2No attempts yet1s128 MBJudgeable
Dividing the Pirate HoardEach of N pirates in turn splits the pile into N equal parts, keeps one part plus the remainder, and returns the rest; report each pirate's hidden coins and the leftover pile.Easy3SimulationMath+2No attempts yet1s128 MBJudgeable
Pirates On ParadeSort pirates by height, then pair each shortest remaining pirate with the next one if their heights differ by at most 2 inches, and drop the rest.Easy3SortingGreedy+1No attempts yet1s128 MBJudgeable
PLU CountFor each text string, find the largest k such that PLU repeated k times is a subsequence, ignoring case.Easy3GreedyString+1No attempts yet1s128 MBJudgeable
Card Captor SanggeunSimulate a two-player card game where each player always plays the smallest legal card, and report the final scores.Easy3SimulationImplementation+2No attempts yet1s128 MBJudgeable
He is offside!Given distances of attackers and defenders to the goal line, decide whether any attacker is offside, meaning nearer to the goal than the second-last defender.Easy3ImplementationSorting+2No attempts yet1s128 MBJudgeable
Hay BalesGiven N piles of hay with possibly unequal heights, find the minimum number of bales to move so all piles have equal height.Easy3ArrayMath+1No attempts yet1s128 MBJudgeable
ProfitsGiven a sequence of N daily profits, find the maximum sum over any contiguous stretch of days.Easy3ArrayDynamic programming+2No attempts yet1s128 MBJudgeable
Cow CotillionGiven strings of '<' and '>', decide for each whether every character can be paired as a properly nested '><' bow, i.e. whether the brackets are balanced.Easy3StackString+2No attempts yet1s128 MBJudgeable
BookshelfGiven cow heights and a shelf height B, find the smallest number of cows whose heights sum to at least B.Easy3GreedySorting+2No attempts yet1s128 MBJudgeable
Making ChangeGiven a target amount and up to 10 coin denominations, find the fewest coins that sum exactly to the target.Easy3Dynamic programmingGreedy+1No attempts yet1s128 MBJudgeable
Box of BricksGiven stack heights whose total is divisible by n, find how many bricks must move so every stack reaches the equal target height.Easy3ArrayGreedy+2No attempts yet1s128 MBJudgeable
Kilometers to MilesConvert each kilometer value to miles by writing it in Zeckendorf Fibonacci form, dropping the lowest bit, and re-evaluating.Easy3MathGreedy+2No attempts yet1s128 MBJudgeable
SubsequenceFor each line of input, decide whether the first string is a subsequence of the second, printing Yes or No.Easy3Two pointersString+2No attempts yet1s128 MBJudgeable
SignageGiven a sign width, lay out a fixed sentence into lines, justifying each line so spaces are spread as evenly as possible, and print dots for spaces.Easy3StringSimulation+2No attempts yet1s128 MBJudgeable
Milk and HoneyEach field holds either cows up to its cow limit or bees up to its bee limit; assign each field one animal type to maximize happiness from milk and honey.Easy3GreedySorting+2No attempts yet1s1024 MBJudgeable
Aliens' SocksFind the minimum number of socks to draw so that at least k of one color are guaranteed, given the counts per color.Easy3GreedyMath+1No attempts yet1s1024 MBJudgeable
Alien SocksGiven counts of socks in s colors, find the smallest number of socks to draw to guarantee k socks of one color, or -1 if impossible.Easy3MathGreedy+1No attempts yet1s1024 MBJudgeable
PyramidsGiven N blocks, repeatedly take out the largest triangular number that fits, and print the resulting pyramid heights in decreasing order.Easy3GreedyMath+2No attempts yet1s1024 MBJudgeable
AnimalsGiven N active time intervals, find whether they share a common moment and, if so, the longest interval when all animals are active.Easy3IntervalsImplementation+2No attempts yet1s1024 MBJudgeable
CouriersSimulate two couriers who each take an incoming order if free, preferring the faster one, and total each courier's earnings.Easy3SimulationImplementation+1No attempts yet1s1024 MBJudgeable
ElevatorRusnė goes from floor 0 to floor N using the elevator for at most K segments; minimize the total height of the segments she climbs on foot.Easy3GreedySorting+1No attempts yet1s1024 MBJudgeable
LaundryGiven colors partitioned into washable groups and counts of clothes per color, find how many machine loads of capacity M are needed.Easy3MathImplementation+2No attempts yet1s1024 MBJudgeable
Skew BinaryConvert each decimal number into its unique skew binary representation, printed as the sorted ranks of its nonzero digits.Easy3MathGreedy+2No attempts yet1s128 MBJudgeable
StampsGiven a needed stamp count and each friend's offer, find the fewest friends whose offers sum to at least the needed amount, or report impossible.Easy3GreedySorting+2No attempts yet1s128 MBJudgeable