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 results389 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Probability ExperimentCount the triples of given points on a circle that form an acute triangle. | Medium6 | Two pointersCombinatorics+1 | No attempts yet | 1s | 256 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 |
| Deceitful War (Large)Given both players' block weights, compute Naomi's optimal scores under honest play and under bluffed announcements. | Medium6 | GreedySorting+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Minimum weight spread for strong connectivityPick a strongly connected subgraph of a complete directed graph so the chosen edges' weight range is as small as possible. | Medium6 | GraphSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Fun box packingGiven N box sizes, nest a box inside another when the outer size is at least twice the inner, each box holds at most one, and minimize the number of visible (unnested) boxes. | Medium6 | GreedySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| RailroadGiven n intervals with distinct endpoint positions, find the maximum number of intervals fully contained in some segment of fixed length d. | Medium6 | SortingSliding window+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Why Did the Cow Cross the Road 4Match chickens, each available at a single time, to cows whose interval covers that time, so that as many cows as possible get help. | Medium6 | GreedySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Paired UpPair up M cows with given milk outputs to minimize the maximum sum in any pair, where each pair's time is A+B. Input gives counts and output values in compressed form. | Medium6 | GreedyTwo pointers+2 | No attempts yet | 2s | 512 MB | Judgeable |
| A rain of shooting starsPlace an axis-aligned square of side L to cover as many of K points as possible, counting points on any edge as covered. | Medium6 | ArraySorting+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Sickly YunhoGiven a string of B, L, D doses, remove from either end in the fixed order B, L, D, B, L, D... and find the most doses removable before the required dose is missing from both ends. | Medium6 | Dynamic programmingArray+2 | No attempts yet | 1s | 512 MB | Judgeable |
| The Longest FenceGiven up to 10^6 board lengths (each at most 2000), pair them into boards of equal sum and report the largest possible number of boards plus how many sums reach it. | Medium6 | ArrayTwo pointers+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Closest PairBoth point sets lie on horizontal lines; find the Manhattan distance of the closest P-Q pair and count how many distinct pairs achieve it. | Medium6 | SortingTwo pointers+1 | No attempts yet | 1.5s | 512 MB | Judgeable |
| Bumper to bumper trafficTwo cars 4.4 m long start stopped on a line and alternate between stopping and driving at 1 m/s at given times; decide whether they ever touch, giving the first contact second rounded up. | Medium6 | ImplementationSimulation+2 | No attempts yet | 4s | 512 MB | Judgeable |
| Fashion ShowGiven a legal partial placement of +, x, and o models on an N by N grid, add or upgrade models to maximize style points under the row/column and diagonal rules. | Medium6 | GraphTwo pointers+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Ratatouille (Large)Given amounts of each ingredient, pair packages into kits so that each package in a kit is within 90 to 110 percent of the recipe amount for the kit's integer serving count, maximizing kits. | Medium6 | GreedyTwo pointers+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Orderly ClassGiven two equal-length strings A and B, count the intervals in A such that reversing that interval turns A into B. | Medium6 | StringTwo pointers+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Club Room RepairsAssign each club at most one room and each room at most one club, where Jongbin covers max(0, cost - budget) up to X total; maximize clubs housed. | Medium6 | GreedySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Haybale FeastPick a contiguous block whose flavor sums to at least M while minimizing the block's maximum spiciness. | Medium6 | Two pointersSliding window+2 | No attempts yet | 2s | 512 MB | Judgeable |
| An Unfair PuzzleGiven two permutations of 1..n, decide whether cyclic rotations and reversals can turn the first into the second, printing good puzzle or bad puzzle. | Medium6 | StringString matching+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Cow Rental ServiceChoose for each cow whether to milk it or rent it, matching milk to stores with limited quantity and price, to maximize total cents. | Medium6 | GreedySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Junpyo's PebblesFind the longest contiguous segment containing at most B black pebbles and at least W white pebbles. | Medium6 | Two pointersSliding window+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Skyscraper MinatoHarukasFor each budget b, find the longest run of consecutive positive integers summing to b and print its first floor and length. | Medium6 | MathTwo pointers+2 | No attempts yet | 2s | 512 MB | Judgeable |
| MeetingsEach person occupies an interval [Si, Ei]; pair up people whose intervals overlap into disjoint pairs and maximize the number of pairs. | Medium6 | GreedySorting+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| StarwarsGiven human systems, bases, and directed labeled wormholes, decide whether a nonhuman start yields a certificate sequence matching one produced by some human start reaching any base. | Medium6 | GraphBFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Random Index VectorsMerge two sparse signed index lists to output their element-wise sum, product, and each list rotated left by k with wraparound. | Medium6 | Two pointersHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Substring PermutationGiven strings S and P, decide whether some permutation of P is a substring of some permutation of S. | Medium6 | Hash mapTwo pointers+1 | No attempts yet | 1s | 512 MB | Judgeable |
| JackRabbit SlimGiven sorted distinct carrot positions on a line, Slim repeatedly jumps to the nearest remaining carrot, breaking ties to the right; find the sum of total distances over all possible starting carrots. | Medium6 | Dynamic programmingArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Rainbow BeadsFind the longest contiguous substring of a string over R, B, V that has no equal adjacent pair under any of the three color-blind views. | Medium6 | Two pointersSliding window+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| KingsGiven n kings on an n by n board, find the minimum total moves to shift every king onto the main diagonal, where a move shifts one king one cell horizontally or vertically. | Medium6 | Two pointersGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Count SquaresGiven coordinates of h horizontal and v vertical lines, count how many axis-aligned squares have all four sides drawn by those lines. | Medium6 | ArrayHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| AlehouseGiven n closed time intervals on a weekly circle, pick one interval of length at most k that intersects as many given intervals as possible. | Medium6 | IntervalsSliding window+2 | No attempts yet | 1s | 512 MB | Judgeable |
| ASLRDRReorder a string with adjacent swaps so it becomes a palindrome, reporting the minimum number of swaps or Impossible. | Medium6 | GreedyTwo pointers+2 | No attempts yet | 2s | 512 MB | Judgeable |
| JJOOII 2Given a string of J, O, I and a level K, delete characters from the ends or middle to obtain K J's then K O's then K I's, minimizing middle deletions. | Medium6 | GreedyTwo pointers+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Balls of BumaGiven a row of colored balls, count the color and insertion position pairs that make the chain reaction remove every ball. | Medium6 | StringImplementation+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Three ArraysGiven three sorted arrays and a distance d, count triples of elements (one from each array) whose pairwise differences all stay within d. | Medium6 | Two pointersSorting+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Currency ExchangeGiven n tablet values and an integer rate p, find two distinct indices i and j so that the ratio c_i / c_j is as close to p as possible. | Medium6 | ArrayBinary search+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Running CourseGiven up to 100,000 2D points, compute the squared distance between the farthest pair of points. | Medium7 | GeometrySorting+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Four SubstringsGiven a string and four of its substrings, pick one occurrence of each so that the union of the covered positions has the fewest and the most distinct characters. | Medium7 | String matchingIntervals+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Once Opened, You Can't StopChoose one integer per flavor within its given range so the sum of absolute changes between consecutive picks is minimized, and output the values. | Medium7 | Dynamic programmingGreedy+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Point SelectionGiven weighted 2D points, find a placement of a fixed-size axis-aligned rectangle maximizing the difference between the maximum and minimum weights of points it covers. | Medium7 | Sliding windowSorting+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Jewel HeistGiven colored points, find the maximum number of points coverable by a horizontal-span rectangle extending down to minus infinity that avoids containing all k colors. | Medium7 | Two pointersSorting+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Choosing NumbersGiven a sequence, delete exactly K elements so that the sum of the largest gap and the smallest adjacent gap among the remaining elements is minimized. | Medium7 | SortingSliding window+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Largest SquareGiven an N by N grid with W bad cells listed explicitly, find the largest axis-aligned square containing at most L bad cells. | Medium7 | Binary searchPrefix sum+2 | No attempts yet | 2s | 128 MB | Judgeable |
| TransmittersGiven a fixed center, a radius, and up to 150 points, find the largest number of points that fit inside some semicircular half-disk at any rotation. | Medium7 | GeometryTwo pointers+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Circle and PointsGiven up to 300 points, find the maximum number coverable by one radius-1 circle, using a sweep over candidate centers. | Medium7 | GeometryBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Amphiphilic Carbon MoleculesPlace a single line to maximize the number of particles that dissolve: hydrophilic on the water side plus hydrophobic on the acetone side, counting any particle on the line. | Medium7 | GeometryTwo pointers+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Run, IOI TrainDiscard a prefix from each of two I/O strings, then interleave the remaining fronts to build the longest alternating string that starts and ends with I. | Medium7 | Dynamic programmingTwo pointers+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Probability Through ExperimentGiven n points on a circle by angle, count how many triples form an acute triangle. | Medium7 | GeometryTwo pointers+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Rice HubGiven sorted field positions on a line and a budget B, choose an integer hub position maximizing how many fields can be reached within total transport cost B. | Medium7 | Two pointersPrefix sum+2 | No attempts yet | 1s | 256 MB | Judgeable |
| PhotoGiven N cows in a line and K unfriendly pairs that cannot share a photo, find the minimum number of consecutive-range photos covering every cow. | Medium7 | GreedyIntervals+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Covering the CorralGiven arcs of given start and length on a circle of circumference C, find the fewest arcs whose union covers the whole circle. | Medium7 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| RestaurantSplit a sequence of N foods into consecutive groups, where a group costs the square of its number of distinct foods, and minimize the total cost. | Medium7 | Dynamic programmingDivide and conquer+2 | No attempts yet | 1s | 128 MB | Judgeable |
| CN Tower 2Choose a starting camera orientation so a rotating restaurant brings every landmark's bearing past the camera; minimize total time including flash recharge and the final recharge. | Medium7 | SortingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TripsMatch group sizes to trip intervals so that each interval gets at most one group and the number of matched intervals is maximized. | Medium7 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Longest Common Increasing SubsequenceGiven two integer sequences, find the length of the longest common increasing subsequence of both. | Medium7 | Dynamic programmingArray+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Knights of the Round TableGiven chairs at rational angles on a circle of radius n, find the maximum straight-line distance between any two chairs, rounded to two decimals. | Medium7 | GeometryTwo pointers+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Beach cutGiven a polyline shoreline, pick two vertices at distance at most L and connect them below the shore to maximize the enclosed beach area. | Medium7 | GeometryTwo pointers+1 | No attempts yet | 1s | 128 MB | Judgeable |
| GoldmineGiven n points and an axis-aligned rectangle of fixed width s and height w, find the maximum number of points the rectangle can cover, borders included. | Medium7 | SortingTwo pointers+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Where to Build a Brewery?On a ring of cities with given edge lengths and demands, pick the city minimizing total demand-weighted shortest-path distance around the ring. | Medium7 | Prefix sumTwo pointers+2 | No attempts yet | 3s | 512 MB | Judgeable |
| The Number of Symmetrical ChoicesGiven two word sequences of length n, count how many of the 2^n ways of picking one word per index produce a palindrome when concatenated. | Medium7 | Dynamic programmingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| BlocksGiven pile heights, for each k find the longest run of consecutive piles that can be raised to height at least k by moving top blocks between neighbors while staying above k. | Medium7 | GreedyTwo pointers+1 | No attempts yet | 3s | 512 MB | Judgeable |
| LollipopFor each query k, find the lexicographically smallest contiguous segment of a T/W string whose weight (T=2, W=1) equals k, or print NIE if none exists. | Medium7 | Prefix sumTwo pointers+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SticksFrom sticks grouped by colour, find three sticks of pairwise different colours that form a non-degenerate triangle and maximise the perimeter. | Medium7 | SortingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Farmer's FieldCount placements of a c-by-d or d-by-c rectangle fully inside a field whose every row is one contiguous segment. | Medium7 | Sliding windowStack+2 | No attempts yet | 1s | 128 MB | Judgeable |
| LinesFind the line through a fixed point P that minimizes the maximum distance from P's line to any of n given points, and print that minimum distance rounded down to three decimals. | Medium7 | GeometryBinary search+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cake PieceFind the k-th largest piece area after cutting a rectangle with n cuts in each direction. | Medium7 | Binary searchSorting+2 | No attempts yet | 1s | 512 MB | Judgeable |
| PointsCount triangles formed by white points that have no black point strictly inside them. | Medium7 | GeometryCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| PatternCount the positions in the text where the pattern matches when every letter is repeated the same number of times. | Medium7 | String matchingTwo pointers+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Almost LCSGiven two binary strings up to 100000 characters, find the longest 0^a1^b or 1^a0^b string that is a subsequence of both. | Medium7 | Prefix sumTwo pointers+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SquaresChoose one point from each axis-parallel square to maximize the farthest pair distance, and print that maximum squared. | Medium7 | GeometrySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| TokensFor each token with given length and lookahead, compute how far back its text affects earlier token boundaries. | Medium7 | Two pointersPrefix sum | No attempts yet | 1s | 128 MB | Judgeable |
| Protecting the VegetablesFind the minimum-perimeter rectangle of any orientation that encloses all given points. | Medium7 | GeometrySorting+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Interstellar TradePlace the two ends of a wormhole on a line of planets to minimize the largest trip distance, where each trip uses the wormhole shortcut or the direct distance. | Medium7 | Binary searchGreedy+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Line of SightCount the pairs of N points outside a central circle whose connecting segment avoids the circle. | Medium7 | GeometrySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Easy GeometryFind the largest area of an axis-aligned rectangle that fits inside a given convex polygon. | Medium7 | GeometryTwo pointers | No attempts yet | 1s | 128 MB | Judgeable |
| Width of a Point SetGiven up to 100000 points, compute the integer part of the squared minimum width of a strip enclosing all points. | Medium7 | GeometryTwo pointers | No attempts yet | 2s | 512 MB | Judgeable |
| Around the worldFor each plane range, find the fewest refueling landings to circle all airports from the best start, or report impossible. | Medium7 | GreedyPrefix sum+1 | No attempts yet | 5s | 24 MB | Judgeable |
| XH CompanyFor each query day D, report the length of the shortest suffix ending on day D-1 with the largest average. | Medium7 | StackPrefix sum+1 | No attempts yet | 2s | 256 MB | Judgeable |
| HighwayGiven up to 200,000 points per test case, output the lexicographically smallest pair with the largest Euclidean distance. | Medium7 | GeometrySorting+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Mailing OrigamiFind the area of the smallest rotated rectangle enclosing N given points, rounded to the nearest integer. | Medium7 | GeometrySorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Trapped in the HaybalesBessie breaks any bale smaller than her running start, and you must find the cheapest single bale to enlarge so she never leaves the outer bales. | Medium7 | Two pointersSorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| JoggingFor each rest point given in increasing order, print the largest angle in radians to a star with greater x, or zero when no such star exists. | Medium7 | GeometrySorting+1 | No attempts yet | 1s | 16 MB | Judgeable |
| Consecutive OrderingDecide whether every vertex's closed neighbourhood forms one unbroken block in the given vertex ordering. | Medium7 | IntervalsTwo pointers+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Cake cutCarol picks a vertex of a convex cake and Carla picks a diagonal from it to split the cake, then Carol keeps the larger piece under optimal play from both. | Medium7 | GeometryGame theory+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Angry CowsFind the smallest launch power whose chain of shrinking blast radii clears all hay bales on a line. | Medium7 | Binary searchDynamic programming+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Sums of Sums (Large)Given a positive array, sort all its subarray sums and answer the sum of entries ranked L through R for each query. | Medium7 | Binary searchTwo pointers+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Street Tree Props (Large)Assign one or two sticks to each of N trees so every tree reaches support B while the total used force is as small as possible. | Medium7 | GreedySorting+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Train in a TunnelGiven car lengths and light states, find the minimum number of extra lights to turn on so that at every moment some lit car overlaps the tunnel. | Medium7 | ArrayTwo pointers+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Splitting a StringChoose K non-overlapping substrings of A that also appear in B in the same non-overlapping order, maximizing their total length. | Medium7 | Dynamic programmingString+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Hongjun's matrixGiven sequences A and B of length N, find the K-th smallest value among all N^2 products A_i * B_j. | Medium7 | Binary searchSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Partition into segments 2Split the array into at most M contiguous segments, minimizing the maximum difference between the largest and smallest value within any one segment. | Medium7 | Binary searchDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Integral PolygonsCount the diagonals of a convex polygon that split it into two pieces of integer area, given integer vertex coordinates. | Medium7 | GeometryMath+2 | No attempts yet | 2s | 256 MB | Judgeable |
| House RentalGiven facilities of k types on a line, find the integer location minimizing the largest distance to the nearest facility of each type, smallest such location on ties. | Medium7 | Binary searchSorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| The Club HallGiven plank lengths and a rectangular hall, decide whether each row can be spanned by one or two planks and find the fewest planks that cover the floor. | Medium7 | GreedySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Free WeightsTwo rows of dumbbells, each mass appearing twice, must be paired up; minimize the heaviest dumbbell that must be lifted. | Medium7 | ArrayTwo pointers+2 | No attempts yet | 4s | 512 MB | Judgeable |
| RivaFind two points on a left-to-right non-self-intersecting polyline whose allowed chord length is within L and maximizes the area between the chord and the polyline above it. | Medium7 | GeometryTwo pointers+1 | No attempts yet | 2s | 64 MB | Judgeable |
| Team BuildingCount pairs of K-cow teams, one from each farmer, such that after sorting both teams John's cow beats Paul's in every paired rank, modulo 1000000009. | Medium7 | SortingCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Smallest Square 2Given N lattice points, choose an axis-aligned square with lattice corners containing at least K points strictly inside and minimize its area. | Medium7 | Binary searchSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Proving PropositionsChoose directed edges so all N propositions become mutually reachable, minimizing the difference between the hardest and easiest chosen proof difficulties. | Medium7 | GraphTwo pointers+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Longest Palindromic SubstringGiven a lowercase string of up to 100,000 characters, report the length of its longest palindromic substring. | Medium7 | StringString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |