Curated sets
Math and counting
Number theory, combinatorics, and geometry.
Total results6,670 problems
| Topics | Judge | |||||
|---|---|---|---|---|---|---|
| Unlucky 89Average the circumferences of all integer right triangles whose hypotenuse is k*sqrt(89) with k up to n, printed as exact mixed numbers in an ASCII box. | Hard9 | Number theoryMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Find the SequenceGiven B, decide whether there exist distinct integers A_i > 1 such that A_i^{B_i} is divisible by the product of all the other A_j. | Hard9 | Number theoryMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Soldiers (Large)Two players alternately pick soldiers, each new pick must beat all previous picks in attack or in defense; decide if the first player can end up with strictly more picks. | Hard9 | Game theoryDynamic programming+1 | No attempts yet | 5s | 512 MB | Judgeable |
| RonaldGiven a graph on N vertices, a move toggles all edges incident to one chosen vertex; decide whether the complete graph is reachable. | Hard9 | GraphBit manipulation+2 | No attempts yet | 1s | 64 MB | Judgeable |
| Rides 2Each day one child grows by 1 or 2, and we must report how many of Q fixed child-pair and ride triples become valid that day. | Hard9 | Segment treeSorting+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Building a Tall BarnAssign K cows to N ordered floors, each with work a_i, so each floor gets at least one cow; minimize the sum of a_i/c_i over valid allocations, rounded to nearest integer. | Hard9 | GreedyHeap+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Incremental Double Free StringsFind the nth string of length k(k+1)/2 that uses one letter j times for each j up to k and has no two equal adjacent letters, in alphabetical order. | Hard9 | CombinatoricsDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Maximum Color CliqueGiven a complete graph whose every cycle has two adjacent same-color edges, sum over all nonempty node subsets the size of the largest same-color clique inside each subset, modulo 1e9+7. | Hard9 | GraphCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| The Enormous SequenceDefine a_n by summing every nonempty subset sum of the first n-1 terms, then answer queries about gcd, 2-adic valuation of lcm, prefix sums, or a single term for various starting values. | Hard9 | MathNumber theory+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Tarot Sham BoastGiven up to 10 equal-length strings over {R,P,S} and a length n random string, sort the strings by the probability each occurs as a contiguous block. | Hard9 | String matchingProbability+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Shifty GridApply a fixed two-phase procedure of cyclic row and column shifts to sort a permutation grid into row-major order, following the exact TURN steps given. | Hard9 | SimulationImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Rolling the BottleGiven a convex polygon as a bottle base and a water volume, find the minimum and maximum number of sides of the water region as the bottle rolls. | Hard9 | GeometrySorting+2 | No attempts yet | 2.5s | 512 MB | Judgeable |
| Largest window sumFor every window length K, find the largest possible sum of a length-K window over all non-negative arrays that satisfy each given length bound. | Hard9 | GreedyPrefix sum+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Creating Fake NewsFind one story vector satisfying n linear equations, then the minimum number of starting people whose reach covers all n people. | Hard9 | MathGraph+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Fashion ShowPlace models on an N by N grid (or upgrade existing ones) so every shared row or column has a plus and every shared diagonal has an x, maximizing style points. | Hard9 | GreedyGraph+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Slate Modern (Large)Fill a huge R by C grid with positive integers so adjacent cells differ by at most D, matching N fixed cells, maximizing the total sum or reporting impossibility. | Hard9 | GraphShortest path+2 | No attempts yet | 80s | 512 MB | Judgeable |
| Omnicircumnavigation (Large)Given points on a unit sphere joined in order by shortest arcs, decide whether the closed path meets every great circle. | Hard9 | GeometryMath+2 | No attempts yet | 120s | 512 MB | Judgeable |
| Stack Management (Small)Decide whether a solitaire game on 2 to 4 short stacks of cards can be reduced to at most one card per stack using two allowed moves. | Hard9 | Game theorySimulation+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Sequence and TransformationCount length-n sequences with entries in [1,m] whose image after applying a min-based affine transformation k times has the given max-minus-min value. | Hard9 | CombinatoricsMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Expected value of the greatest common divisorEach of K values is chosen uniformly from its own interval; find the expected gcd of the K chosen numbers as a fraction mod 1e9+7. | Hard9 | ProbabilityMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Polynomial and QueriesEvaluate a degree-N polynomial with integer coefficients at K given points, all modulo the prime 786433, with N and K up to 250000. | Hard9 | Number theoryDivide and conquer+2 | No attempts yet | 10s | 512 MB | Judgeable |
| NPM998244353 (Hard)For every digit-sum cap from 0 to MM, count length-N digit strings divisible by P, modulo 998244353. | Hard9 | CombinatoricsDynamic programming+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Counting multiples with a bounded digit sumCount length-N digit strings divisible by P with digit sum at most M, for every M up to the limit, modulo 998244353. | Hard9 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Good triples of pathsCount triples of simple paths in a tree that are either node-disjoint or pairwise intersecting, modulo 1e9+7. | Hard9 | CombinatoricsTree+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Strongly MatchableDecide whether an even-order graph admits a perfect bipartite matching for every balanced partition of its vertices. | Hard9 | GraphMath+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Equivalent DeformationGiven two equal-area triangles, find the minimum number of vertex-sliding operations that map the first exactly onto the second. | Hard9 | GeometryImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| LeapfrogGiven up to 40 frogs, each starting at x_i with prime jump d_i, find the smallest position where the number of frogs that land there is largest. | Hard9 | Number theoryMath+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Fractal TreeFor a recursively defined fractal tree F_k, answer queries giving the distance between two DFS-labeled vertices. | Hard9 | TreeRecursion+2 | No attempts yet | 7s | 512 MB | Judgeable |
| Arranging tilesGiven up to 14 convex tiles of equal height with cut corners, find the ordering and horizontal placement that minimizes the total frame width when packed side by side. | Hard9 | Dynamic programmingGeometry+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| CratersFind the shortest single closed fence that surrounds all circles at distance 10 or more, given each crater's center and radius. | Hard9 | GeometryDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Enlarging EnthusiasmCount the distinct final rankings achievable when positive point bonuses summing to x are announced in increasing order, with the lead changing hands each time. | Hard9 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Jupiter Rock Paper ScissorsEach player crops a length-k substring, Alice morphs one block, then the play phase awards 2/1/1 points by who reaches m round wins first; report the optimal outcome. | Hard9 | Game theoryImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Crazy RotationsGiven a row of coloured lights, find the smallest rotation amount that can appear at position p in a non-decreasing sequence of rotation craziness values. | Hard9 | String matchingCombinatorics+2 | No attempts yet | 15s | 512 MB | Judgeable |
| GCD SumFor each k from 1 to n, split a multiset of n numbers into k nonempty groups to maximize the sum of the groups' gcds. n is up to 500000 and each value up to 10^12. | Hard9 | Number theoryGreedy+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| SkiingFind the shortest polygonal path from S down to F that crosses n horizontal gates in top-to-bottom order, and output its breakpoints. | Hard9 | GeometryGreedy+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Restaurant BribesGiven a friendship graph and a list of k people to bribe, choose a real bribe for each so the total restaurant revenue minus bribe money is maximized, and print the answer as an exact reduced fraction. | Hard9 | GraphMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Lunar LandscapeCompute the total area covered by axis-aligned squares and 45-degree rotated squares, counting overlaps once. | Hard9 | GeometrySorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| ToysCount the number of distinct toys formed by strings joining n evenly spaced clamps on one disc to m on another, where rotating each disc independently gives the same toy, modulo 1,000,000,007. | Hard9 | CombinatoricsNumber theory+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Workbook AlgorithmsCount the number of undirected graphs X on N vertices whose number of permutations P satisfying G(P)=X lies between l and r, modulo 1e9+7. | Hard9 | CombinatoricsGraph+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Secret AgentGiven a planar straight-line graph (castle walls) where crossing a wall costs its height, find the minimum cost to travel between successive query points, starting from infinity. | Hard9 | GraphGeometry+2 | No attempts yet | 2s | 512 MB | Judgeable |
| GarageMaintain a sequence under point updates, and for each range query count subarrays whose elements share a common divisor greater than 1. | Hard9 | Segment treeNumber theory+2 | No attempts yet | 4s | 256 MB | Judgeable |
| Counting CyclesA connected undirected graph with n vertices and at most n+15 edges is given; count all simple cycles, where a simple cycle is a connected subgraph with every degree exactly two. | Hard9 | GraphDFS+2 | No attempts yet | 4s | 512 MB | Judgeable |
| LeadersAnimals in a circle alternately raise a running number by 1 to K; whoever is forced to say M loses, and we find the winner of every start position. | Hard9 | Game theoryDynamic programming+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Disco Dance DebacleGiven a grid where some cells are unlit (unions of rectangles), find the fewest cell states to flip so that a set of alternating row-column dances can cover all lit cells, each dance starting and ending on the same cell with different first and last feet. | Hard9 | GraphGreedy+2 | No attempts yet | 5s | 512 MB | Judgeable |
| KabobsCount length-K strings over the given alphabet that satisfy all substring-implication rules of the form b>e, modulo 10^7. | Hard9 | Dynamic programmingString+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Vera and Love TrianglesFor each pair of friends, a crush direction is set by the parity of the bit-count of a modular power expression; count cyclic triples. | Hard9 | CombinatoricsNumber theory+2 | No attempts yet | 2s | 256 MB | Judgeable |
| DramaCount the number of valid pyramid colourings of an H by N grid with exactly N black cells, modulo 10^9+7. | Hard9 | CombinatoricsDynamic programming+1 | No attempts yet | 2s | 512 MB | Judgeable |
| L-th K-th numberGiven N cards, take the K-th smallest value of every contiguous block of length at least K, then report the L-th smallest of all those values. | Hard9 | Binary searchArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Revenge of the Endless BFSDecide whether a buggy BFS that forgets visited vertices ever terminates on a given directed graph, and if so output the loop count modulo 1e9+7. | Hard9 | GraphBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Conveyor BeltAfter each of Q delivery requests (a, b, p) is added, report the minimum time to finish all tasks, given plates arrive one per second and each plate carries one product. | Hard9 | MathGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Blocks 2Count the ways to tile an N x M rectangle with rotated k x N blocks (k=1..N), modulo 1999, where M can be as large as 10^10. | Hard9 | CombinatoricsDynamic programming+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Stamp PaintingCount the distinct colorings of an N-unit canvas obtainable by stamping K-wide colored stamps so every unit ends up painted, modulo 1e9+7. | Hard9 | Dynamic programmingCombinatorics+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Euclidean NimFor each pair of move sizes p and q and starting pile n, decide which player wins the take-or-add game, or that it draws. | Hard9 | Game theoryMath+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Maximal polygon brightnessGiven a convex polygon and a sequence of vertex deletions, compute after each deletion the largest total length of edges that a single external light point can illuminate. | Hard9 | GeometryDynamic programming+2 | No attempts yet | 3s | 1024 MB | Judgeable |
| In honor of Taekhee's graduationDeer bounce on a line segment [0,T], each with strength; a statue at x falls when the net force of deer that have reached it exceeds W. Maximize the fall time over x. | Hard9 | MathSimulation+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Want to solve a problem?For given K and C, choose A > 0 to maximize the characters saved by writing K+A repeated K+A times instead of K repeated K times, minus C times A. | Hard9 | String matchingMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Number of SequencesFor a given N and C, find the lexicographically smallest triple (X, Y, Z) such that exactly C ordered N-tuples of 31-bit integers have OR X, AND Y, XOR Z, or report none exists. | Hard9 | Bit manipulationCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Uncrossed Knight's TourGiven an m by n board (m at most 8, n up to 1e15), find the maximum number of squares a closed knight tour can visit without crossing itself. | Hard9 | GreedyDynamic programming+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| TteokpireCount the number of ways to write N as an ordered sequence of one or more positive integers; equivalently, count compositions of N, modulo 1e9+7, for N up to 1e12. | Hard9 | CombinatoricsMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Circle SelectionProcess circles in decreasing radius order; each chosen circle removes all remaining circles that intersect it, and for every circle you must report which chosen circle eliminated it. | Hard9 | GeometrySorting+2 | No attempts yet | 3s | 1024 MB | Judgeable |
| United States of EurasiaSplit N points sorted by x into at most K contiguous groups, minimizing the largest squared diameter within any group. | Hard9 | Binary searchDynamic programming+2 | No attempts yet | 20s | 1024 MB | Judgeable |
| Voronoi DiagramGiven a connected weighted graph and a set of source vertices, assign every point on every edge to its nearest source (smallest index on ties) and report the total length each source owns. | Hard9 | GraphShortest path+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| Cryptarithm?!Given three letter strings A+B=C, decide whether some assignment of distinct digits to letters makes the addition valid, columns up to 18 long. | Hard9 | BacktrackingMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Tree EscapeOn a rooted tree where each leaf starts with one piece, players alternately move a piece to its parent and remove it at the root; decide if the first player wins. | Hard9 | Game theoryTree+2 | No attempts yet | 2s | 512 MB | Judgeable |
| SquareFreeGiven n up to 10^18, find the n-th squarefree positive integer using Mobius inversion and binary search. | Hard9 | MathNumber theory+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Fibonacci Digit CountCount occurrences of the substring "11" within the first N characters of the infinite string formed by writing 1, 2, 3, ... in Fibonacci (Zeckendorf) representation. | Hard9 | MathDynamic programming+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| f and gCompute g(T,k)=sum_{x=0}^{T} sum_i (x+a_i)^k mod 1e9+7 for every k from 0 to K, given N up to 1e5, K up to 5e4, T up to 1e18. | Hard10 | MathCombinatorics+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Find Marble Positions and VelocitiesReconstruct each marble's starting x-coordinate and constant velocity from N+1 unordered snapshots of N linearly moving marbles. | Hard10 | MathCombinatorics+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Coalescing ContinentsGiven K rectangles with total area 25 on a 20x20 grid, decide if they can be translated to tile a square, and find the minimum total moves. | Hard10 | Brute forceMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| CubesCount the orbits of general-purpose chip placements on cube faces under face rotations and cube rearrangement, given a fixed pattern of encoding chips. | Hard10 | CombinatoricsMath+2 | No attempts yet | 1s | 128 MB | Judgeable |