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 results3,779 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| MinerFor each lamp position above a polyline mine floor, find the reachable floor interval lit without crossing the floor. | Hard9 | GeometryBinary search+2 | No attempts yet | 1.5s | 512 MB | Judgeable |
| Robotic Cow HerdEach robot picks one model per location, and all K robots must differ somewhere; find the minimum total cost of K distinct robots. | Hard9 | HeapGreedy+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 |
| Clash Royale (Large)Pick 8 of N cards and spend at most M coins on upgrades to maximize the total attack power of the chosen deck. | Hard9 | Dynamic programmingGreedy+1 | No attempts yet | 20s | 512 MB | Judgeable |
| Map Reduce (Large)Each query asks whether walls can be removed so the shortest S-to-F path equals D, and if so reports the deterministic greedy removal order's final map. | Hard9 | BFSGraph+2 | No attempts yet | 5s | 512 MB | Judgeable |
| The Kingdom of JOIOIPartition an H by W grid into two connected regions whose row and column slices are contiguous, minimizing the larger altitude range within either region. | Hard9 | Binary searchGreedy+2 | No attempts yet | 4s | 256 MB | Judgeable |
| RopeA rope of N unit cords with colors is repeatedly folded in half, paying the thickness of cords whose colors are changed, until length 2; for each color report the minimum total cost to end with a cord of that color. | Hard9 | Dynamic programmingDivide and conquer+2 | No attempts yet | 2.5s | 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 |
| 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 |
| 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 |
| Smallest unreachable subsequence sumFor each subarray, find the smallest non-negative integer that no subsequence sums to. | Hard9 | Segment treeGreedy+1 | No attempts yet | 2s | 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 |
| 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 |
| Treasure MapOn a weighted undirected graph, gold decays each day at every mine; starting at mine 1 with forced moves, maximize total gold collected before stopping. | Hard9 | GraphDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| IntuidiffFind the minimum number of blocks, each a substring of the first string or a single new character, whose concatenation equals the second string. | Hard9 | String matchingGreedy+2 | No attempts yet | 7s | 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| Koala GameDetermine properties of a hidden permutation by bidding stones in a game where Koala optimally maximizes the sum of values she wins, using as few rounds as possible. | Hard9 | Game theoryGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Growing TreesGiven a tree whose edge weights change linearly with the day, find the day in [0, D] that minimizes the diameter, and report that diameter. | Hard9 | TreeGreedy+2 | No attempts yet | 5s | 768 MB | Judgeable |
| Cloud computingChoose a set of orders and a set of computers to buy so every accepted order gets enough cores at its minimum clock rate, maximizing payments minus computer costs. | Hard9 | Dynamic programmingGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| BuildingsCount the distinct houses formed by placing m walls of n by n colored squares around an m-gon, up to rotation, modulo 1e9+7. | Hard9 | CombinatoricsMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Growing MicroorganismsWith buy costs and production costs, buy microorganisms and make each kind produce others to reach x_i of every kind at minimum total cost. | Hard9 | MathGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| ConstellationChoose a subset of up to 2e5 points maximizing total brightness so that from any chosen point all others fall in the first or third quadrant, with the nearest point in each occupied quadrant within Chebyshev distance L. | Hard9 | MathGeometry+2 | No attempts yet | 1.5s | 512 MB | Judgeable |
| Black ChainGiven a chain of n rings (up to 10^18), find the fewest rings to open so the resulting pieces can be combined into every weight from 1 to n. | Hard9 | GreedyCombinatorics+2 | No attempts yet | 0.1s | 512 MB | Judgeable |
| In Case of an Invasion, Please. . .Place people from n city nodes, with at most 10 capacity-limited shelters on a weighted road network, to minimize the latest arrival time at any shelter. | Hard9 | Binary searchBFS+2 | No attempts yet | 3.5s | 512 MB | Judgeable |
| EscalatorsChoose unordered paths on a tree and pay V[u] plus every other endpoint's complemented value to maximize total tokens. | Hard9 | TreeDynamic programming+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Prime Tree - 2This output-only task asks for labels 1 to n on a tree's vertices so that as few edges as possible join two labels sharing a common divisor greater than 1. | Hard9 | Number theoryTree+2 | No attempts yet | 10s | 512 MB | Judgeable |
| Prime Tree - 4Relabel every vertex of each tree with 1 to n so the edges whose two labels share a divisor exceed 1 are as few as possible. | Hard9 | GreedyNumber theory+2 | No attempts yet | 10s | 512 MB | Judgeable |
| Prime Tree - 6Assign labels 1 to n to tree vertices so that edges joining two numbers with a shared factor are as few as possible. | Hard9 | GraphGreedy+2 | No attempts yet | 10s | 512 MB | Judgeable |
| Prime Tree - 7Relabel the vertices of each given tree with 1..n so that the number of edges whose endpoints share a common divisor above 1 is minimized, and submit the answer file. | Hard9 | GreedyNumber theory+2 | No attempts yet | 10s | 512 MB | Judgeable |
| Prime Tree - 9Relabel the vertices of given trees so that the number of edges whose endpoints share a common divisor greater than 1 is as small as possible. | Hard9 | GraphGreedy+2 | No attempts yet | 10s | 512 MB | Judgeable |
| Prime Tree - 10Relabel the vertices of a given tree with 1..n so that as few edges as possible join two labels sharing a common divisor; this is an output-only optimization task. | Hard9 | Number theoryGreedy+2 | No attempts yet | 10s | 512 MB | Judgeable |
| Lexicographically Smallest Sign SequenceFill a sign sequence of -1 and 1 with some fixed entries so that every range [Ai,Bi] has sum at least Ci, and output the lexicographically smallest valid sequence or Impossible. | Hard9 | GreedyPrefix sum+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Monitoring Ski PathsA DAG has at most one outgoing edge per junction and unique landing points; pick the fewest junctions met by all m registered s-to-t to-basement paths. | Hard9 | GraphGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Decorator CubeloverArrange n decorations on an n^3-cycle so each window of three labels is unique and the positional-value sum is minimal; report the nth digit of p-1. | Hard9 | CombinatoricsMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Halves Not EqualDivide s dinars among n wives so that every pair's shares match the given two-person fair split rule and the total equals s. | Hard9 | MathGreedy+1 | No attempts yet | 3s | 512 MB | Judgeable |
| Removing Magical TilesGiven trapezoid tiles above the x-axis, find the minimum number of groups where each group is a set of tiles that pairwise overlap. | Hard9 | GreedyGeometry+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Black CompanyAssign positive salaries minimizing their sum so that every edge and every two edges sharing an endpoint order their endpoints consistently with contribution degrees. | Hard9 | GraphTopological sort+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Sweet and SourChoose which Candy Country players drink a potion that randomizes their sweetness and sourness, maximizing Candy's expected match points under all random player orders and event coin flips. | Hard9 | ProbabilityCombinatorics+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Query and QueryEach query swaps two sequence values; after every swap, pair up the M left-pocket indices and M right-pocket indices to minimize the largest range maximum. Output that minimized maximum. | Hard9 | Segment treeGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| The Tallest and Widest CastleChoose which signposts serve as vertices of each floor so the castle has the most floors, then the largest total floor area, then the fewest signposts used, and report each signpost's floor number. | Hard9 | GeometryDynamic programming+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Gosu 2Given a tournament on N players, find a transitive subtournament (chain) of size exactly 1 + floor(log2 N). | Hard9 | Divide and conquerCombinatorics+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| Two TransportationsTwo programs, each holding one set of weighted edges, exchange at most 58000 bits to compute single-source shortest path distances from city 0 in the union graph. | Hard9 | Shortest pathGraph+2 | No attempts yet | 10s | 256 MB | Judgeable |
| AsceticismCount permutations of 1..N such that an optimal daily reading schedule (reading consecutive sentences within each day's time slots) finishes the sutra in exactly K days. | Hard9 | Dynamic programmingCombinatorics+2 | No attempts yet | 0.6s | 256 MB | Judgeable |
| CandiesFor each j, find the maximum sum of j non-adjacent values chosen from N candies in a row. | Hard9 | Dynamic programmingGreedy+2 | No attempts yet | 5s | 512 MB | Judgeable |
| ConstellationCount the ways to assign each unlabeled point to constellation A or B so that the two vertex sets can be drawn connected with mutually non-crossing segments. | Hard9 | GeometryCombinatorics+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Graph and CyclesGiven a weighted complete graph on an odd number of vertices, partition all edges into edge-disjoint cycles and minimize the sum over each cycle of the max weight on consecutive edge pairs. | Hard9 | GraphGreedy+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Easy WinAfter each edge insertion, find the maximum total weight of a subset of edges such that no non-empty edge-disjoint union of cycles in it has Nim value (xor of stone counts) equal to zero. | Hard9 | Game theoryUnion-find+2 | No attempts yet | 1.5s | 512 MB | Judgeable |
| Six WordsGiven a connected graph whose vertex i has potential i and edge i has weight i, find the total weight of a minimum spanning tree of the line graph of the line graph. | Hard9 | GraphMinimum spanning tree+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Seven NeversFor every window of k consecutive elements in a permutation, compute the LIS length after deleting that window. | Hard9 | Dynamic programmingSegment tree+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Um_nik's AlgorithmGiven an undirected bipartite graph with up to 2e6 vertices and edges per side, output a matching whose size is at least 0.95 times the maximum matching size, with heavy constant-factor optimization required. | Hard9 | GraphGreedy+2 | No attempts yet | 4s | 512 MB | Judgeable |
| Bracket Euler TourFind an Euler tour of an undirected graph whose vertex bracket labels, read in traversal order, form a correct bracket sequence, or report that none exists. | Hard9 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Long GamePlayers alternately cut a strip of a permutation while every cut must leave at least one strip containing an inversion; decide the winner with optimal play. | Hard9 | Game theoryGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Karaoke MeetupIn a weighted tree, some vertices are marked as houses. For each vertex compute the ratio of the nearest marked vertex distance to the farthest, and output the maximum ratio as a reduced fraction. | Hard9 | TreeDFS+2 | No attempts yet | 8s | 512 MB | Judgeable |
| CerealGiven a queue of cows each with a favorite and second-favorite cereal, report for every prefix removal how many cows still get a box. | Hard9 | GreedySimulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Deja VuMaintain an array under point updates and answer queries asking for the earliest position d that ends an increasing subsequence of length 4 starting at or after l. | Hard9 | Segment treeDynamic programming+2 | No attempts yet | 5s | 512 MB | Judgeable |
| AdditionDesign a short string-rewriting script in a custom language that reads two binary numbers joined by + and rewrites them into their binary sum. | Hard9 | String matchingSimulation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Rikka with Tree GameOn a rooted tree where players alternately move a token to a child and the score is the final depth, repeatedly attach leaves and find the limit of f(k)/k, where f(k) is the fewest additions making the optimal score exactly k. | Hard9 | Game theoryTree+2 | No attempts yet | 2s | 512 MB | Judgeable |
| JokeGiven a text and up to ten patterns with per-letter erasure costs, delete letters so that no pattern occurs, minimizing total cost. | Hard9 | String matchingDynamic programming+2 | No attempts yet | 1s | 512 MB | Judgeable |
| EarthquakeEach route is usable only if all its bridges survive; pick an adaptive inspection order of bridges to minimize the expected number of inspections before deciding whether any route connects the two lands. | Hard9 | ProbabilityDynamic programming+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Maximum FlowGiven two paths of n vertices each plus 2n+1 cross edges with huge capacities, find the max flow from (0,0) to (1,n). | Hard9 | GraphShortest path+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Less Time, More ProfitChoose a subset of plants to build; a shop pays off only when every plant it needs is built. Minimize the maximum build time, then maximize profit within that time. | Hard9 | Dynamic programmingGraph+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Navigation GameConstruct a 100x100 arrangement of the numbers 1 to 10000 that maximizes a navigation score, where jumps off the current row or column cost points. | Hard9 | GreedyImplementation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Wrong AnswerConstruct a cost matrix that makes a greedy two-character solution as far from optimal as possible, maximizing the ratio of its output to the true minimum. | Hard9 | GreedyDynamic programming+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Delightful (Easy)Write a program of at most 100 commands for a ternary computer with 26 40-trit registers that computes the length of the longest non-decreasing prefix of the input in register X and leaves the answer in Y. | Hard10 | ImplementationSimulation+2 | No attempts yet | 1s | 512 MB | Judgeable |