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 | |||||
|---|---|---|---|---|---|---|
| Chain & Co.Decide whether axis-aligned square links split into two nonempty groups with every cross pair linked. | Hard9 | GeometryGraph+1 | No attempts yet | 10s | 128 MB | Judgeable |
| Cactus AutomorphismsCount the automorphisms of a given cactus graph with up to 50000 vertices and print the count as a prime factorization. | Hard9 | TreeDynamic programming+2 | No attempts yet | 5s | 256 MB | Judgeable |
| Green EnergyPlace towers of given heights on a polygonal terrain to maximize the total length lit by parallel sun rays blocked by terrain and other towers. | Hard9 | GeometryGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Teaching HazardGiven n and x, count pairs of bases b1 < b2 where n! ends in the same number of trailing zeros p with p at least x. | Hard9 | Number theoryMath+1 | No attempts yet | 5s | 128 MB | Judgeable |
| RecurrenceCount the decrement orders that reduce the given partition to all zeros while staying nonincreasing, modulo 1,000,000,009. | Hard9 | CombinatoricsNumber theory+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Strange GraphDecide whether a connected strange graph, where every high-degree vertex has a degree-2 neighbor and its other neighbors form a clique, has a Hamiltonian cycle. | Hard9 | Graph | No attempts yet | 1s | 128 MB | Judgeable |
| Even cycle partition of a planar graphGiven a vertex-biconnected planar graph with at most two odd faces, decide whether its edges partition into even simple cycles. | Hard9 | GraphMath | No attempts yet | 1s | 128 MB | Judgeable |
| GRADCities join the road network one by one with two roads each, and each query asks the shortest road distance between two cities. | Hard9 | Shortest pathGraph+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Rail Station RecoveryRecover every station's block number and C or D type from the all-pairs shortest-route distances and station 0's block. | Hard9 | GraphSorting+1 | No attempts yet | 3s | 512 MB | Judgeable |
| Gondola replacement countCount the replacement orders that can produce the given circular gondola sequence, modulo 1000000009. | Hard9 | CombinatoricsMath | No attempts yet | 1s | 256 MB | Judgeable |
| FriendChoose a set of people with maximum total confidence so that no two chosen people are friends in the network grown by the three joining rules. | Hard9 | GraphDynamic programming+1 | No attempts yet | 1s | 16 MB | Judgeable |
| OrbitPlace two opposite sensors on the radius-R circle so their brightest-star readings match, and print the pair with the smallest angle. | Hard9 | GeometryMath+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Maximum Transport ProfitPick two villages in the tree so the total profit of the given routes with both endpoints on the path between them is as large as possible. | Hard9 | TreeDynamic programming | No attempts yet | 3s | 256 MB | Judgeable |
| Bisecting the IslandSplit an axis-parallel simple polygon into two congruent pieces with one axis-parallel cut on integer coordinates, or report that none exists. | Hard9 | GeometryBrute force | No attempts yet | 1s | 256 MB | Judgeable |
| The Forest of FangornFind which border camps connect to the start by a path where no tree ever hides behind another tree. | Hard9 | GeometryGraph | No attempts yet | 3s | 64 MB | Judgeable |
| CakeStarting from piece a, Leopold always eats the less delicious piece next to the empty interval, and each query asks how many pieces are eaten before piece b. | Hard9 | Segment treeDivide and conquer+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| Solar LampsCompute each lamp turn-on time from its place in the power-on order and the count of already lit lamps shining on it. | Hard9 | GeometrySegment tree+1 | No attempts yet | 1s | 256 MB | Judgeable |
| ParkingDecide whether axis-aligned cars in a strip of height w can be slid without overlap or rotation from the start layout to the target layout. | Hard9 | GeometryGraph+2 | No attempts yet | 3s | 256 MB | Judgeable |
| Sequence CenterGiven k integer sequences of length n, find an integer sequence that minimizes the maximum Manhattan distance to them. | Hard9 | MathBinary search | No attempts yet | 3s | 256 MB | Judgeable |
| MuseumA burglar picks guards to bribe to maximize the value of exhibits no remaining guard sees minus bribe costs under downward cone views. | Hard9 | GraphGeometry+1 | No attempts yet | 1s | 256 MB | Judgeable |
| TollgateFind the road with the largest expected toll income when every resident visits every restaurant by a random shortest round trip. | Hard9 | Shortest pathGraph+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Watering the Bean PlantsPlace at most one disk of radius R and cover the uncovered parts of N segments with unit-length sticks at minimum total cost. | Hard9 | GeometryGreedy+1 | No attempts yet | 10s | 256 MB | Judgeable |
| ExhibitionFind the cheapest linear-cost cuts to product 1's price, size and weight that put it in some k-set tying the best set without it. | Hard9 | Dynamic programmingMath+1 | No attempts yet | 10s | 256 MB | Judgeable |
| Combinator ExpressionCount the fewest BCKI rewrite steps that reduce the given expression to its normal form. | Hard9 | Dynamic programmingTree+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Expression and SubstringFind the shortest string that matches the given regular expression and contains S as a substring, breaking ties by lexicographic order. | Hard9 | Shortest pathGraph+1 | No attempts yet | 10s | 256 MB | Judgeable |
| Growing Orthogonal SpiralDecide whether an orthogonal spiral whose segment lengths grow by at least 1 can end exactly at (x, y) and print the shortest such lengths. | Hard9 | MathNumber theory+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Red and Black Stepping StonesFind the smallest lookahead queue size that lets the mover survive forever on a red-black directed graph against an adversarial color chooser. | Hard9 | Game theoryGraph+1 | No attempts yet | 9s | 256 MB | Judgeable |
| Pork barrelFor each query interval [l, h], build the cheapest forest using only roads with costs inside the interval that connects as many city pairs as possible. | Hard9 | Minimum spanning treeDivide and conquer+2 | No attempts yet | 30s | 256 MB | Judgeable |
| Hidden MazeCompute the expected median edge weight over all tree node pairs at odd distance, and print it as a reduced fraction. | Hard9 | Divide and conquerTree+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Tokyo Olympics CenterAssign each lettered unit to one of K staff and order the visits to minimize the longest round trip from the start cell that checks every dead-end room. | Hard9 | Dynamic programmingShortest path+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Revenge of Minimum Cost FlowSend f units of freight from city s to city t through directed carrier edges with two-piece linear costs and report the cheapest total. | Hard9 | GraphShortest path+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Hashigo SamaCount black-white colorings of joined ladders where each monochrome block has size at most k, modulo 1,000,000,007. | Hard9 | Dynamic programmingGraph | No attempts yet | 8s | 256 MB | Judgeable |
| Overwriting GameYou repeat random prefix-rectangle repaints until the board matches the target, and report the expected total of painted cells as a reduced fraction. | Hard9 | ProbabilityMatrix+1 | No attempts yet | 8s | 512 MB | Judgeable |
| Slave to Achievements 2Repeatedly craft as many N-scrap daggers as possible and reclaim 0 to K scraps per dagger, then find the distribution of the final leftover under N scraps. | Hard9 | ProbabilityDynamic programming+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Believer in I 2Over every ordering of A push, B add, and C multiply cards on an infinite stack of I, report the total of each of the top K stack values modulo 1,000,000,007. | Hard9 | CombinatoricsDynamic programming+2 | No attempts yet | 3s | 256 MB | Judgeable |
| Followers of I 3Sum, over every distinct order of the I, plus, and times cards run on an infinite I stack, the top K stack values modulo 1000000007. | Hard9 | Dynamic programmingCombinatorics+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Same Suffix ArrayCount the strings that differ from the given length N string in exactly one position and keep the same suffix array. | Hard9 | StringString matching+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Meeting in the Sierpinski LabyrinthTourists stand on cells of a grid that are free exactly when row and column share no binary 1 bit, and must meet in one cell with minimum total steps. | Hard9 | TreeDivide and conquer+1 | No attempts yet | 3s | 512 MB | Judgeable |
| Tile CuttingFor each query range, find the area with the largest count of inscribed parallelogram cuts and report that count, breaking ties by the smaller area. | Hard9 | Number theoryMath+1 | No attempts yet | 15s | 256 MB | Judgeable |
| Art GalleryFind the vertex sequence of the shortest interior path between two given vertices of a polygon lit from edge v0-v1. | Hard9 | GeometryShortest path | No attempts yet | 1s | 256 MB | Judgeable |
| Dictionary SurveyFind how many leading pages of the integers from A to B in lexicographic order pin down both A and B. | Hard9 | TrieMath+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Bulb PuzzleYou rotate every elbow and straight wire so all wires form one path that joins the two bulbs, and print the smallest such layout. | Hard9 | GraphBacktracking+1 | No attempts yet | 1s | 256 MB | Judgeable |
| PhibonacciGiven n and k, decide whether (P_n)^k equals A φ^k + B for integers A and B and print them modulo 1,000,000,007, or -1. | Hard9 | Number theoryMath | No attempts yet | 1s | 256 MB | Judgeable |
| Random signalsCompute the expected plane integral of the strongest covering signal when each of up to 20 stations draws an independent uniform power that activates its disks. | Hard9 | GeometryProbability+1 | No attempts yet | 12s | 256 MB | Judgeable |
| Sorting under interferenceFind the fewest rounds of one swap per round that sort a permutation despite known interfering swaps, with the smallest move list on ties. | Hard9 | MathGreedy | No attempts yet | 1s | 512 MB | Judgeable |
| Calvinball Championship, Again 2Split n players into the fewest teams so no pair who dislike each other shares a team. | Hard9 | GraphBacktracking+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Card Rarity EncodingGiven N draws over four rarities with known probabilities, find the smallest possible expected length of a prefix-free binary code for the N-draw sequences. | Hard9 | GreedyHeap+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Development of Small Flying RobotsEach robot moves sideways for 1 energy and rises through a hole for 100, and all must meet on one hole-free cell of the top floor for the least total energy. | Hard9 | Shortest pathGraph+1 | No attempts yet | 1s | 256 MB | Judgeable |
| FroggerFind the fewest frogs to place left of the y-axis so peg jumps can bring one frog to (X, 0), or print frogger when it is impossible. | Hard9 | MathBFS+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Join My TeamPair N participants by ranked preference lists into the lexicographically smallest stable pairing with no blocking pair, or report NO SOLUTION. | Hard9 | GraphGame theory | No attempts yet | 1s | 256 MB | Judgeable |
| Hogwarts staircasesFind the shortest sequence of red and green button presses that turns the current staircase layout into the desired one, breaking ties by lexicographic order. | Hard9 | BFSShortest path+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Canyon MappingCover a simple polygon with k equal axis-aligned squares and print the smallest side length that covers it, rounded to two decimals. | Hard9 | GeometryBinary search+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Nim with a Robot RefereeDecide each bag's winning first takes in a Nim variant where piles with forbidden divisor patterns vanish before every turn. | Hard9 | Game theoryNumber theory | No attempts yet | 2s | 512 MB | Judgeable |
| Counting Distinct Suffix ArraysCount how many distinct suffix arrays length-N strings with at most M distinct letters produce, modulo 1e9+7. | Hard9 | CombinatoricsString+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Quaternary ComputerGiven N base-4 variables, M add and xor commands, and one forbidden start value per variable, print each output total over all inputs modulo 4. | Hard9 | Bit manipulationMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Balancing LineFind the shortest closed curve avoiding square lamp footprints that encloses a nonempty lamp group holding half the total energy. | Hard9 | GeometryBrute force+1 | No attempts yet | 10s | 256 MB | Judgeable |
| KernelDecide whether a rectilinear polygon contains a beacon point that attracts every other point under greedy distance-decreasing motion. | Hard9 | Geometry | No attempts yet | 1s | 256 MB | Judgeable |
| Tree Edit DistanceCompute the minimum leaf insertions, leaf deletions, and relabels that turn one ordered labeled tree into another. | Hard9 | Dynamic programmingTree | No attempts yet | 2s | 256 MB | Judgeable |
| Radio WatchtowersKeep K of N towers on a line and raise their radio powers so each pair of kept towers can talk, minimizing raise cost minus sale income. | Hard9 | GreedySorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Highways and CountiesFind the smallest road length limit so cities joined by shorter roads form a group whose populations hold a subset summing to a multiple of K. | Hard9 | Minimum spanning treeDynamic programming+2 | No attempts yet | 2s | 64 MB | Judgeable |
| Dungeon CreationCount the spanning trees of the obstacle-free grid graph for each test case, modulo 1,000,000,007. | Hard9 | Dynamic programmingGraph+1 | No attempts yet | 3s | 512 MB | Judgeable |
| CasinoWith m dollars, a goal of n dollars and win chance p percent per play, pick each stake to maximize the chance of reaching the goal. | Hard9 | ProbabilityDynamic programming+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Runner and SniperYou give your start position and the gun's start angle and turn rate, then compute the fastest run speed at which the rotating gun still catches you. | Hard9 | Game theoryGeometry+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Wall Making GameTwo players alternately pick an empty cell and turn its row and column lines into walls until blocked, and the player unable to move loses. | Hard9 | Game theoryDivide and conquer+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Cactus edge moveCount the pairs of deleting one edge and inserting a different edge that keep the given graph a cactus. | Hard9 | GraphCombinatorics | No attempts yet | 1s | 256 MB | Judgeable |
| Rotating Cutter BitsThe program counts interior lattice points of a polygonal workpiece that survive one full rotation against a second rotating polygonal cutter. | Hard9 | GeometrySimulation+1 | No attempts yet | 3s | 256 MB | Judgeable |
| FactoriesEach query gives two factory sets on a weighted tree and asks for the minimum distance between any factory in one set and any in the other. | Hard9 | Divide and conquerTree+1 | No attempts yet | 6s | 512 MB | Judgeable |
| Magical SubarraysEach query asks for the longest subarray inside [L,R] with every element between its first and last values. | Hard9 | Divide and conquerSegment tree+1 | No attempts yet | 4s | 128 MB | Judgeable |
| Lights Out in the BarnStarting at an unknown vertex of a rectilinear barn, walk the walls to identify the position and reach the exit with the smallest worst-case extra distance. | Hard9 | Dynamic programmingGame theory+1 | No attempts yet | 2s | 512 MB | Judgeable |
| CircusFind the smallest starting hold depth on a temporary rope at D that reaches distance M by hopping between ropes within swing range. | Hard9 | Shortest pathSegment tree+1 | No attempts yet | 2s | 512 MB | Judgeable |
| GaussStarting from A, pay divisor-based costs to shrink the number or stay on lucky numbers, and find the cheapest exact-move cost to end at B. | Hard9 | Dynamic programmingShortest path+2 | No attempts yet | 2s | 256 MB | Judgeable |
| WillowTwo players choose starting cities on a tree with coins and alternately collect cities, each road usable once, and Hanaa maximizes the final score difference. | Hard9 | Game theoryTree+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Twirling Towards Freedom (Large)Each minute you stay put or rotate 90 degrees clockwise around a star, and must report the largest squared distance from the origin reachable in M minutes. | Hard9 | GeometryNumber theory+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Lost Password (Large)Given string S and integer k, compute the length of the shortest string containing every l33tspeak variant of each substring of S with length 1 to k. | Hard9 | GraphShortest path+1 | No attempts yet | 100s | 512 MB | Judgeable |
| Children Wearing Hats (Large)Given B black and W white hats for k children, count color sequences where the i-th child from the back first deduces their hat color, modulo 32749. | Hard9 | Dynamic programmingGame theory+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Ace in the HoleGiven Ben's examination order, restore the lexicographically greatest deck with no decreasing triple that makes his optimal search follow it. | Hard9 | Game theoryGreedy+2 | No attempts yet | 60s | 512 MB | Judgeable |
| Expensive Dinner (Large)Friends 1 to N arrive in any order and raise the shared bill to multiples of their numbers, and you report the gap between the most and fewest waiter calls. | Hard9 | Number theoryMath | No attempts yet | 5s | 512 MB | Judgeable |
| SheepwalkingTwo sheepdogs block two neighboring cells each turn to steer a randomly moving sheep home and minimize its expected number of moves there. | Hard9 | ProbabilityGame theory+1 | No attempts yet | 20s | 1024 MB | Judgeable |
| Ninjutsu (Large)Pick a starting rope length so the counterclockwise swing catches as many targets as possible before settling into orbit. | Hard9 | GeometryDynamic programming+1 | No attempts yet | 60s | 512 MB | Judgeable |
| Paths of Yin and Yang (Small)Count the black-and-white colorings of an N by M grid in which each color class forms a single path with two ends. | Hard9 | CombinatoricsBacktracking+1 | No attempts yet | 30s | 512 MB | Judgeable |
| The Paths of Yin Yang (Large)Count the black-and-white colorings of an N by M grid in which each color forms one edge-adjacent path. | Hard9 | CombinatoricsGraph | No attempts yet | 120s | 512 MB | Judgeable |
| Watering Plants (Large)Given non-overlapping plant disks, find the smallest radius R so that two disks of radius R together cover every plant disk completely. | Hard9 | GeometryBinary search+2 | No attempts yet | 60s | 512 MB | Judgeable |
| King GameOn a small board with burned squares, two players alternately move a king to an unvisited neighboring square; report who wins under optimal play. | Hard9 | Game theoryGraph+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Coloring Practice (Large)Count colorings of a regular n-gon up to rotation, reflection, and arbitrary permutation of the k colors, modulo 1e9+7. | Hard9 | CombinatoricsMath+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Clock BreakingGiven several consecutive LCD clock displays, find segments that are always burnt out, burnt in, working, or unknown across all consistent start times and fault assignments. | Hard9 | ImplementationBrute force+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Polygonal PuzzleGiven two simple polygons, translate and rotate them without reflection so their interiors stay disjoint and their shared boundary is as long as possible; print that maximum length. | Hard9 | GeometryBrute force+2 | No attempts yet | 20s | 512 MB | Judgeable |
| Road TimesGiven a unique shortest route for each ordered city pair, recorded delivery times constrain 30 to 60 km/h road speeds; for each query find the minimum and maximum travel time consistent with all records. | Hard9 | Shortest pathMath+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Spin DoctorGiven n points (a_i, b_i) labeled 1 or 0, choose a direction (S, T); with ties broken adversarially, minimize the span covering all label-1 points. | Hard9 | GeometrySorting+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Connect HighwaysGiven two planar connected networks, find the Red-Blue junction pair allowed to be joined by a segment, following a fixed angular tie-breaking rule. | Hard9 | GeometrySorting+2 | No attempts yet | 0.4s | 32 MB | Judgeable |
| Covering postersFor each new axis-aligned rectangle, compute the total area of the given union of rectangles that it covers. | Hard9 | Segment treePrefix sum+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| Half-plane land grab 2Maintain a dynamic set of lines under insertions and deletions and answer maximum-at-x queries online. | Hard9 | Dynamic programmingDivide and conquer+2 | No attempts yet | 4s | 512 MB | Judgeable |
| Archaeological ResearchGiven the surviving shuffled entries of a table of next occurrences for an unknown alphabet size, recover the lexicographically smallest original sequence or report that none exists. | Hard9 | GreedyGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Counting StringsCount strings over the lowercase alphabet whose length lies between L*K and L*K+N and in which at most K non-overlapping copies of a given pattern S can be found. | Hard9 | Dynamic programmingString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Number of walksGiven a directed graph as an adjacency matrix, find the smallest K such that the number of walks of length L grows as O(L^K), or -1 if none exists. | Hard9 | GraphDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| DinnerGiven ages, decide whether all people can be split into round tables of size at least 3 so that every pair of adjacent ages sums to a prime. | Hard9 | GraphMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Clique on a LineGiven n points on a line with weights, two points are adjacent when their weights sum to at most their distance; find the largest clique. | Hard9 | Dynamic programmingSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| New TrackConstruct a fixed alternating axis-parallel polyline through a formula that encodes exactly k crossings, using a zigzag permutation of y coordinates to place them. | Hard9 | ImplementationCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Growing a Binary TreeFor each tree, pick a root and count the fewest vertices to add so that the result becomes a complete binary tree (every internal vertex has exactly two children, all leaves equidistant from the root), minimizing that count and then the vertex index; output the count mod 1e9+7. | Hard9 | TreeDFS+2 | No attempts yet | 4s | 512 MB | Judgeable |
| Smallest Unpayable AmountFor each query interval, find the smallest positive amount that cannot be formed as a subset sum of the coins in that interval. | Hard9 | GreedySorting+2 | No attempts yet | 4s | 512 MB | Judgeable |
| YATPGiven a node-weighted, edge-weighted tree, for each node find the minimum of dist(u,v) + p_u*p_v over all v, and sum these minima over all nodes. | Hard9 | TreeDivide and conquer+2 | No attempts yet | 5s | 512 MB | Judgeable |