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 results14,366 problems
| Topics | Judge | |||||
|---|---|---|---|---|---|---|
| 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 |
| One-Way StreetsGiven an undirected multigraph and required reachable pairs, decide for each edge whether every valid orientation matches the input direction (R), the reverse (L), or both are possible (B). | Hard9 | GraphDFS+2 | No attempts yet | 3s | 256 MB | Judgeable |
| Intrinsic IntervalFor each query range in a permutation, find the smallest subarray containing it whose values form a set of consecutive integers. | Hard9 | Segment treeStack+1 | No attempts yet | 3s | 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 |
| Journey from Petersburg to MoscowFind the minimum cost path from city 1 to city n where only the k most expensive edges of the path are paid for, or all edges if the path has k or fewer. | Hard9 | GraphShortest path+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Laminar FamilyGiven an undirected tree and f vertex sets, each a simple path, decide whether the family of paths is laminar. | Hard9 | TreeDFS+2 | 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 |
| Imelda's Shopping SpreeMaintain a sequence of prices under range-add and range-reverse, and after each update output the number of contiguous segments whose values are strictly increasing. | Hard9 | Segment treeArray+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Majestic Gourmet UniversityGiven proposed FC and IC lab slots with teacher conflicts, seat limits, and timing rules, choose a valid set of labs using the fewest distinct starting days. | Hard9 | GraphBFS+2 | No attempts yet | 2s | 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 |
| Push a BoxGiven a grid with Bessie and a pushable box, decide for each queried cell whether the box can reach it. | Hard9 | GraphBFS+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 |
| GardenerMaintain N gardens under plantings, range deletions of plants taller than h, and range count queries, all with time-dependent growth. | Hard9 | Segment treeBinary search+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Revenge of the Broken DoorAn adversary hides one edge under construction; the traveler learns about an edge only upon reaching its endpoint and must minimize the worst-case distance from S to T. | Hard9 | GraphShortest path+2 | No attempts yet | 10s | 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 |
| Pipe Fitter and the Fierce DogsIn a grid where every odd row and column holds a house, cover all houses with downhill chains, minimizing the cost of pipes through dog blocks, using at most K chains. | Hard9 | Dynamic programmingGreedy+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 |
| Street TreesMaintain a minimum-cost coloring of N vertices with two colors under incremental equality/inequality constraints and point cost updates, reporting the optimum after each operation. | Hard9 | Union-findGraph+2 | No attempts yet | 2s | 256 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 |
| General graph matchingGiven an undirected graph with N vertices and M edges, print the size of a maximum matching. | Hard9 | GraphGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Maximum Weight Matching in a General GraphGiven a weighted undirected graph, find a matching with maximum total edge weight. | Hard9 | GraphGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| New HomeStores of k types each occupy a point and an open year interval; for each (location, year) query, report the maximum over types of the distance to the nearest open store of that type, or -1 if some type is missing. | Hard9 | Segment treeBinary search+2 | No attempts yet | 5s | 1024 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 |
| Xtreme NP-hard Problem?!Find the minimum-weight simple path from vertex 1 to vertex n that uses exactly k edges, or report -1; with n, m, k up to 10^6 this is explicitly NP-hard. | Hard9 | GraphShortest path+2 | No attempts yet | 5s | 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 |
| Travelling MerchantGiven a directed weighted graph and per-market buy/sell prices for K items, find the maximum profit-to-duration ratio of a closed walk trading at most one item at a time, floor it. | Hard9 | GraphShortest path+2 | No attempts yet | 2s | 512 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 |
| Tree and Queries 20Maintain a dynamic forest with link/cut and weighted edges, supporting toggling a vertex weight and querying the minimum weighted sum of tree distances from any vertex, with encrypted vertex indices. | Hard10 | TreeSegment tree+1 | No attempts yet | 5s | 512 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 |
| GeneratorRead an index 0 to 10 and output the exact contents of the matching recovered file gen_i.out from the archive. | Hard10 | ImplementationString+2 | No attempts yet | 2s | 256 MB | Judgeable |
| LogoGiven up to five polyomino patch shapes (each a subset of a 3x3 grid, flippable and rotatable) and up to three grid designs up to 55x5, decide if each design can be tiled exactly by non-overlapping patches and find the minimum patch count, or report NIE. | Hard10 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| String Palindrome QueriesMaintain a lowercase string under block moves, reversals, and single-character insertions, answering after each change whether a given substring reads the same forwards and backwards. | Hard10 | StringString matching+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Rational Approximation | Unrated | Not classified yet | No attempts yet | 1s | 128 MB | Judgeable |
| Zu | Unrated | Not classified yet | No attempts yet | 1s | 256 MB | Judgeable |
| Star Pattern 15 | Unrated | Not classified yet | No attempts yet | 1s | 256 MB | Judgeable |
| Star Pattern - 16 | Unrated | Not classified yet | No attempts yet | 1s | 256 MB | Judgeable |
| Printing Stars 20 | Unrated | Not classified yet | No attempts yet | 1s | 256 MB | Judgeable |
| Star pattern 22 | Unrated | Not classified yet | No attempts yet | 1s | 256 MB | Judgeable |
| Project Team Vacation Schedule | Unrated | Not classified yet | No attempts yet | 1s | 512 MB | Judgeable |
| Maximum edge cost on a tree path | Unrated | Not classified yet | No attempts yet | 2s | 512 MB | Judgeable |
| Distinct weights on a tree path | Unrated | Not classified yet | No attempts yet | 2s | 512 MB | Judgeable |