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,340 problems
TitleLevelTopicsSolvedTime limitMemory limitJudge
SUPER SUPER BINARY SEARCH DELUXE 2.5: THE LEGEND OF THE GOLDEN MAZASSUMNIDA, EPISODE 2: THE MAZWAETL UNIVERSE, PART 2: THE PARALLEL UNIVERSE AND THE LOST MAZASSUMNIDA: GAME OF THE YEAR EDITIONPrint the first midpoint binary search picks on [1, 100], which is 50.Easy1Binary searchImplementationNo attempts yet1s256 MBJudgeable
Song ScoresGiven cumulative durations of N song scores, answer Q queries asking which score is being sung at a given time using prefix sums and search.Easy2Prefix sumBinary search+1No attempts yet2s128 MBJudgeable
What Is My Grade?Given 50 distinct scores sorted in descending order and Hongik's score, print the letter grade matching his rank using the fixed cutoffs.Easy2ArrayImplementation+2No attempts yet1s256 MBJudgeable
Finding the RankGiven a sorted list of scores with a capacity limit, compute the rank of a new score or return -1 if the list is full and the score is not higher than the last entry.Easy3ArrayImplementation+1No 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
Finding NumbersGiven N integers and M queries, output for each query whether it exists in the array, requiring an efficient lookup method.Easy3Binary searchSorting+1No attempts yet1s128 MBJudgeable
Integer Square RootGiven an integer n up to 2^63-1, compute the smallest nonnegative integer q whose square is at least n.Easy3Binary searchMathNo attempts yet0.4s128 MBJudgeable
ICONSGiven N, find rows R and columns C with R<=C, R*C>=N, minimizing R+C, and output the most balanced such pair.Easy3MathBrute force+1No attempts yet1s128 MBJudgeable
iChessGiven counts of black and white tiles, find the largest square side length whose checkerboard pattern fits within those tile counts, or report impossibility.Easy3Binary searchMath+1No attempts yet2s64 MBJudgeable
Internet Service ProvidersGiven N and C, find the smallest integer T minimizing/maximizing the quadratic profit N*T*(C-T*N), handling N=0 edge case.Easy3MathImplementation+1No attempts yet1s128 MBJudgeable
Prime Gap SequenceGiven a number k, find the gap length between the two consecutive primes surrounding it if k is composite, otherwise output 0.Easy3MathNumber theory+1No attempts yet1s128 MBJudgeable
Too Much WaterGiven a property point, compute the hour when the growing semicircle centered at the origin first covers it, using the fixed 50 square meters per hour rate.Easy3GeometryMath+2No attempts yet1s128 MBJudgeable
Ball BearingsGiven the inner diameter of an outer ring, the ball diameter, and the minimum gap between neighboring balls, find the maximum number of balls that fit.Easy3GeometryMath+2No attempts yet1s128 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
HunterCount animals within range L of a firing position on the x-axis under distance |x - a| + b.Easy3Binary searchSortingNo attempts yet1s128 MBJudgeable
Fegla and the Bed BugsPlace K bugs on N line cells to maximize the smallest empty gap between neighbors.Easy3Binary searchGreedyNo attempts yet1s128 MBJudgeable
Paula's dress searchCount how many middle-shop visits Paula needs to reach the shop holding her dress.Easy3SimulationBinary searchNo attempts yet1s128 MBJudgeable
Number CardsCheck each of M query integers against a set of N owned cards and print 1 for a match and 0 otherwise.Easy3Hash mapBinary searchNo attempts yet2s256 MBJudgeable
There is no place like 127.0.0.1Replace each IPv4 address in the text with its mapped word from single entries and non-overlapping ranges, leaving unmatched addresses unchanged.Easy3Binary searchSorting+1No attempts yet2s256 MBJudgeable
Stepping StonesMaximize the number of landed stones when jump lengths grow by at least one each time and the last landing is stone N.Easy3MathBinary searchNo attempts yet1s256 MBJudgeable
Probability of winning a prizeGiven a and b, a comment's position is uniform on a+1 to b; find the probability it is a perfect square and print the reduced fraction.Easy3MathNumber theory+2No attempts yet1s128 MBJudgeable
Hunt the RabbitFor each hidden rabbit position, print the sequence of envelope numbers a lower-middle binary search opens until it finds the rabbit.Easy3Binary searchSimulationNo attempts yet2s512 MBJudgeable
Riemann Sum Offset (Small)For a linear polynomial, find the offset epsilon in [0, dx] that makes the Riemann sum equal the exact integral, or print -1.Easy3MathImplementation+2No attempts yet1s512 MBJudgeable
Äventyr 1On a path 1 to N, vertices become active over time; after each activation, answer the distance from a query vertex to the nearest active vertex, or -1 if none exists yet.Easy3ArraySorting+2No attempts yet1s256 MBJudgeable
2018 Yonsei University Programming ContestGiven the total spark count N of a firework that bursts once then bursts again, find the branching factor K.Easy3MathImplementation+2No attempts yet1s128 MBJudgeable
BeondegiGiven A players in a circle and a chant pattern by rounds, find who makes the T-th call of a chosen word (ppeon or degi), counting only that word.Easy3MathImplementation+2No attempts yet1s128 MBJudgeable
Predictable QueueGiven N task times and M time limits T, print how many tasks are processed first in order before their prefix sum exceeds T.Easy3Prefix sumBinary searchNo attempts yet1s512 MBJudgeable
Server RoomAir rises one unit per minute from the bottom of an N x N grid of stacked computers; find the earliest minute when at least half of all computers are cooled.Easy3SortingBinary search+2No attempts yet1s256 MBJudgeable
Expeditious CubingGiven four of Claire's five solve times and a target final score (average of the middle three), find the largest fifth solve time that still meets the target, or report impossible or infinite.Easy3MathSorting+2No attempts yet2s512 MBJudgeable
Please Write the If Statements for MeGiven N titles ordered by increasing power upper bounds, print for each of M power values the first title whose bound is at least that value.Easy3Binary searchArray+2No attempts yet1s1024 MBJudgeable
Endless StringStarting from a string A, repeatedly replace every $ in S with the previous result, then print characters from position min to max after N runs.Medium4StringRecursion+2No attempts yet2s128 MBJudgeable
Raising the Win RateGiven total games X and wins Y, find the minimum extra consecutive wins needed to raise the floor(100*Y/X) displayed win rate, or report -1 if impossible.Medium4MathBinary search+1No attempts yet2s128 MBJudgeable
GiftsFind the maximum cube side length A so that N cubes of size A can fit inside an L×W×H box, using binary search on A.Medium4Binary searchMathNo attempts yet2s128 MBJudgeable
Building Rest StopsGiven existing rest stops on a highway, place M new integer-position stops to minimize the longest gap between consecutive stops, found via binary search.Medium4Binary searchGreedy+1No attempts yet2s128 MBJudgeable
Cable CuttingGiven K cable lengths, binary search the maximum integer cut length so that summing floor(length/cut) over all cables reaches at least N pieces.Medium4Binary searchGreedy+1No attempts yet2s128 MBJudgeable
K-th Digit in a Concatenated Number StringGiven N and k, find the k-th digit in the concatenation of integers 1 through N, or -1 if the string is shorter than k.Medium4MathBinary search+1No attempts yet2s64 MBJudgeable
Box NestingFind the length of the longest strictly increasing subsequence of box sizes given in order.Medium4Dynamic programmingBinary search+1No attempts yet2s128 MBJudgeable
Router InstallationGiven house coordinates, place C routers among them to maximize the minimum pairwise distance between chosen routers.Medium4Binary searchGreedy+1No attempts yet2s128 MBJudgeable
Choose Two Numbers With Minimum DifferenceGiven N integers and threshold M, find the minimum absolute difference between two elements that is still at least M.Medium4SortingTwo pointers+1No attempts yet2s128 MBJudgeable
Find the Binary NumberGiven N, L, and I, output the I-th binary string of length N (with at most L ones) in increasing numeric order.Medium4CombinatoricsBinary search+1No attempts yet2s128 MBJudgeable
Guitar LessonSplit an ordered array into M contiguous groups so the maximum group sum is as small as possible, using binary search on the answer.Medium4Binary searchGreedy+1No attempts yet2s128 MBJudgeable
Semiconductor DesignGiven a permutation of port connections, find the longest increasing subsequence to avoid crossing lines.Medium4Dynamic programmingBinary searchNo attempts yet2s128 MBJudgeable
File Similarity ChecksGiven N file sizes, count pairs where the smaller size is at least 0.9 times the larger size.Medium4SortingTwo pointers+1No attempts yet1s128 MBJudgeable
Budget AllocationGiven budget requests and a total cap, find the maximum integer cap value such that capping requests at that value keeps the total within budget.Medium4Binary searchGreedyNo attempts yet1s128 MBJudgeable
Tree CuttingBinary search for the maximum saw height H so that trimming all trees above H yields at least M meters of wood total.Medium4Binary searchGreedyNo attempts yet1s256 MBJudgeable
Bridging SignalsGiven a permutation of wire connections between two ports, find the longest increasing subsequence to maximize non-crossing signals.Medium4Binary searchDynamic programming+1No attempts yet1s128 MBJudgeable
Immigration InspectionGiven N counters with per-person processing times and M travelers, find the minimum time to process everyone using binary search on the answer.Medium4Binary searchMathNo attempts yet1s128 MBJudgeable
ClassGiven n students and an r by c grid of desks, find the maximum achievable value k such that some row and some column can each have k occupied desks.Medium4MathGreedy+1No attempts yet3s256 MBJudgeable
Rising TrendFor each test case, compute the length of the longest strictly increasing subsequence in a sequence of up to 100000 prices.Medium4Dynamic programmingBinary search+1No attempts yet1s128 MBJudgeable
Cube RootCompute the cube root of very large integers (up to 150 digits) truncated to 10 decimal places, for multiple test cases.Medium4MathBinary search+1No attempts yet1s128 MBJudgeable
Trick or TreatFind the point on the x-axis minimizing the maximum distance to a set of given points, an application of ternary search on a convex function.Medium4Binary searchMath+1No attempts yet1s128 MBJudgeable
Happy Phone CallFor each query time window, count how many given phone-call intervals overlap it by at least one second, across multiple test cases.Medium4IntervalsSorting+1No attempts yet2s128 MBJudgeable
Room PaintingGiven n can sizes and m paint requirements, sum the waste from picking for each colour the smallest can whose size is at least the requirement.Medium4SortingBinary searchNo attempts yet1s128 MBJudgeable
PseudoprimeFor each pair p and a, decide whether p is composite and satisfies a^p mod p == a, printing yes or no.Medium4MathNumber theory+2No attempts yet1s128 MBJudgeable
RootFor each pair B and N, find the positive integer A that makes A^N as close to B as possible.Medium4Binary searchMath+2No attempts yet1s128 MBJudgeable
PizzaGiven store positions on a circular road and delivery points, sum the distance from each point to its nearest store.Medium4Binary searchArray+1No attempts yet2s128 MBJudgeable
Music NotesGiven note durations that divide a timeline into consecutive intervals, answer queries asking which 1-based note covers a given time. Use prefix sums and binary search.Medium4Prefix sumBinary search+2No attempts yet1s128 MBJudgeable
Find the Playing NoteGiven note durations that partition a timeline, answer queries asking which note covers a given beat by locating the prefix sum that brackets it.Medium4Prefix sumBinary search+2No attempts yet1s128 MBJudgeable
Long Distance RacingGiven a terrain string and per-unit times, find the farthest segment index k whose round-trip time stays within M seconds.Medium4ArrayPrefix sum+2No attempts yet1s128 MBJudgeable
Hungry CowsGiven a sequence of N cow brands, find the length of the longest strictly increasing subsequence in the given order.Medium4Dynamic programmingBinary search+2No attempts yet1s128 MBJudgeable
Intergalactic MortgageSimulate monthly compound interest at r/12 percent on a debt, subtract a fixed payment, and report whether the balance reaches zero within N years.Medium4SimulationMath+2No attempts yet1s128 MBJudgeable
Overlapping MapsGiven a smaller rotated, scaled map lying inside a larger one, find the unique point that represents the same location on both maps.Medium4GeometryMath+2No attempts yet1s128 MBJudgeable
Making a BoxGiven a square panel of side a, find the corner cut b in (0, a/2) that maximizes the open box volume b(a-2b)^2.Medium4MathBinary searchNo attempts yet1s128 MBJudgeable
To Eat or Be EatenCount pairs where an A creature is strictly larger than a B creature, given two lists of sizes.Medium4SortingTwo pointers+2No attempts yet1s256 MBJudgeable
Longest Ordered SubsequenceGiven a sequence of N integers, find the length of the longest non-decreasing subsequence.Medium4Dynamic programmingArray+2No attempts yet1s128 MBJudgeable
CalendarsConvert each given date to its day of year with one calendar, then locate the matching month and day in the other calendar.Medium4Prefix sumBinary searchNo attempts yet1s512 MBJudgeable
Missile ProtectorSelect the most missiles that form a non-decreasing height sequence in arrival order.Medium4Dynamic programmingBinary searchNo attempts yet1s128 MBJudgeable
Starship Hakodate-maruGiven a limit up to 151200, find the largest amount that splits into a cube plus a tetrahedral number.Medium4Brute forceSorting+2No attempts yet1s128 MBJudgeable
Rate of ReturnFind the monthly rate that makes the compounded deposits equal the reported fund value.Medium4Binary searchMathNo attempts yet1s128 MBJudgeable
Euclidean TSPPick c to minimize the sum of the approximation runtime and the lengthened tour flight time, and print the best time and c.Medium4Binary searchMathNo attempts yet1s256 MBJudgeable
Longest Increasing SubsequenceFind the length of the longest strictly increasing subsequence of the given sequence.Medium4Dynamic programmingBinary searchNo attempts yet1s256 MBJudgeable
Mingyun's SchemeGiven N cards in order, compute the length of the longest strictly increasing subsequence.Medium4Dynamic programmingBinary searchNo attempts yet1s256 MBJudgeable
Points on a SegmentCount how many of N distinct points fall inside each of M closed intervals on a line.Medium4Binary searchSortingNo attempts yet1s256 MBJudgeable
Odd Even SequenceFind the Nth term of the increasing sequence formed by blocks of 1 odd, 2 evens, 3 odds, and so on.Medium4MathBinary searchNo attempts yet2s256 MBJudgeable
Angry Cows (Silver)Find the smallest integer blast radius R so K intervals of length 2R cover all N hay bale positions on a line.Medium4Binary searchGreedy+1No attempts yet2s512 MBJudgeable
Stock Purchase PlanFor each test case, decide whether the daily prices contain a strictly increasing subsequence of length K.Medium4Dynamic programmingBinary searchNo attempts yet5s512 MBJudgeable
Longest Increasing Subsequence 2Given up to 1,000,000 numbers, compute the length of the longest strictly increasing subsequence.Medium4Binary searchDynamic programmingNo attempts yet1s512 MBJudgeable
DolphinGiven a position n, print the n-th phrase in the repeating block-based dolphin sequence.Medium4MathBinary search+1No attempts yet1s512 MBJudgeable
Coast GuardDecide whether a coast guard boat can intercept a thief heading straight out to sea 12 miles away, given their speeds and starting distance apart.Medium4GeometryMath+2No attempts yet2s512 MBJudgeable
Ax+Bsin(x)=CGiven A, B, C with B <= A, find the unique real x solving Ax + B*sin(x) = C, rounded to six decimals.Medium4Binary searchMathNo attempts yet2s512 MBJudgeable
Counting HaybalesGiven N distinct haybale positions and Q interval queries, count how many positions fall inside each inclusive range [A, B].Medium4SortingBinary search+2No attempts yet2s512 MBJudgeable
Box PackingGiven box sizes in order, find the longest subsequence where each box is strictly smaller than the next, counting boxes in the pile.Medium4Dynamic programmingBinary search+2No attempts yet2s512 MBJudgeable
Rebel Against The Empire (Small)Given stationary points in 3D, find the smallest jump radius that lets you reach asteroid 1 from asteroid 0, ignoring the time limit.Medium4GraphUnion-find+2No attempts yet5s512 MBJudgeable
Need for SpeedGiven segment distances and speedometer readings plus a total time, find the constant offset c making the summed travel times equal t.Medium4Binary searchMath+1No attempts yet1s512 MBJudgeable
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.Medium4Dynamic programmingBinary search+2No attempts yet2s256 MBJudgeable
Ax+Bsin(x)=C IIFind the unique positive x with Ax + B sin(x) = C, given 0 < B <= A, and print it to nine decimals.Medium4Binary searchMathNo attempts yet2s512 MBJudgeable
Halfway PointGiven n, find the value printed when the pair-comparison loop reaches its halfway point (the last item index printed there).Medium4Binary searchMath+2No attempts yet1s512 MBJudgeable
Heart RateGiven a beat count b over p seconds, find the lower and upper bounds on the constant-interval heart rate that could produce it, plus the estimate 60b/p.Medium4MathImplementation+2No attempts yet2s512 MBJudgeable
Wizard of OddsGiven N possible secret numbers and K yes/no questions, decide whether K adaptive questions always identify the number, where K questions distinguish at most 2^K outcomes.Medium4MathBinary search+2No attempts yet2s512 MBJudgeable
Heroes of the Storm ProgamerGiven N character levels and a total increase K, raise levels to maximize the minimum of the chosen sequence.Medium4GreedySorting+1No attempts yet2s512 MBJudgeable
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.Medium4Binary searchSorting+2No attempts yet2s512 MBJudgeable
Cap SizeGiven cap sizes tried on with fit feedback, count how many untried sizes could still fit, or report inconsistent feedback.Medium4ImplementationSorting+2No attempts yet2s512 MBJudgeable
Dome ConstructionGiven n points in 3D with non-negative y, find the minimum radius of a dome (hemisphere on the xz-plane) that contains at least k of them.Medium4Binary searchGeometry+2No attempts yet2s512 MBJudgeable
MooBuzzGiven N up to 1e9, find the Nth positive integer that is not a multiple of 3 or 5, since those turns are replaced by Moo.Medium4MathBinary search+2No attempts yet1s512 MBJudgeable
Where Am I?Given a string of N mailbox colors, find the smallest K such that all length-K substrings are distinct. The answer is always at most N.Medium4StringBrute force+2No attempts yet1s512 MBJudgeable
Round TripA runner travels out and back along N courses given by their lengths; given total distance K, print which course the runner is on or about to enter.Medium4ArrayPrefix sum+2No attempts yet1s256 MBJudgeable
Arranging SoldiersGiven a sequence of N combat powers, find the minimum number of soldiers to remove so the remaining values are in strictly decreasing order.Medium4Dynamic programmingArray+2No attempts yet1s256 MBJudgeable
Coordinate CompressionFor each of N coordinates, output the number of distinct values smaller than it, which is its rank under coordinate compression.Medium4SortingHash map+2No attempts yet2s512 MBJudgeable
K-th NumberFind the k-th smallest value in the N x N multiplication table using binary search with a counting function.Medium5Binary searchMathNo attempts yet2s128 MBJudgeable
Tangled Electric WiresGiven a matching between left and right poles, find the minimum number of wires to cut so no two remaining wires cross, which reduces to computing N minus the longest increasing subsequence.Medium5Dynamic programmingBinary search+1No attempts yet1s128 MBJudgeable