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,177 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| ServerCount how many jobs from the front finish in request order before their total duration exceeds T. | Easy1 | Prefix sumSimulation | No attempts yet | 1s | 256 MB | Judgeable |
| Subin and the SequenceGiven the prefix averages of a sequence, recover the original sequence term by term. | Easy1 | Prefix sumMath | No attempts yet | 1s | 32 MB | Judgeable |
| 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. | Easy2 | Prefix sumBinary search+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Super MarioGiven 10 mushroom scores, pick a prefix sum closest to 100 (preferring the larger one on ties) as Mario's final score. | Easy2 | ArrayBrute force+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Tetrahedral Stacks of CannonballsFor each of n queries, read the base side length and print the problem number, the side length, and the total cannonballs in a tetrahedral stack of that size. | Easy2 | MathImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Magnificent MeatballsGiven a circular list of guest meatball counts, find the position k where the sum of positions 1 through k equals the sum of the rest. | Easy2 | ArrayPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Hay ExpensesGiven N daily hay counts and Q ranges, output the sum of counts over each range from S to E inclusive. | Easy2 | Prefix sumArray | No attempts yet | 1s | 128 MB | Judgeable |
| ParkFor each of up to one million heights in order, output the maximum height to its west and to its east, using its own height when no higher point exists. | Easy2 | Prefix sumArray | No attempts yet | 1s | 512 MB | Judgeable |
| Shoe FactoryChoose the price p from 1 to N that maximizes the count of buyers willing to pay p times the margin p minus K. | Easy2 | Prefix sumBrute force | No attempts yet | 1s | 128 MB | Judgeable |
| Negative People in Da HouseGiven each test case's sequence of entries and exits, compute the smallest initial occupancy that keeps the count nonnegative throughout. | Easy2 | Prefix sumSimulation | No attempts yet | 1s | 256 MB | Judgeable |
| Are we there yet?Given four distances between consecutive cities on a line, print the full 5x5 table of distances between every pair of cities. | Easy2 | ArrayPrefix sum+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Tour de BINUSSum students over Ayu's left or right walk from x1 and count zero-valued rooms over Budi's walk from x2. | Easy2 | ArrayPrefix sum+1 | No attempts yet | 1s | 512 MB | Judgeable |
| ∑|ΔEasyMAX|Given a sequence of tempos, answer queries that ask for the sum of absolute differences between consecutive values over a range. | Easy2 | Prefix sumArray+2 | No attempts yet | 1s | 256 MB | Judgeable |
| TrolGiven an array where A[i] is the digital root of i for i from 1 to 260, answer Q queries asking for the sum over a range [l, r]. | Easy2 | Prefix sumMath+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Lucky TicketFind the longest even-length substring of a digit string whose first half digit sum equals its second half digit sum. | Easy3 | Prefix sumBrute force+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Sum of Numbers 2Given N positive integers and a target M, count contiguous subarrays whose sum equals M. | Easy3 | Two pointersPrefix sum+1 | No attempts yet | 0.5s | 128 MB | Judgeable |
| 2D Array Range SumBuild a 2D prefix sum over an N by M grid and answer up to 10,000 rectangle sum queries in O(1) each. | Easy3 | Prefix sumMatrix+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Temperature SequenceFind the maximum sum of any K consecutive elements in an array of N temperatures. | Easy3 | Sliding windowPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Equal-Sum SegmentsSplit an array into contiguous segments with equal sums and output the smallest possible such common sum. | Easy3 | Prefix sumGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Average SpeedTrack a car's speed changes over time and answer queries asking the total distance travelled up to a given elapsed time. | Easy3 | SimulationImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Mad ScientistRecover a non-decreasing sequence of measurements from its cumulative counts P(j), the number of measurements at most j, for each j from 1 to k. | Easy3 | ArrayPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| HangoverFor each target overhang c, find the smallest n such that the harmonic sum 1/2 + 1/3 + ... + 1/(n+1) reaches c, and report n. | Easy3 | MathImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Gold CoinsFor each number of days, add up the gold coins when the knight is paid N coins on each of N consecutive days. | Easy3 | MathImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The TravelerGiven gaps between n towns and a walk of m east/west jumps, find the total distance covered, reported mod 100000. | Easy3 | Prefix sumArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Maximum SumGiven n integers and a window size k, find the largest sum of any k consecutive terms. | Easy3 | ArraySliding window+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Line of Best FitGiven n points in the plane, compute the slope and intercept of the least squares regression line and print each rounded to three decimals. | Easy3 | MathImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Find the CowCount ordered pairs of indices (x, y) with x < y where an "((" starts at x and a "))" starts at y in a parenthesis string. | Easy3 | StringPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ProfitsGiven a sequence of N daily profits, find the maximum sum over any contiguous stretch of days. | Easy3 | ArrayDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Good GrassFind the 3x3 subgrid with the largest sum in a grid of milk values and report that sum with the upper-left corner, breaking ties by smallest row then column. | Easy3 | ArrayPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Balancing Bank AccountsGiven transactions among travelers, compute each person's net balance and print the canonical chain of payments using prefix sums. | Easy3 | Prefix sumHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Trimmed and Corrected MeanGiven N judge scores and an integer K, sort the scores, then output the trimmed mean that drops K from each end and the corrected mean that replaces those extremes with the nearest kept value, both rounded to two decimals. | Easy3 | SortingPrefix sum+2 | No attempts yet | 1s | 256 MB | Judgeable |
| MillenniumGiven a birthdate in a fictional 10-month calendar with alternating 19 and 20 day months, find days until year 1000, month 1, day 1. | Easy3 | MathImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| FishingFind the starting day among the first N days whose window of k consecutive days contains the most rainy days, choosing the smallest index on a tie. | Easy3 | Sliding windowArray+1 | No attempts yet | 1s | 1024 MB | Judgeable |
| EquationsGiven sums of each number paired with the last number, plus the total sum, recover all N original numbers. | Easy3 | MathImplementation+1 | No attempts yet | 1s | 1024 MB | Judgeable |
| Ancient KeyboardSimulate a keyboard where each of up to 26 keys toggles an LED at two given times, and output the letter matching the LED count at each time step until all intervals end. | Easy3 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Easy TradingGiven daily prices, compute moving averages over the last m and n days and print a buy or sell signal whenever the trend between them reverses. | Easy3 | ArrayPrefix sum+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Big NumberFor each m up to 10^7, print the number of decimal digits in m factorial. | Easy3 | MathNumber theory+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Passing CarsCount pairs of cars moving toward each other where an eastbound car stands west of a westbound car. | Easy3 | Prefix sumArray | No attempts yet | 1s | 128 MB | Judgeable |
| Two TowersRemove the fewest blocks from the tops of two towers so the remaining towers have equal height. | Easy3 | GreedyTwo pointers+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Cutting the TapeSplit the row of integers into two nonempty parts so the absolute difference of the two part sums is as small as possible. | Easy3 | Prefix sumArray | No attempts yet | 1s | 128 MB | Judgeable |
| Consecutive GirlsFind the fewest boys to remove so that k girls stand side by side in a row of n boys and girls. | Easy3 | Sliding windowPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| CircuitsPick the most cables whose total battery voltage does not exceed their total wire tolerance. | Easy3 | SortingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| New Year's Eve Party LogCount the fewest entries and exits to add so the guest count never drops below zero and ends at zero. | Easy3 | GreedyPrefix sum | No attempts yet | 25s | 128 MB | Judgeable |
| Range Sum QueryAnswer many inclusive range sum queries on a static integer list using precomputed prefix sums. | Easy3 | Prefix sumArray | No attempts yet | 1s | 128 MB | Judgeable |
| Kri StringFind the length of the longest even-length contiguous substring of a digit string whose two halves have equal digit sums. | Easy3 | Prefix sumBrute force | No attempts yet | 1s | 256 MB | Judgeable |
| Bitcoin ProfitsGiven share difficulties, pick the integer k of at least 1 that maximizes k times the count of shares at or above k, breaking ties toward the smaller k. | Easy3 | SortingPrefix sum | No attempts yet | 2s | 256 MB | Judgeable |
| ATMReorder N people by withdrawal time so the sum of all waiting-plus-service finish times is as small as possible. | Easy3 | GreedySorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Counting Primes in a RangeCount the primes between m and n inclusive for each blank-line separated test case. | Easy3 | Number theoryPrefix sum | No attempts yet | 1s | 256 MB | Judgeable |
| Maximum Number of DivisorsYou answer each query with the largest divisor count among integers from 1 to N that are not multiples of P. | Easy3 | Number theoryPrefix sum | No attempts yet | 1s | 256 MB | Judgeable |
| Range Sum QueriesAnswer many range-sum queries over a static array by precomputing prefix sums and subtracting. | Easy3 | Prefix sum | No attempts yet | 1s | 256 MB | Judgeable |
| Range sum queriesAnswer many inclusive range-sum queries over a fixed list by precomputing prefix sums. | Easy3 | Prefix sumArray | No attempts yet | 1s | 256 MB | Judgeable |
| Russian FlagChoose the two row boundaries for the white, blue, and red bands so the number of repainted cells is smallest. | Easy3 | Brute forcePrefix sum | No attempts yet | 2s | 512 MB | Judgeable |
| Fly SwatterFind the K by K placement that encloses the most flies in its strict interior and print the count with the winning border drawn. | Easy3 | Prefix sumMatrix+1 | No attempts yet | 1s | 64 MB | Judgeable |
| Breed CountingGiven the breed of each cow in a row, report the count of each of the three breeds inside every query interval. | Easy3 | Prefix sumArray | No attempts yet | 2s | 512 MB | Judgeable |
| Building a House (Large)Find the area of the largest axis-aligned rectangle containing only grass or shrubs in a grid with fewer than 20 rock, water, or tree cells. | Easy3 | Brute forcePrefix sum+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Household Ledger (Easy)Maintain a ledger over N days with point additions and range-sum queries, printing the sum of entries from day p to day q. | Easy3 | Prefix sumArray | No attempts yet | 1s | 512 MB | Judgeable |
| Sweet part-time jobJunsu can work at most m consecutive days out of n days with given daily wages; find the maximum total pay for such a window. | Easy3 | Sliding windowPrefix sum+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Range Sum QueriesGiven a fixed array and m range queries, print the sum of elements between two given indices for each query. | Easy3 | Prefix sumArray | No attempts yet | 2s | 512 MB | Judgeable |
| Bitcoin investmentGiven a list of daily bitcoin prices, buy on one day and sell on that day or later to maximize the selling price minus the buying price. | Easy3 | ArrayGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Thief of the Circular VillageCount the starting positions of a circular window of M houses whose total amount stays below K. | Easy3 | Sliding windowPrefix sum+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Sum of Pairwise ProductsGiven N integers, sum the products of every pair of distinct positions. | Easy3 | MathArray+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Diwali lightingsGiven a pattern S repeated infinitely and a range [I, J], count how many bulbs in that range are blue. | Easy3 | MathPrefix sum+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Diwali lightings (Large)Given a pattern string repeated forever, count how many blue bulbs appear between positions I and J in the infinite sequence. | Easy3 | MathPrefix sum+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Why Did the Cow Cross the Road 5Given N traffic lights with B known broken positions, find the minimum number of broken lights to repair so that some K consecutive lights all work. | Easy3 | Sliding windowArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Easy3 | MathImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Mun, Hong, AnEach secretary adds one step to every stone in one direction from the start. Count total steps per stone modulo 3, then split P by the final blue, red, and green counts. | Easy3 | ImplementationPrefix sum+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Sum GameGiven two length-N sequences of daily scores, find the largest K where the prefix sums of both sequences are equal. | Easy3 | Prefix sumArray | No attempts yet | 1s | 512 MB | Judgeable |
| Progressive ScrambleEncrypt a message by cumulative sums of symbol values mod 27, and decrypt by inverting the same recurrence. | Easy3 | ImplementationMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Easy3 | Prefix sumBinary search | No attempts yet | 1s | 512 MB | Judgeable |
| 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. | Easy3 | SortingBinary search+2 | No attempts yet | 1s | 256 MB | Judgeable |
| What if a car takes the side of its owner, Kim Pyojun?For each window length k from 1 to N, find the starting index of the length-k subarray with the largest standard deviation, breaking ties by the smallest index. | Easy3 | ArrayPrefix sum+2 | No attempts yet | 1s | 512 MB | Judgeable |
| You Have To Solve This One!Sort the array, then answer range-sum queries over the sorted sequence efficiently. | Easy3 | SortingPrefix sum+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Sequence and Queries 37Maintain an array under point updates, and for range queries report how many entries are even or odd. | Easy3 | ArrayPrefix sum+2 | No attempts yet | 1s | 512 MB | Judgeable |
| 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. | Easy3 | MathImplementation+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| LabelsGiven the difference sequence D of an unknown sequence A with values in [1, N], output A if it is uniquely determined, otherwise -1. | Easy3 | ArrayImplementation+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| Maximum ProductSplit the array after one index so the product of the two part sums is maximized, and print that index. | Easy3 | Prefix sumArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Time ManagementGiven tasks with durations and deadlines, find the latest single start time so that all tasks scheduled back to back meet their deadlines, or report -1 if impossible. | Medium4 | GreedySorting+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Coffee Shop Game 2Given an array, answer Q online queries each asking a range sum (with swapped bounds allowed) followed by a point update. | Medium4 | Segment treePrefix sum+1 | No attempts yet | 2s | 256 MB | Judgeable |
| 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. | Medium4 | Prefix sumSimulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Overlapping SegmentsGiven N line segments on a number line, compute the maximum number of segments that overlap at any single point, not counting endpoint-only contacts. | Medium4 | IntervalsSorting+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Sum of Numbers 4Count the number of contiguous subarray sums of an array that equal a given target K, using prefix sums and a hash map. | Medium4 | Prefix sumHash map+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Range Sum Query with UpdatesSupport point updates and range-sum queries on an array of up to a million integers using a Fenwick tree or segment tree. | Medium4 | Segment treeArray+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Post OfficeGiven villages with positions and populations on a line, find the point minimizing total weighted distance, choosing the smallest position on ties. | Medium4 | SortingPrefix sum+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Collecting JewelsGiven N values in a line, find the maximum sum of a single contiguous run of length at least M taken once. | Medium4 | Prefix sumDynamic programming+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Sum of Numbers 7Support point updates and range sum queries on an array of up to 1,000,000 elements over up to 1,000,000 operations, requiring a Fenwick tree or segment tree. | Medium4 | Segment treePrefix sum+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Post OfficeGiven village coordinates and resident counts, find the smallest position minimizing total weighted distance to all residents (weighted median). | Medium4 | SortingPrefix sum+1 | No attempts yet | 2s | 128 MB | Judgeable |
| 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. | Medium4 | Binary searchGreedy+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Sum of DistancesGiven n points on a line, compute the sum of absolute distances over all ordered pairs efficiently using sorting and prefix sums. | Medium4 | SortingPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| FireflyGiven alternating stalagmite and stalactite lengths in a cave, find the flight height destroying the fewest obstacles and how many heights tie for that minimum. | Medium4 | Prefix sumArray | No attempts yet | 1s | 128 MB | Judgeable |
| DownloadGiven download times and playback durations of sequential song pieces, compute the earliest start time so playback never stalls waiting for a piece. | Medium4 | GreedyPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| The RiddleFind the minimum prefix length of a coin sequence so that all values from 1 to K are achievable as subset sums, using the classic greedy reachable-range extension, or report -1. | Medium4 | GreedyArray+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Divisible Contiguous SubarraysCount contiguous subarrays whose sum is divisible by a given d, using prefix sums modulo d and counting equal remainders. | Medium4 | Prefix sumHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| KnittingGiven a starting stitch count, a row total, and a repeating pattern of row change values, compute the sum of all row stitch counts for each project until the 0 0 0 terminator. | Medium4 | MathPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| sqrt log sinPrecompute x_i for all i up to 10^6 using the given recurrence with floating point floors, then answer each query modulo 10^6. | Medium4 | Dynamic programmingMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Baskets of Gold CoinsGiven the total weight of coins drawn with counts 1..N-1 from N baskets, find which basket holds the lighter coins. | Medium4 | MathBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Frodo SequenceGiven repeated values of n less than 2^31, print the n-th term of the sequence defined by Fro_n = Fro_{n-1} + Fro_{n-2} - Fro_{n-3}. | Medium4 | MathDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Planet ExplorationGiven a grid of jungle, sea, and ice cells, answer many rectangle queries by counting how many cells of each terrain type fall inside. | Medium4 | Prefix sumArray+2 | No attempts yet | 1s | 256 MB | Judgeable |
| GiftGiven each friend's item price and shipping cost and one coupon that halves a single item price, find the most gifts buyable within budget B. | Medium4 | SortingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Haybale StackingAdd one bale to every stack in each given range, then report the median height among all N stacks. | Medium4 | Prefix sumArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| 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. | Medium4 | Prefix sumBinary search+2 | No attempts yet | 1s | 128 MB | Judgeable |