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 |
|---|---|---|---|---|---|---|
| Jurisdiction DisenchantmentGiven n odd points, find the smallest axis-aligned rectangle (possibly degenerate) that contains strictly more than n/2 of them, and output its area. | Medium7 | ArraySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Faster SortingFor each MINRUN, simulate Timsort's run splitting and report the number of subarrays and the number of bad elements pulled in. | Medium7 | SimulationTwo pointers+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Tent DutyCount sets of two points on each of two parallel lines that form a trapezoid with both bottom angles acute or both top angles acute. | Medium7 | GeometrySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Horror Film NightGiven the sets of days each of two people likes films on, find the longest subsequence with no two consecutive films disliked by the same person. | Medium7 | GreedyTwo pointers+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Kayaking TripGiven counts of three strength levels and kayak speed factors, pair everyone two to a kayak to maximize the slowest kayak's speed. | Medium7 | GreedySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Breaking BiscuitsGiven a simple polygon, find the smallest diameter of a circular mug that can contain it in some orientation, i.e. the polygon's minimum width. | Medium7 | GeometryTwo pointers+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Biotechnology laboratoryGiven a string of lowercase letters weighted 1 to 26, count how many distinct total weights occur among all non-empty substrings. | Medium7 | Prefix sumTwo pointers+2 | No attempts yet | 7s | 1024 MB | Judgeable |
| Global WarmingFind the longest subarray whose minimum value and maximum value each occur exactly once, and report its length and earliest start. | Medium7 | Two pointersStack+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Buying Card PacksChoose M non-overlapping length-L windows in a card row, each window free of duplicate kinds, and find the largest feasible L. | Medium7 | Binary searchGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| CipeleMatch as many left/right shoe pairs as possible, as long as no further pair can be formed, and minimize the largest size gap. | Medium7 | Binary searchGraph+2 | No attempts yet | 1s | 64 MB | Judgeable |
| Acute TrianglesGiven n points, count the triangles with all three angles under 90 degrees. Total n across all test cases is at most 2000. | Medium7 | GeometryTwo pointers+2 | No attempts yet | 4s | 512 MB | Judgeable |
| Playing the Smaller NumberGiven two odd-length card sets, decide if one player can force a majority of rounds by winning when their card is strictly smaller, using a matching strategy. | Medium7 | SortingGreedy+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Selling RNA StrandsGiven N RNA strings, answer M queries that count strings matching a prefix P and suffix Q. | Medium7 | String matchingHash map+2 | No attempts yet | 1.5s | 1536 MB | Judgeable |
| Subsequences in SubstringsCount how many substrings of s contain t as a subsequence at least once. | Medium7 | Two pointersDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Dynamic RollerFor each tile i, count the tiles to its right whose viscosity B is at most A_i, given B is nondecreasing. | Medium7 | Binary searchArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Alphabet StringCount distinct strings formed by sorting the distinct characters of every substring of an uppercase string and removing duplicates. | Medium7 | StringHash map+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Blurred PicturesEach row gives a contiguous run of good pixels [ai, bi]; find the largest axis-aligned square whose every pixel is good. | Medium7 | ArrayTwo pointers+2 | No attempts yet | 2s | 512 MB | Judgeable |
| FishGiven N fish with lengths and one of three colors, count the distinct color-count triples achievable by a set of fish where no two have a length ratio of 2 or more. | Medium7 | SortingTwo pointers+1 | No attempts yet | 1.5s | 512 MB | Judgeable |
| Mixing DrinksCount the ways to split the sequence 1..N into consecutive nonempty blocks so that no block contains both endpoints of any listed bad pair, modulo 1e9+7. | Medium7 | Dynamic programmingTwo pointers+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Bus TicketGiven trip days in non-decreasing order, single-trip price s, and a ticket costing p that covers m days from purchase, find the minimum total cost. | Medium7 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Eggfruit CakeCount the circular contiguous slices of a fruit border that contain at least one eggfruit ('E') and at most S fruits, where slices are distinguished by which fruits they include. | Medium7 | Two pointersSliding window+2 | No attempts yet | 0.1s | 512 MB | Judgeable |
| Deep800080Place a point on a line so that a disk of fixed radius R centered there covers as many of N given points as possible; output the maximum count. | Medium7 | GeometrySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sum and ProductCount the subarrays of length at least 2 in which the sum of the elements equals their product, where each element is a positive integer up to 1e9. | Medium7 | Two pointersMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Trous de LoupGiven n weighted positions, a sandbag budget p, and a plank covering d consecutive positions, find the longest contiguous segment that can be fully disarmed. | Medium7 | Sliding windowTwo pointers+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Matrix SumCount the submatrices of an N by M matrix whose element sum is at most x. | Medium7 | Prefix sumTwo pointers+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Nested Reversal SequenceGiven two binary strings, find the minimum number of substring reversals, each interval nested inside the previous one, needed to turn the first string into the second, or report impossibility. | Hard8 | StringGreedy+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Minimum-Cost Number Matching (Hard)Given sorted sets S and T, choose pairs (s,t) with cost |s-t| so every element of both sets appears in at least one pair, minimizing total cost, for sizes up to 500000. | Hard8 | Dynamic programmingGreedy+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Tug of WarSplit two weighted sequences each into three ordered nonempty contiguous parts so paired-part weight differences stay under 50 and the maximum difference is minimized. | Hard8 | Binary searchPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| CraneGiven N boxes each holding two colored balls, output a shortest crane command sequence that rearranges balls so all-white boxes and all-black boxes form contiguous groups. | Hard8 | GreedySimulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| DistanceGiven a walk on a grid, find a contiguous segment of moves to delete so the remaining path stays within a bounding rectangle and ends as close as possible to the target point. | Hard8 | Prefix sumTwo pointers+2 | No attempts yet | 1s | 128 MB | Judgeable |
| WormlyFind the minimum number of moves to shift a worm's body window and its ordered legs across a bridge with missing planks, or report impossibility. | Hard8 | GreedyTwo pointers+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SignalGiven n points with no three collinear and no four concyclic, average over all triples the number of points inside or on the circle through the triple. | Hard8 | GeometryCombinatorics+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Pie DivisionCount the number of straight lines that split 2N labeled points (N of each of two colors, N even) so that each open half-plane holds N/2 points of each color, treating both sides as the same split. | Hard8 | GeometryCombinatorics+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Triangle CountingCount how many triangles formed by triples of N integer points strictly contain the origin in their interior. | Hard8 | GeometrySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| A Strip of LandGiven a U by V grid of heights, find the largest-area rectangle whose height range is at most C and whose width is at most 100. | Hard8 | Sliding windowMatrix+2 | No attempts yet | 2s | 128 MB | Judgeable |
| RobotsRobots on a circular track move clockwise for given durations, pushing each other and stopping at walls; find each final position. | Hard8 | SimulationIntervals+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Fortune at El DoradoGiven up to 1000 points on a 1000x1000 grid and a maximum area A, find an axis-parallel rectangle with positive integer area at most A containing the most points. | Hard8 | Two pointersBinary search+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Crossed MatchingsGiven two rows of positive integers, draw the maximum number of equal-value matching segments between the rows so that each segment crosses exactly one other and no number is used twice. | Hard8 | Dynamic programmingArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Almost ClearGiven two disjoint convex polygons A and B and a point C outside both, decide whether B hides none, part, or all of A as seen from C. | Hard8 | GeometryBinary search+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Empty CuboidsGiven up to 5000 integer points, find the largest axis-aligned box anchored at the origin whose strict interior contains none of the points, and output its volume. | Hard8 | SortingTwo pointers+2 | No attempts yet | 3s | 128 MB | Judgeable |
| The InvasionGiven a convex polygon with n vertices and m weighted points, find three polygon vertices forming a triangle with the maximum total weight of points inside or on it. | Hard8 | GeometryTwo pointers+2 | No attempts yet | 3s | 64 MB | Judgeable |
| PloughingGiven an m by n grid of tile difficulties, repeatedly remove a full strip of width 1 from any edge as long as the strip sum is at most k, and minimize the number of strips that remove every tile. | Hard8 | Dynamic programmingTwo pointers+2 | No attempts yet | 1s | 128 MB | Judgeable |
| FrogFor each rock, find where a frog lands after exactly m leaps, where each leap goes to the k-th nearest rock with ties broken toward the spring. | Hard8 | Two pointersBinary search+1 | No attempts yet | 3s | 512 MB | Judgeable |
| Sum of PolygonsAdd two convex polygons by Minkowski sum and print twice the area of the resulting polygon. | Hard8 | GeometryTwo pointers+2 | No attempts yet | 1s | 128 MB | Judgeable |
| BajtoriSelect a subset of squares to maximize the sum of the squared red total and squared green total. | Hard8 | GeometrySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Fence In Godzilla!The task is to find the smallest nonzero area among triangles with vertices from n points. | Hard8 | GeometrySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| The Avaricious ISPChoose two disjoint disks over weighted points to maximize the product of the covered weight sums. | Hard8 | GeometrySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Golf FieldChoose four of up to 30000 points in the plane so their convex hull has the largest possible area. | Hard8 | GeometryTwo pointers | No attempts yet | 2s | 128 MB | Judgeable |
| Truck EncountersCount how many times each queried pair of trucks, moving at equal speed along zigzag city routes, occupy the same position. | Hard8 | IntervalsSorting+1 | No attempts yet | 3s | 64 MB | Judgeable |
| Turning off the bulbsCount the possible turn-off orders when an interval expands from a start bulb by always taking the stronger of the two frontier bulbs, branching on ties. | Hard8 | CombinatoricsTwo pointers+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Longest Shortest Paths at ShymbulakCount every shortest path between all vertex pairs at the maximum distance in a connected graph with N vertices and N equal edges. | Hard8 | GraphBFS+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Marriage questionsCount the candidate intervals [L, R] in which all M daughters can each marry a distinct candidate they accept. | Hard8 | GraphTwo pointers | No attempts yet | 2s | 256 MB | Judgeable |
| Relay SignalCount boats reachable within one relay hop from boat 1, where visibility means the connecting segment never enters the convex island interior; every coordinate is a lattice point. | Hard8 | GeometrySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| BillboardGiven a 0/1 matrix, find the largest all-1 sub-rectangle after flipping at most s zeros and clearing at most r rows entirely. | Hard8 | Sliding windowTwo pointers+2 | No attempts yet | 2s | 512 MB | Judgeable |
| PasswordGiven a length-N string, collect all distinct substrings meeting four counts (length, digits, specials, uppercase), sort them lexicographically, and print the middle one. | Hard8 | StringSorting+2 | No attempts yet | 4s | 512 MB | Judgeable |
| Keeping the Dogs ApartTwo dogs follow their own polyline routes at the same constant speed; find the minimum distance between them while both are still walking. | Hard8 | GeometryTwo pointers+2 | No attempts yet | 6s | 512 MB | Judgeable |
| Triangle regionsGiven N points with no three collinear, count for each v how many triangles formed by three points contain exactly v other points strictly inside. | Hard8 | GeometryCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| I Teach SweepingGiven segments in the first quadrant, find a line through the origin that intersects the most segments and report that count. | Hard8 | GeometrySorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Subsequence ReversalReverse one subsequence of a length-N array, then find the longest non-decreasing subsequence length achievable. | Hard8 | Dynamic programmingArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Over Fitting (Large)Given N labeled points in the plane, find a line whose positive half-plane contains only LOVELYZ points and maximizes how many LOVELYZ points it captures. | Hard8 | GeometrySorting+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Two-Headed CowsN cows each have two heads, and M dislike pairs require that those heads face opposite troughs. Split the cows into the fewest consecutive blocks that each admit a valid orientation. | Hard8 | GraphUnion-find+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Rectilinear RegionsGiven two unbounded staircase polylines L and U, count the closed regions they enclose with L below and U above, and sum their areas. | Hard8 | GeometryTwo pointers+2 | No attempts yet | 0.5s | 512 MB | Judgeable |
| Shooting GalleryA row of ducks, each with a species; a good round hits two ducks of the same species and keeps only the ducks strictly between them, and rounds continue while same-species pairs remain. Find the longest possible run of good rounds. | Hard8 | Dynamic programmingArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Ice cream samplesGiven a circular sequence of sample boxes, find the shortest consecutive run whose multiset union covers all brands 1 to K, and report its total sample count. | Hard8 | Sliding windowTwo pointers+2 | No attempts yet | 3s | 512 MB | Judgeable |
| HubtownAssign citizens to one of their two angularly nearest train rays, respecting each ray's capacity, and maximize the number assigned. | Hard8 | GreedySorting+2 | No attempts yet | 10s | 512 MB | Judgeable |
| The Infosci Pirate CrewGiven N islands with coordinates, treasure values, and safe hardness, choose a monotone northeast path and a hardness interval to maximize collected value minus interval length. | Hard8 | Dynamic programmingSorting+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Computer ScienceFind the smallest L such that for each a_i we can pick an interval [x_i, x_i+L] covering a_i and containing at least K of the given integers. | Hard8 | Binary searchSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| RecipeBuy ingredients on some days, hold each in the fridge until a later day, cook it there if freshness stays at least L_i, and maximize the total of F_i minus elapsed days times C_j; print Impossible if day N can't be a cooking day. | Hard8 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| ParticlesGiven firing times and speeds of N particles from each of two facing accelerators, report the first K collisions between opposite kinds in chronological order. | Hard8 | SortingTwo pointers+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Pineapple PizzaGiven n points and a center Q, decide whether k rays from Q can split the plane so every sector holds exactly n/k points, with no point on a ray. | Hard8 | GeometrySorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Fair ShareGiven n weighted points around the origin, choose a line through the origin that splits them into two half-planes, minimizing the absolute difference of the two half-plane weight sums. | Hard8 | GeometrySorting+2 | No attempts yet | 5s | 512 MB | Judgeable |
| PanokseonSplit a sequence of n positive weights into groups with sum at most W to minimize the maximum of (W minus group sum) squared. | Hard8 | GreedyBinary search+2 | No attempts yet | 1s | 512 MB | Judgeable |
| ParcelGiven n distinct integers and target w, decide whether four of them sum exactly to w. | Hard8 | Two pointersHash map+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Isomorphic InversionSplit a digit string into the largest number of contiguous pieces whose sequence of pieces reads the same forward and backward. | Hard8 | GreedyString matching+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Cow DatingGiven probabilities p_i, choose a contiguous interval maximizing the chance that exactly one bull accepts, and print 10^6 times that probability rounded down. | Hard8 | MathTwo pointers+2 | No attempts yet | 2s | 512 MB | Judgeable |
| String DecorationGiven a string S and N pattern strings, find the length of the shortest substring of S that contains every pattern as a substring. | Hard8 | StringSliding window+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Paris by NightGiven N graded points in general position, pick two boundary monuments and split the rest by the line through them to minimize the absolute difference of the two side sums. | Hard8 | GeometrySorting+2 | No attempts yet | 15s | 512 MB | Judgeable |
| SpyGiven a subordinate subtree for every leader in two rooted trees of N employees, count for each IOI employee how many of the M spy projects succeed, where spy b succeeds when the matching JOI employee lies in research project b's subtree. | Hard8 | TreeDFS+2 | No attempts yet | 2s | 256 MB | Judgeable |
| MeetingsCows on a line swap velocities when they meet, stop at barns, and the question asks how many meetings occur before half the total weight has stopped. | Hard8 | SortingMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Movie-goerChoose a contiguous block of days maximizing the sum of weights of movies that appear exactly once in the block. | Hard8 | ArrayTwo pointers+2 | No attempts yet | 5s | 512 MB | Judgeable |
| ICPC CampGiven n days, p classical and q creative problems with difficulty values, pair one of each per day so every pair sums to at most s, minimizing the largest within-pair difference; output -1 if impossible. | Hard8 | Binary searchGreedy+2 | No attempts yet | 4s | 512 MB | Judgeable |
| New Year and Castle ConstructionGiven n points with no three collinear, count over all points p the number of 4-point subsets whose convex quadrilateral strictly contains p, and sum these counts. | Hard8 | GeometryCombinatorics+2 | No attempts yet | 3s | 512 MB | Judgeable |
| CartoonsCount subarrays in which every sub-subarray contains at least one value that appears exactly once, over a sequence of up to 500,000 values. | Hard8 | Two pointersDivide and conquer+2 | No attempts yet | 2.5s | 256 MB | Judgeable |
| Related LanguagesGiven strings A and B and an integer k, find the longest pair of equal-length substrings, one from each string, that differ in at most k positions. | Hard8 | Binary searchDynamic programming+2 | No attempts yet | 10s | 512 MB | Judgeable |
| TrianglesGiven up to 2000 distinct points, count right triangles formed by three of the points whose area falls in the inclusive range [A, B]. | Hard8 | GeometryHash map+2 | No attempts yet | 10s | 256 MB | Judgeable |
| CastingFor a convex polygon, count the vertex pairs whose connecting line splits it into two parts that can each be pulled out by translation. | Hard9 | GeometryTwo pointers+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Largest and Smallest TriangleGiven n points in the plane, compute the largest and smallest areas among all triangles formed by triples of the points. | Hard9 | GeometrySorting+1 | No attempts yet | 6s | 128 MB | Judgeable |
| Gahui's Sequence Mod Play (Large)Maintain a stack under push and pop, and after each type 3 query report the shortest suffix whose remainders mod m cover every residue from 0 to m-1, printing -1 if impossible. | Hard9 | StackTwo pointers+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Make Rounddog HappyCount subarrays whose elements are all distinct and whose maximum minus length is at most k, for arrays up to 300,000 with values bounded by n. | Hard9 | Divide and conquerTwo pointers+2 | No attempts yet | 2s | 512 MB | Judgeable |