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,178 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| DiamondsFor each count Pmin, find the smallest radius whose worst-case center covers at least Pmin points, then the best coverage at that radius. | Medium6 | GeometryPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TicketsSplit L pages of non-increasing popularity into D contiguous channel blocks to minimize the popularity-weighted sum of within-block delay positions, breaking ties by the lexicographically smallest block boundaries. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SeriesWrite all integers from n to m as one digit string, sort the digits descending, and report the k-th digit, or NAV if the string is shorter. | Medium6 | MathImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| DragonPick two disjoint blocks of at most K consecutive heads each in a row of N heads to maximize the total fire power removed. | Medium6 | Dynamic programmingPrefix sum+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Food CompositionGiven ingredients in decreasing order, some with stated percentages, find the minimum and maximum possible percentage for each, or report impossibility. | Medium6 | GreedyMath+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| LawnmowerSimulate a lawn that grows each morning and is mowed b_j times per day, reporting the total remaining grass height after each day. | Medium6 | SortingPrefix sum+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Optimal KeypadSplit a 30-character alphabet tape into 12 labeled pieces to minimize total keystrokes for a word dictionary, printing the lexicographically smallest optimal cut string. | Medium6 | Dynamic programmingPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| AdvertisementPlace the fewest advertisements so every jogger's interval of billboards contains at least min(K, length) of them. | Medium6 | GreedyIntervals+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Graveyard DesignFind all runs of consecutive positive integers whose squares sum to a given n up to 10^14, and list each run in order of its smallest element. | Medium6 | Two pointersMath+2 | No attempts yet | 2s | 64 MB | Judgeable |
| Sum of Consecutive PrimesFor each query set of counts, find the smallest prime expressible as a sum of exactly n_i consecutive primes for every given n_i. | Medium6 | Number theoryPrefix sum+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Castle WallsGiven blue and red hooks with distinct line positions, count blue-red pairs whose endpoints satisfy the crossing inequality. | Medium6 | SortingPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| ProbeGiven range-sum probe results on a length-K binary road, find the lexicographically smallest object placement satisfying all of them, or NONE. | Medium6 | ArrayPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Burger, French Fries, Soft DrinkCount the ways to cut a B/F/S stream into N consecutive blocks where every block has equal positive counts of each letter, or report Impossible. | Medium6 | Dynamic programmingPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Adventure in Panda Land Part I: Panda NumberSum the bamboo-stick counts of the Panda numeral representation for every integer from A to B, including negatives and zero. | Medium6 | MathImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Pizza Delivery ScheduleGiven recorded pizza deliveries by week and weekday, find the fixed weekly-cycle schedule of period 1 to 4 weeks that minimizes mismatched days. | Medium6 | Brute forceImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SignalGiven sequence s and a pattern f, find the smallest starting position where f occurs as a contiguous block that can be one of exactly k fragments of lengths in [a,b]. | Medium6 | String matchingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| A Journey to MarsFor each station on a circle, decide whether starting there with two direction choices lets Byteazar complete a full loop without running out of fuel. | Medium6 | GreedyPrefix sum+1 | No attempts yet | 3s | 512 MB | Judgeable |
| One-sequenceFind the lexicographically smallest walk of length n starting at 0 with +/-1 steps whose total sum is S, or report that none exists. | Medium6 | GreedyImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TeddiesCount the distinct safe arrangements of up to 152 teddies in four models so that no three consecutive share a letter or a digit, modulo 1000000. | Medium6 | Dynamic programmingCombinatorics+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Fairy LightsFor each pressed button, compute the limiting fraction of integers whose final color is that button's color. | Medium6 | MathNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| PebblesPiles are sorted; a move reduces one pile without breaking the order. Determine whether the first player wins. | Medium6 | Game theoryGreedy+1 | No attempts yet | 3s | 512 MB | Judgeable |
| Two CakesTwo cakes must be built layer by layer from two given permutations, using one dedicated worker per layer type; find the minimum total time. | Medium6 | GreedyArray+2 | No attempts yet | 4s | 128 MB | Judgeable |
| CoinsGiven a string of O and R tosses, find the longest substring where the number of O equals k times the number of R. | Medium6 | Prefix sumHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Crossing DiagonalsCount crossing pairs among m chosen diagonals of a regular n-gon, ignoring diagonals that only share a vertex. | Medium6 | SortingPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SafeGiven a word and one rotation offset per wheel, find the minimum total turns to make all wheels display the same word. | Medium6 | StringImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SheetsStarting from sheets 1..n, each step merges the first k into their sum appended at the end; report the sum written during the r-th step. | Medium6 | MathSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| InversionsCount permutations of size n that have exactly k inversions, modulo 30011, using the Mahonian number recurrence with a sliding window over prefix sums. | Medium6 | Dynamic programmingCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Speed LimitsGiven speed limits on intervals of a highway plus a car's top speed, pick the single limit whose removal maximizes total satisfaction (distance times speed). | Medium6 | ArrayPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| PolynomialGiven a degree-n polynomial's values at 0 through n, compute its value at n+1. | Medium6 | MathPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| MapGiven an n by m grid and q queries, each comparing two h by w subrectangles, decide if at most k corresponding cells differ. | Medium6 | Prefix sumMatrix+1 | No attempts yet | 1s | 128 MB | Judgeable |
| RaceFind the length-m segment of the road that minimizes total riding time under piecewise constant speed limits. | Medium6 | Sliding windowPrefix sum+1 | No attempts yet | 1s | 512 MB | Judgeable |
| AquaparkSum the grid values inside the Manhattan diamond of radius l_i around each lifeguard. | Medium6 | Prefix sumMatrix | No attempts yet | 1s | 512 MB | Judgeable |
| Triangle SticksThe program keeps the largest subset of up to 30000 sticks with lengths 1 to 500 in which any three sticks form a non-degenerate triangle. | Medium6 | SortingBrute force+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Bajhattan PanoramaGiven row maxima and column maxima, test whether any grid fits them and compute the largest possible total height. | Medium6 | GreedySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| DominoChoose the smallest chain from the first to the last domino where each kept tile is taller than the distance to the next kept tile. | Medium6 | GreedyPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| ClocksPick one time every clock can show so the total forward movement from the current readings is as small as possible. | Medium6 | SortingPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| CookiesBoth players take the best remaining cookie in turn with Zbyszek starting, and you add at most one cookie of any quality to minimize his total minus Hektor's. | Medium6 | SortingPrefix sum+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Powerbase FormatCount how many integers in each query range lack a powerbase form d1^1+...+dL^L within the length bound using the given digits. | Medium6 | BacktrackingDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Paper MapTry every horizontal and vertical shift of the fixed sheet grid and print the smallest number of sheets that covers all marked cells. | Medium6 | Brute forcePrefix sum | No attempts yet | 3s | 128 MB | Judgeable |
| CirclelandYou start at room R1 on a corridor cycle and visit every room, then leave through any exit while walking the shortest total corridor distance. | Medium6 | GreedyPrefix sum+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Omar Loves CandiesFind the largest sum of any non-empty sub-rectangle in a grid whose rows and columns strictly increase. | Medium6 | Prefix sumGreedy+1 | No attempts yet | 3s | 128 MB | Judgeable |
| BitTorrentChoose the most files whose covering fixed-size pieces fit in the bandwidth budget, where a piece shared by files is paid once. | Medium6 | Dynamic programmingPrefix sum | No attempts yet | 2s | 128 MB | Judgeable |
| Building a Ski CourseFind the largest square stamp size that can repaint the given rough and smooth grid when later stamps cover earlier ones. | Medium6 | GreedyPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SabotageRemove a contiguous block of middle machines, keeping the first and last, so the average output of the machines left is as small as possible. | Medium6 | Binary searchPrefix sum | No attempts yet | 1s | 128 MB | Judgeable |
| Fair PhotographyCows at distinct positions are white or spotted, and after repainting some white cows you need the widest interval with equal counts. | Medium6 | Prefix sumHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| IOI ManjuChoose boxes and fill them with the priciest manju so packed value minus box cost is as large as possible. | Medium6 | Dynamic programmingSorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| OrchardPick one rectangle for Bert to minimize the bananas left outside it plus the apples inside it. | Medium6 | MatrixPrefix sum+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Decreasing Sequences of PointsCount sequences of lattice points on the diagonals x+y=a_i with nondecreasing x and nonincreasing y. | Medium6 | Dynamic programmingPrefix sum | No attempts yet | 1s | 256 MB | Judgeable |
| Tinted Glass WindowN overlapping rectangles each add an integer tint to the area they cover, and you must find the total area whose summed tint is at least T. | Medium6 | Prefix sumSorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| King GruffFor each query, sum the shutdown costs of roads lying on some A to B path whose total length is at most D. | Medium6 | Shortest pathSorting+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Quality of LivingFind the smallest median among all H by W subrectangles of a grid holding the numbers 1 to R times C. | Medium6 | Binary searchPrefix sum+1 | No attempts yet | 5s | 256 MB | Judgeable |
| Lift ProblemsDecide the lift stops for given per-floor student counts to minimize total annoyance from stops and skipped floors. | Medium6 | Dynamic programmingPrefix sum | No attempts yet | 1s | 256 MB | Judgeable |
| BricksSplit the run-length encoded brick row into the most contiguous blocks that all share one white-to-black ratio. | Medium6 | GreedyPrefix sum+1 | No attempts yet | 6s | 256 MB | Judgeable |
| Knapsack CollectionOver every starting slot, find the min, max, and average time to collect all bags from a rotating carousel when each pickup takes t units. | Medium6 | SortingPrefix sum+1 | No attempts yet | 4s | 512 MB | Judgeable |
| Christmas WheatMirko raises one shortest stalk to the next height and Slavko lowers one tallest stalk until two distinct heights remain; report the winner and both extremes. | Medium6 | SortingPrefix sum+2 | No attempts yet | 1s | 32 MB | Judgeable |
| Concatenating Parenthesis StringsDecide whether the given parenthesis strings can be ordered so their concatenation forms a correct bracket sequence. | Medium6 | GreedySorting+1 | No attempts yet | 2s | 128 MB | Judgeable |
| JOI ParkPick a distance X from square 1 to minimize C times X plus the total length of roads not fully inside the X radius. | Medium6 | Shortest pathSorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Maximum Average SegmentFind the largest average over all contiguous subarrays of length at least K and print it truncated to six decimals. | Medium6 | Binary searchPrefix sum | No attempts yet | 1s | 64 MB | Judgeable |
| Cow HopscotchCount paths from the top-left to the bottom-right cell that step strictly down and right onto a different value, modulo 1000000007. | Medium6 | Dynamic programmingPrefix sum+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Picky EaterCut the convex polygon along one diagonal between nonadjacent vertices and eat the largest piece that contains no olive. | Medium6 | GeometryBrute force+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Interval CompositionFind the maximum length L such that each of the two lowercase strings has a contiguous block of length L with the same letter counts. | Medium6 | Prefix sumHash map+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Catching EggsCount the homes inside each of m axis-parallel rectangles and print the total over all days per test case. | Medium6 | Prefix sumSorting+1 | No attempts yet | 5s | 256 MB | Judgeable |
| Apples and BananasPick a path from the top left to the bottom right using right, down, and diagonal steps to maximize apples left below plus bananas left above. | Medium6 | Dynamic programmingPrefix sum | No attempts yet | 1s | 256 MB | Judgeable |
| Merging FilesCompute the cheapest way to merge consecutive chapter files when each merge costs the sum of the two parts. | Medium6 | Dynamic programmingIntervals+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Railway TicketsCount station pairs where every leg has a free seat but no single seat stays free for the whole trip. | Medium6 | IntervalsSorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Currency ConversionSchedule at most b bank exchanges to meet dated purchase needs while maximizing daily holding rewards minus trip costs. | Medium6 | Dynamic programmingPrefix sum | No attempts yet | 1s | 256 MB | Judgeable |
| Average Voodoo Doll PriceCount the contiguous runs of days whose average doll price is at least P. | Medium6 | Prefix sumDivide and conquer+1 | No attempts yet | 2s | 64 MB | Judgeable |
| Landscape ImprovedPlace up to n stones on a rocky skyline under pyramid support rules to push the highest peak as high as possible. | Medium6 | Binary searchPrefix sum | No attempts yet | 1s | 256 MB | Judgeable |
| UFOSimulate laser shots that each destroy up to R blocks at height h along one row or column, then find the P by P square holding the most surviving blocks. | Medium6 | Segment treeSimulation+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Multi-pianoChoose a nonnegative step K so the walk that starts at the first pitch and moves by K on each rise or fall matches the true pitches in the most positions. | Medium6 | Hash mapPrefix sum+1 | No attempts yet | 1s | 64 MB | Judgeable |
| XorbonacciGiven the first K terms of an XOR recurrence, answer many queries asking for the XOR of terms l through r with indices up to 1e18. | Medium6 | MathPrefix sum+1 | No attempts yet | 1s | 64 MB | Judgeable |
| Max FlowCount how many of the K given tree paths pass through each stall and report the largest count. | Medium6 | TreePrefix sum+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Fort MooFind the largest interior area of a grid rectangle whose border cells are all grass, with swamp allowed inside. | Medium6 | Prefix sumBrute force+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Splitting the FieldCompute how much fenced area is saved by covering all points with two disjoint axis-aligned rectangles instead of one. | Medium6 | SortingPrefix sum+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Round Robin SchedulerGiven each job's required seconds, compute its finishing time under a round robin scheduler that grants one second per turn in index order. | Medium6 | SortingPrefix sum+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Smoothing Window (Small)Given sliding window sums of an unknown integer sequence, find the smallest possible range between its largest and smallest values. | Medium6 | Binary searchIntervals+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Magical, Marvelous TourArnar picks a contiguous segment, Solveig claims the largest of the three parts it creates, and Arnar keeps the rest. | Medium6 | Prefix sumTwo pointers | No attempts yet | 5s | 512 MB | Judgeable |
| Magical, Marvelous TourArnar names a middle interval and Solveig keeps the richest of the three pieces, so compute the split that leaves Arnar the most transistors. | Medium6 | Binary searchPrefix sum | No attempts yet | 5s | 512 MB | Judgeable |
| Meet and Party (Large)Pick an invited home inside the given rectangles that minimizes the total Manhattan distance walked by all guests and report its coordinates and the sum. | Medium6 | SortingPrefix sum+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Spinning Blade (Large)Find the largest K by K square, with its four corner cells removed, whose cell masses balance exactly about the square center. | Medium6 | Prefix sumBrute force | No attempts yet | 5s | 512 MB | Judgeable |
| Increasing Speed LimitsGiven a sequence generated by a small recurrence, count strictly increasing subsequences by position, modulo 1000000007. | Medium6 | Dynamic programmingSorting+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Number Sets (Large)Given an interval of consecutive integers and a threshold P, merge pairs sharing a prime factor of at least P, then count the remaining sets. | Medium6 | Union-findNumber theory+2 | No attempts yet | 50s | 512 MB | Judgeable |
| Gennady is smartMaintain counts on a hexagonal grid; each update adds 1 to all cells within distance r of (x, y), and queries ask for a single cell's value. | Medium6 | Prefix sumMatrix+1 | No attempts yet | 2s | 256 MB | Judgeable |
| UniversitiesOn a tree whose nodes are black or white with weighted happiness, find the maximum total weight of a path that contains equally many black and white nodes. | Medium6 | TreePrefix sum+1 | No attempts yet | 1s | 1024 MB | Judgeable |
| Building HeightsWith building 1 at height 0, adjacent heights differing by at most K, and M caps, find the maximum achievable height of any building. | Medium6 | GreedyImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Time Travel and MultisetProcess insert, delete, and count operations on a time-indexed multiset, where each value's count at time t depends on prior operations with time at most t. | Medium6 | Dynamic programmingBinary search+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Colorful Village 2For each query range in a nondecreasing brightness array, report how many times the most frequent value appears. | Medium6 | ArrayBinary search+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Mountain ScenesCount vectors of w heights in [0,h] whose sum is at most n and which are not all equal, modulo 1e9+7. | Medium6 | Dynamic programmingCombinatorics+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Divisors AgainFor each of up to 10 ranges of at most 1001 integers, find the number in [L, U] with the most divisors. | Medium6 | Number theoryPrefix sum+1 | No attempts yet | 2s | 512 MB | Judgeable |
| OR Score of a SequenceSplit the array into K contiguous non-empty groups and maximize the sum of each group's bitwise OR. | Medium6 | Dynamic programmingBit manipulation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Sequence Sorting QueriesGiven a sequence, each query sorts it, adds X to the elements at positions L through R, and sorts again; output the final sorted sequence. | Medium6 | SortingImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| BracketsGiven a bracket string, decide whether flipping the brackets in at most one contiguous segment can turn the whole string into a balanced, valid bracket sequence. | Medium6 | GreedyPrefix sum+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Go--Given a board with black and white stones, count the square sub-areas that contain stones of only one color and report the two totals. | Medium6 | Prefix sumMatrix+1 | No attempts yet | 1s | 512 MB | Judgeable |
| XOR Sum 3Compute the XOR of every contiguous subsequence of A and print the sum of all those XOR values. | Medium6 | Bit manipulationPrefix sum+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Painting the fencePick a pairwise non-overlapping set of intervals to cover as many of the n slats as possible, then report the number left unpainted. | Medium6 | SortingDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Eleven LoverFor each number given as a digit string, count its substrings with no leading zero that are divisible by 11. | Medium6 | MathPrefix sum+1 | No attempts yet | 8s | 512 MB | Judgeable |
| Area between a lattice path and its chordGiven a monotone path of up and right steps, compute the total area between the path and the straight chord from start to end. | Medium6 | GeometryPrefix sum+2 | No attempts yet | 8s | 512 MB | Judgeable |
| University RankingsGiven M rankings of N universities, find the longest sequence where each earlier university beats the next in every ranking. | Medium6 | Dynamic programmingSorting+1 | No attempts yet | 8s | 512 MB | Judgeable |
| Merging Files 2Given the sizes of K consecutive chapter files, find the minimum total cost of merging them two at a time into one file, where each merge costs the sum of the two sizes. | Medium6 | Dynamic programmingPrefix sum | No attempts yet | 6s | 512 MB | Judgeable |
| Mirko's averageAfter each pair of position updates, report whether Mirko's repeated pairwise average increased, decreased, or stayed the same. | Medium6 | MathImplementation+1 | No attempts yet | 2s | 512 MB | Judgeable |