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 | |||||
|---|---|---|---|---|---|---|
| Fast FoodGiven up to 50 points in a 10 by 10 square, compute for each point the area of its Voronoi cell within the square and report the percentage, rounded to nearest with halves up. | Hard9 | GeometryDivide and conquer+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Phylogenetic TreeGiven the graph of organisms joined when their tree distance is at most 3, find the fewest edges in any phylogenetic tree that produces it. | Hard9 | GraphTree+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Checker BoardEach row holds at most one checker per color; players slide their pieces along rows and the one who cannot move loses. Decide whether White wins, Black wins, or the game can run forever. | Hard9 | Game theoryGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TelecorpPlace one of M module types on any subset of N teleporters, each jump skipping ahead and multiplying speed, to minimize total travel time from 0 to L. | Hard9 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Longest Paths in a TreeA rooted tree has weighted edges. Handle point updates to edge weights and queries that ask for the maximum-weight downward path from a vertex inside its subtree. | Hard9 | TreeSegment tree+2 | No attempts yet | 5s | 1024 MB | Judgeable |
| Falling BallsGiven slanted platforms whose endpoints move over time, find the final x-coordinate reached by a ball dropped at a given x. | Hard9 | Segment treeTree+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| Joy of Mobile RoutingGiven grid building heights and antennas, find the shortest path from a start to a destination intersection where every visited intersection has line-of-sight to some antenna. | Hard9 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Prince of PersiaGiven a grid room, mirrors with fixed orientations and allowed cells, and plates on walls, decide whether the light ray can reach every plate. | Hard9 | SimulationGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Deformed WheelSimulate a convex polygon rolling down a piecewise-linear hill until it comes to rest, and print the final position of its center of gravity. | Hard9 | GeometrySimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Parallel ExpectationsGiven two programs run by randomly interleaving their instructions, find the expected final value of every shared variable. | Hard9 | ProbabilityDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Find the BorderGiven a closed self-intersecting polyline, count the vertices of the border of its interior, the outer boundary enclosing all bounded regions. | Hard9 | GeometryImplementation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| IlluminationAssign N fixed angular directions to N sources so their wedges cover the plane and the sum of projections is minimized, tie-broken lexicographically. | Hard9 | GeometryCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| King's QuestFor each son, list every girl he likes such that a perfect matching still exists when he marries her. | Hard9 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ExamGiven each student's distribution over exam scores, find the exact probability that the sequence of European marks from all students avoids every listed unpleasant string. | Hard9 | Dynamic programmingString matching+2 | No attempts yet | 2s | 128 MB | Judgeable |
| JoggerGiven the distance matrix of a tree with houses as leaves, find the leaf pair whose weighted travel time (distance times r plus internal nodes crossed times t) is largest. | Hard9 | TreeGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| PurifyRepeatedly delete forbidden substrings from P, always choosing the earliest-ending occurrence and removing the shortest such forbidden word, then print what remains. | Hard9 | StringTrie+2 | No attempts yet | 1s | 64 MB | Judgeable |
| DuopolyGiven two sets of weighted bids on channels, where bids within one company are disjoint, pick a subset of non-conflicting bids to maximize total price. | Hard9 | Dynamic programmingGreedy+1 | No attempts yet | 3s | 32 MB | Judgeable |
| Coloring mapsSimulate a greedy 5-coloring where each vertex takes the smallest color not used by already colored neighbors and report failure. | Hard9 | GraphGreedy+1 | No attempts yet | 1s | 32 MB | Judgeable |
| Structural IsomersCount the number of distinct alkane carbon skeletons (free trees in which every node has degree at most 4) with n carbon atoms. | Hard9 | Dynamic programmingCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Juggle with CriteriaFor each of n five-symbol relation patterns (<, =, >) and a fixed length l, decide whether two permutations of length l exist whose inversion count, local inversions, LIS, longest increasing substring, and fixed points match that exact pattern. | Hard9 | CombinatoricsDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Accountant NotesFor each note, find every starting row in the summary file where a renamed transcription of the note appears as consecutive rows. | Hard9 | String matchingHash map+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Hypervisor MacrOSDecode an altered event log with a hidden reverse switch by maintaining reachability and answering whether A must precede B. | Hard9 | GraphTopological sort+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Suffix Array ReconstructionGiven a permutation p, decide whether it is the suffix array of some lowercase string and, if so, output the lexicographically smallest such string. | Hard9 | StringGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Markov TrainsFind the station list maximizing the chance of arriving by a deadline when each train may be cancelled and the traveler waits for the next one after a cancellation. | Hard9 | Dynamic programmingProbability+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Mirror TrapFor each box [-x,x]x[-y,y]x[-z,z], find the maximum Manhattan distance a laser at the origin can travel before returning to the origin, avoiding edges and vertices. | Hard9 | MathNumber theory+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Dextrogyrate CamelFind the longest closed camel route that starts at oasis 1 heading to oasis 2, always turns right by at most 180 degrees at each oasis, never crosses itself, and visits the most distinct oases. | Hard9 | GeometryDynamic programming+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Bus TourChoose a sequence of attractions with strictly increasing construction times maximizing attractiveness collected plus Manhattan travel distance. | Hard9 | Dynamic programmingSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Save the DinosaursFor each vacant point, add it to the existing set and report the area protected by the soldiers (the region where every move gets closer to some soldier). | Hard9 | GeometrySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Wandering Flea TrainersGiven two functional graphs on n labeled nodes, decide whether some vertex relabeling makes the graphs isomorphic, i.e. the fleas' dance is identical. | Hard9 | GraphDFS+2 | No attempts yet | 3s | 128 MB | Judgeable |
| BankFind the lexicographically smallest four-currency reserve vector that lets a bank serve all clients in some order, where serving client i requires its remaining need in all four currencies to be covered at once. | Hard9 | GreedyMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SleepwalkerA self-similar walk on a 3^k by 3^k grid is defined by a recursive rewrite; given a starting tile on the walk and a hole tile, find the number of steps until the walk reaches the hole. | Hard9 | RecursionDivide and conquer+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Ice rinkA skater slides in straight lines across a square rink with rectilinear obstacles, stopping only at walls, and must reach the finish point in the fewest slides. | Hard9 | BFSGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| AB-wordsGiven up to 1000 nice ab-words (balanced parentheses words), count the maximum subset of pairwise non-similar words under a recursive similarity relation. | Hard9 | TreeHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Recursive AntOn a 2^n by 2^n board with at most 50 forbidden cells, find for each of the four borders a cell where a recursive quarter-by-quarter Hamiltonian tour can end, or report none. | Hard9 | Divide and conquerRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| MessengersGiven a 2-connected graph, output the lexicographically smallest pair of search plans from city 1 so that for any single occupied non-capital city, both messengers together warn every city. | Hard9 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TreesFor each tree, find the smallest adjacent-difference sum reachable by either keeping the row or swapping that tree with one other tree. | Hard9 | ArrayMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Axes of SymmetryFor each simple polygon, count its axes of symmetry; n can reach 100000, so the check must run in near-linear time. | Hard9 | String matchingGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Driving ExamBuild at most k new horizontal one-way streets on a grid so that the number of streets whose southern end can reach every street's northern end is maximized. | Hard9 | GraphDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TollEach selected town must charge on exactly one incident road, and no road may be charged by both endpoints. Maximize selected towns in a general graph, not necessarily the whole graph. | Hard9 | GraphMath | No attempts yet | 1s | 128 MB | Judgeable |
| Isles in a Triangular GridEnumerate all non-congruent triangular-grid isles of up to ten triangles, canonicalizing each by the lexicographically smallest clockwise boundary-turn word. | Hard9 | GeometryBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| IslandGiven a convex polygon with towns on its vertices, all diagonals and sides drawn, and some segments blocked, find the shortest path from vertex n to vertex 1 using roads and their crossings. | Hard9 | GraphShortest path+1 | No attempts yet | 1s | 128 MB | Judgeable |
| The CodeGiven a prefix code entered via button presses, find the code words that resynchronize decoding after any loss of leading bits. | Hard9 | TrieString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| HamstersFind the shortest lowercase string containing at least m occurrences of the given hamster names, counted with multiplicity. | Hard9 | String matchingDynamic programming+2 | No attempts yet | 3s | 512 MB | Judgeable |
| OnesGiven run lengths of n in binary, output run lengths of the binary form of sks(n), the total UFO count over 1 to n. | Hard9 | MathCombinatorics+2 | No attempts yet | 3s | 512 MB | Judgeable |
| GarbageEach street needs its state flipped or not; a route is a simple cycle, and driving a street flips it. Find the minimum total length of cycles whose symmetric difference equals the set of streets needing a flip. | Hard9 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| PeriodicityFor each name, find the lexicographically smallest bit string of the same length whose set of periods equals the name's set of periods, or XXX if none exists. | Hard9 | StringPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Milk MultidrinkDecide whether a tree with n nodes has a Hamiltonian path from 1 to n where consecutive vertices stay within distance two. | Hard9 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Ski RentalGiven daily snowfall amounts with point updates, answer queries asking for the maximum average snowfall over a consecutive run starting at a given day, reported as an irreducible fraction. | Hard9 | Segment treeGeometry+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Binary KnockoutA coin game on a line: each coin may double its position or move one step right; the player unable to move loses. Find the k-th value of n where the second player wins. | Hard9 | Game theoryMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SpiderA walk on an infinite regular seven-legged web is given as turn directions; count the web nodes strictly inside the closed polygon it traces. | Hard9 | GeometryImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| JourneysGiven m batches, each joining every town in one interval to every town in a disjoint interval, find the shortest path in highway count from town p to all towns. | Hard9 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Computational BiologyFor each query length m, find a length-m word whose every cyclic rotation appears in s, maximizing the total count of those rotations in s. | Hard9 | StringSorting+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Hard ChoiceAfter streets are closed one by one offline, answer for each query whether two edge-disjoint paths still connect the given pair of junctions. | Hard9 | GraphDFS+2 | No attempts yet | 5s | 128 MB | Judgeable |
| FragmentsCount how many times each digit string appears as a contiguous substring across the decimal forms of all numbers in a union of disjoint integer intervals up to 10^18. | Hard9 | String matchingDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Army TrainingGiven n points with no three collinear, answer m queries, each a simple clockwise polygon on those points, counting the points strictly inside it. | Hard9 | GeometryCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Blindfold NimEach stack size is uniform on [0, a_i]; compute the probability that the first player wins a game of Nim with hidden positions where a player who overshoots a stack loses at once. | Hard9 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Quasi-templateCount the distinct words that, as substrings of v with possibly overhanging copies, can tile across the whole input; report the count and the shortest, lexicographically smallest such word. | Hard9 | String matchingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| DiamondGiven a convex polyhedron, choose one plane cut so that the two resulting pieces have the largest combined number of faces. | Hard9 | GeometryBrute force+1 | No attempts yet | 2s | 512 MB | Judgeable |
| FishesGroup recorded closed routes into the fewest fish, where two routes can follow on consecutive days if the start cells touch and every point is visible 24 hours earlier. | Hard9 | GraphGeometry+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Programming ContestGiven each participant's skill per topic, decide whether we can choose n tasks (topic and difficulty) so Byteman is the unique winner under solve-count then points ranking. | Hard9 | GreedyMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| WatchmenCount, for each city gutter, how many Palace gutters a walker can reach while dodging rotating watchers' lines of sight. | Hard9 | GeometryGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| QuestionsSimulate a logic puzzle where princes and a sorcerer reason about a system of variable constraints over time; answer what each prince or the sorcerer knows. | Hard9 | Brute forceSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Dragon MilkdrinkerCompute the probability that the sum of n independent uniform [m, M] yields is strictly less than h, printed truncated to d decimals. | Hard9 | ProbabilityMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Video PokerFor a given video poker payout table, count how many of the 2,598,960 dealt hands make the optimal expected-value strategy discard exactly 0, 1, 2, 3, 4, and 5 cards. | Hard9 | Brute forceCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| MicrochipsCount directed walks whose edge-impedance product equals I, allowing repeated vertices and edges, and report infinity when infinitely many such walks exist. | Hard9 | GraphNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Fibonacci WordCount occurrences of a given binary pattern in the Fibonacci word F_m and count distinct subwords occurring at least that many times, mod 20062006, with m up to 1e9. | Hard9 | StringDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| HighwaysMaintain a layered graph where each province has a few cities and highway lane counts change over time, answering route-count queries modulo d after each update. | Hard9 | MatrixSegment tree+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Reconstructing the Convex PolygonGiven all edges and non-crossing diagonals of a convex polygon with shuffled vertex labels, recover the cyclic boundary order, with vertex 1 first and the smallest possible second vertex. | Hard9 | GraphImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| ManhuntGiven a connected undirected graph where the bandit moves to a different city each night, find the minimum number of days for a search schedule that guarantees capture, or report impossibility. | Hard9 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Prefix-SuffixesCount proper borders summed over all substrings of a given lowercase word of length up to 10^5. | Hard9 | String matchingString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| PeaksFor each query, starting from a peak and using only edges up to a difficulty limit, report the k-th highest reachable peak height or -1. | Hard9 | GraphUnion-find+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Minimum bracketsGiven an arithmetic template with holes, delete as many brackets as possible while keeping the same value for every valid assignment of real numbers to the holes. | Hard9 | StringImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| HighwaysGiven a tree plus extra highway edges, count for each query (x,y) the main tree path plus alternative single-highway paths that touch the main path only at x and y. | Hard9 | TreeDFS+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Palindromic EquivalenceCount words of the same length that have palindromic substrings at exactly the same positions as the given word. | Hard9 | StringString matching+2 | No attempts yet | 1s | 128 MB | Judgeable |
| BARMANGiven orders m_i of hidden values modulo a hidden n, choose up to 2k range-multiply operations to maximize the worst-case guaranteed order of the final sum. | Hard9 | Number theoryMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| GodzillaAfter each of k edge deletions in a directed graph, the task asks for the smallest number of start vertices that reach every vertex. | Hard9 | GraphUnion-find+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SetsGiven n arithmetic-progression sets of multiples of d_i, count elements in their union that share no prime factor with m. | Hard9 | MathNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Most Valuable TowerFind the largest sum any single tower can reach by swapping top segments between towers of different heights. | Hard9 | Number theorySorting+2 | No attempts yet | 1s | 512 MB | Judgeable |
| SequenceFind the nth term of the nondecreasing sequence where each k appears exactly as many times as the kth term. | Hard9 | MathBinary search+1 | No attempts yet | 1s | 512 MB | Judgeable |
| GenomeBuild the lexicographically smallest sequence that is l adjacent swaps from the first genome and k-l swaps from the second. | Hard9 | GreedySegment tree+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Land TaxChoose a non-empty contiguous row and column range that maximizes combined row and column payments weighted by heights and widths. | Hard9 | Divide and conquerGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Plot of LandGiven up to 3000 pine points and one million query rectangles, report the convex hull area of the points inside each rectangle. | Hard9 | GeometryDivide and conquer+1 | No attempts yet | 1s | 128 MB | Judgeable |
| CrystalSum the signed charges of all three-colored unit triangles in a hexagonal crystal filled row by row from a modular generator. | Hard9 | MathGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Thirsty AntsAnts on a line walk at unit speed toward the nearest fallen dew drop, and the task asks for every ant's position when the last drop is drunk. | Hard9 | SimulationSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| MultiplicationGiven prime p and each query pair a and b, find the smallest k with a to the k-th power congruent to b modulo p, or print -1 when b never appears. | Hard9 | Number theoryMath+1 | No attempts yet | 5s | 128 MB | Judgeable |
| DeliverySend as many trucks as possible from the top-left to the bottom-right corner of an n by n grid where each street has a daily usage limit. | Hard9 | GraphShortest path | No attempts yet | 10s | 128 MB | Judgeable |
| WombatsFind the cheapest southbound path across a grid with free east-west moves and south-only vertical roads under weight updates and escape queries. | Hard9 | Segment treeShortest path+1 | No attempts yet | 20s | 256 MB | Judgeable |
| PuzzleBuild the longest string over the first n capital letters that avoids all forbidden substrings, or print No when no maximum exists. | Hard9 | String matchingTrie+2 | No attempts yet | 1s | 128 MB | Judgeable |
| RoofCompute the maximum height of the 45-degree straight-skeleton roof built over a rectilinear polygon. | Hard9 | Geometry | No attempts yet | 1s | 128 MB | Judgeable |
| Aquarium DrainageGiven an orthogonal aquarium floor with holes on its segments, compute the total drain time and the water left behind. | Hard9 | GeometrySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Aquarium 3Place K holes on distinct horizontal floor segments to maximize the area of water that drains out. | Hard9 | TreeGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Möbius StripGiven m and n, compute the average graph distance over all ordered square pairs on the m by 2n Mobius grid. | Hard9 | MathCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Fence WatchPlace the fewest sensors on a convex polygon boundary so every boundary point forms an angle from alpha to 360 degrees minus alpha with some sensor pair. | Hard9 | GeometryGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| MineshaftRun a pipe of straight segments up a winding polygonal shaft so each segment touches the walls in at least two places and the number of bends is minimal. | Hard9 | GeometryGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Anchored BalloonFind the greatest height a balloon tied to ground anchors by fixed-length ropes can reach while all ropes hold and none cross. | Hard9 | GeometryBinary search+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Dragon PatternCount how many times pattern S appears as a contiguous block in the length 2^n direction string of the order-n left dragon curve. | Hard9 | String matchingRecursion+2 | No attempts yet | 5s | 128 MB | Judgeable |
| AdriaticOn a 2500 by 2500 grid, islands ordered alike from northwest to southeast connect in one hop, and each island needs the sum of fewest hops from all others. | Hard9 | GraphPrefix sum+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Lonely MountainGiven two orthogonal mountain silhouettes, decide whether any solid casts both and print the largest possible volume modulo 1000000007. | Hard9 | GeometryMath+2 | No attempts yet | 2s | 256 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 |
| It Takes a VillageProcess online trading-post additions that spread through biconnected blocks and capital dominators, and answer revenue queries for single villages. | Hard9 | GraphDFS+2 | No attempts yet | 20s | 128 MB | Judgeable |