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,689 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| ResortFind the path from a start clearing to any base clearing that minimizes leftover card points, where track edges are free but lift edges cost points and require enough balance. | Hard8 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SkiersGiven a planar DAG whose edges leave clearings in west-to-east order, find the minimum number of downhill paths that cover every edge. | Hard8 | GraphDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Labyrinth of WellsGiven a colored DAG where each room has three outgoing wells, find the minimum number of rooms in a DAG producing the same color sequence for every path. | Hard8 | GraphDynamic programming+1 | No attempts yet | 3s | 128 MB | Judgeable |
| RocketsMatch the n red points to the n white points with non-crossing segments so the total Euclidean length is minimum, and report the matching. | Hard8 | Dynamic programmingDivide and conquer+2 | No attempts yet | 1s | 128 MB | Judgeable |
| PolygonGiven a convex polygon and its triangulation, find the maximum number of triangulation triangles a single elementary triangle can intersect. | Hard8 | GeometryDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Assembler CircuitsGiven a straight-line program of register assignments, find the fewest binary-operation gates needed to compute all final register values for every initial state. | Hard8 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Lightest LanguageGiven n, k, and letter weights, find the minimum total weight of a prefixless set of exactly n words over k letters. | Hard8 | TreeGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Step Traversing a TreeGiven a tree on n vertices, find the smallest c such that the vertices can be visited in some order where each consecutive pair is at distance at most c. | Hard8 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SchoolsAssign a distinct number 1..n to each school within its allowed interval, minimizing the total weighted movement cost. | Hard8 | GreedyDynamic programming+2 | No attempts yet | 3s | 128 MB | Judgeable |
| SubwayGiven a tree with n stations, choose l non-branching paths (routes) to cover as many distinct vertices as possible. | Hard8 | TreeDynamic programming+1 | No attempts yet | 3s | 128 MB | Judgeable |
| PloughingGiven an m by n grid of tile difficulties, repeatedly remove a full strip of width 1 from any edge as long as the strip sum is at most k, and minimize the number of strips that remove every tile. | Hard8 | Dynamic programmingTwo pointers+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Dancing in CirclesCount ways to split n labeled children into k unordered directed cycles of length at least l, modulo 2005. | Hard8 | CombinatoricsMath+2 | No attempts yet | 3s | 512 MB | Judgeable |
| CrystalsCount tuples a_i with 0 <= a_i <= m_i whose XOR is zero and whose sum is at least 1, with n <= 50 and bounds near 2^32. | Hard8 | Bit manipulationDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Tourist AttractionsFind the shortest route from site 1 to site n that visits sites 2 through k+1 in some order consistent with given precedence constraints. | Hard8 | Shortest pathDynamic programming+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Quaternary BalanceGiven n up to 1000 digits, count modulo 10^9 the distinct minimum-mass weighings of n grams with masses that are powers of four, placed on either pan or both. | Hard8 | Dynamic programmingMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Walk of Bytie-boyFor each consecutive pair of stops in a city of one-way lettered streets, find the shortest walk whose letter sequence is a palindrome, tie-broken by lexicographically smallest string. | Hard8 | BFSGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| WordsGiven indices k_i, decide whether the concatenation of the words h^{k_i}(0) appears as a substring of some h^m(0). | Hard8 | StringDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SheepCount triangulations of a convex n-gon by non-crossing diagonals such that no diagonal passes through a sheep's spot and every triangle holds an even number of spots, modulo m. | Hard8 | Dynamic programmingGeometry+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Monotonicity 2Find the longest subsequence of a given array whose adjacent-comparison pattern repeats the given cyclic scheme of <, >, = symbols. | Hard8 | Dynamic programmingSegment tree+1 | No attempts yet | 3s | 512 MB | Judgeable |
| Lightning ConductorFor each building i, find the smallest integer p such that h_i + p - sqrt(|i-j|) >= h_j for every building j. | Hard8 | Divide and conquerDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| PlotPartition a sequence of n points into at most m contiguous groups, replacing each group with one point, to minimize the maximum distance from any original point to its group's representative. | Hard8 | Binary searchDynamic programming+2 | No attempts yet | 30s | 128 MB | Judgeable |
| InspectionFor each root of a tree, find the minimum time for a tour that inspects every node and returns to the root each time, with no two consecutive trips using the same first edge. | Hard8 | TreeDFS+2 | No attempts yet | 5s | 128 MB | Judgeable |
| FestivalGiven exact +1 edges and <= edges between runners' integer times, find the maximum count of distinct times consistent with all constraints, or NIE if impossible. | Hard8 | GraphShortest path+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Fibonacci RepresentationFor each query k, find the fewest Fibonacci numbers whose signed sum (plus or minus, repeats allowed) equals k. | Hard8 | Dynamic programmingMath+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Triumphal ArchGiven a tree rooted at town 1, find the minimum number of crews so that each town gets its arch built before the king's first arrival, where the king's walk is unknown. | Hard8 | TreeGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Byteotian WarBoth players take turns discarding one of their top two cards and passing the other to the opponent; find the final score when both play optimally. | Hard8 | Dynamic programmingGame theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cheap AirlinesChoose at most k non-overlapping contiguous segments of the array to maximize the total sum of their elements. | Hard8 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Bark BeetlesTwo beetles alternate taking one end picket or both end pickets from a row; each maximizes its own total, so find both final totals. | Hard8 | Dynamic programmingGame theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Declining SequencesGiven a sequence and a fixed length p, count and return the lexicographically k-th decreasing index sequence for each query. | Hard8 | Dynamic programmingCombinatorics+1 | No attempts yet | 1s | 128 MB | Judgeable |
| VacationFind a permutation of n attractions minimizing the total capped positional distance to k given rankings (k at most 3). | Hard8 | Dynamic programmingSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| TelescopeChoose an order for the coins and insertion times so that the paid viewing windows cover as many meteor intervals as possible. | Hard8 | Dynamic programmingSorting+1 | No attempts yet | 5s | 128 MB | Judgeable |
| MushroomsA walker starts at glade 1, moves one glade every 15 minutes for t moves, picks all mushrooms on arrival, and each glade regrows 30 minutes later; maximize the total harvest. | Hard8 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TermitesTwo termites alternately eat planks adjacent to already-eaten ones, each maximizing her total; report the wood each ends up with under optimal play. | Hard8 | GreedyGame theory+2 | No attempts yet | 2s | 512 MB | Judgeable |
| The Way to BytemountainFind a walk from crossing 1 to crossing n that deviates from the signpost arrows at most k times and maximizes total trail beauty. | Hard8 | GraphDynamic programming+2 | No attempts yet | 1s | 32 MB | Judgeable |
| CardsCount binary strings with r reds and b blacks where the first card is black or some black run is preceded by a shorter-than-k-times red run, modulo a prime p. | Hard8 | Dynamic programmingCombinatorics+1 | No attempts yet | 2s | 512 MB | Judgeable |
| PermutationsCount completions of a partial permutation on 2n points that is an involution and encodes a correct bracket sequence. | Hard8 | CombinatoricsDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Paper ClipsFind the minimum number of 180-degree turns needed to separate a chain of clips joined in two possible ways, where clips sit in four orientations. | Hard8 | GreedyDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| CliquersCount assignments of grades from 1..m to all integer partitions of n, modulo 10^9-401. | Hard8 | CombinatoricsNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| JourneyCount length-d walks in a small (n<=20) graph that visit each of the first k<=7 cities at least once, modulo 1e9+9. | Hard8 | Dynamic programmingGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Return of the CliquersCount the number of grade assignments to all symmetric labeled cliquers on n vertices, raised to m modulo 10^9-401 with n and m up to 2*10^9. | Hard8 | CombinatoricsNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Enumeration of Road Network PlansCount the isomorphism classes of trees on n vertices whose diameter equals d, modulo a prime p. | Hard8 | CombinatoricsTree+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Conference - RectificationChoose a subset of whole reservations to keep so that total income from ticket sales minus room rent is maximized. | Hard8 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SubsetsCount k-element subsets of {1,...,n} in which no two chosen numbers differ by a factor of x, modulo m, with n up to 1e18. | Hard8 | Dynamic programmingCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Courier ServicesFind all Pareto-optimal (cost, time) pairs among routes from a class-C source to a class-C destination in a network with a special office-class structure and cycles. | Hard8 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Swift FawnWith energy starting at 1 and moves that double, halve, or negate the current level, find the fewest jumps to reach distance n and then stop. | Hard8 | Dynamic programmingMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Life of the PartyGiven a bipartite acquaintance graph, list every vertex whose removal strictly decreases the maximum matching. | Hard8 | GraphDynamic programming | No attempts yet | 1s | 128 MB | Judgeable |
| ChessboardCount permutations of 1..n whose i-th rook avoids row i and column i, modulo m. | Hard8 | CombinatoricsDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| ExcursionSplit a path of n weighted roads into contiguous segments of total length at most D, minimizing the sum of squared segment impression sums. | Hard8 | Dynamic programmingSliding window+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Express DeliveryGiven a depot and clients with distinct x and y coordinates, find the fewest monotone (shortest-path) routes from the depot that cover all clients. | Hard8 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| CiągBajtek needs the shortest string over the given alphabet that is not a subsequence of the word, and the lexicographically smallest among shortest such strings. | Hard8 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Binary Tree Lexicographic NumberGiven binary trees with ordered left and right children, find each tree's rank in height-first lexicographic order modulo 1000000000. | Hard8 | Dynamic programmingTree+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Three-Bit ComputersThe task is to decide whether a target string over a, b and c can be built from uninitialized cells with the two pair operations. | Hard8 | Dynamic programmingString | No attempts yet | 1s | 128 MB | Judgeable |
| SailboatFind a path from buoy 1 to buoy n in a DAG maximizing the sum of squared differences between consecutive edge weights. | Hard8 | Dynamic programmingGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Staircase Function ApproximationPartition the sequence f(0..n-1) into at most k contiguous groups, each approximated by a constant, minimizing the sum of |value - f(i)|^p over all i, and output the reduced fraction. | Hard8 | Dynamic programmingDivide and conquer+1 | No attempts yet | 1s | 128 MB | Judgeable |
| RacesGiven a tree and a set of allowed endpoints, find the maximum number of vertex-disjoint paths whose endpoints both lie in the allowed set. | Hard8 | TreeDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| DiversWith a shared torch and a graph of divers who refuse to pair up, find the minimum total time to ferry everyone out under the rock, or IMPOSSIBLE. | Hard8 | GraphDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| RitualCount the subsequences of a long digit string that form a palindrome divisible by 666, then report ((count - 1) mod 666) + 1. | Hard8 | Dynamic programmingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Fibonacci GameDetermine whether the first player wins a game that erases Fibonacci words only from the right end of a given a/b string. | Hard8 | String matchingDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| House of CardsMarcel removes at most k cards in whole leaning pairs, clearing cards above before the cards they rest on, to maximize the recovered sum. | Hard8 | Dynamic programmingTree | No attempts yet | 1s | 512 MB | Judgeable |
| StrikeChoose one train to hold for k minutes in a DAG rail network so the total delay passed on to all trains is largest. | Hard8 | Dynamic programmingTopological sort+1 | No attempts yet | 1s | 128 MB | Judgeable |
| TrainSum over all n! orders of the wagon strings the number of occurrences of their concatenation in t. | Hard8 | Dynamic programmingString matching+1 | No attempts yet | 1s | 128 MB | Judgeable |
| RobotWrite the shortest down-right program of at most k steps whose repetition exits the board without hitting an obstacle, ties broken lexicographically. | Hard8 | Dynamic programmingMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Maximum Mean CycleFind the directed cycle with the largest mean edge weight and print it as a reduced fraction. | Hard8 | GraphDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Heavy BlocksTopple n distinct-weight blocks with the fewest pushes when each push fells lighter neighbors in one direction until a heavier block or gap. | Hard8 | Dynamic programmingStack+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SlidesCount the non-empty slide subsets that keep slide-number order and rise in both rankings, modulo 1000000007. | Hard8 | Dynamic programmingDivide and conquer+1 | No attempts yet | 10s | 128 MB | Judgeable |
| The SafeCount the ordered sequences of exactly R dial turns that leave target k at the top, modulo 1000033. | Hard8 | MatrixDynamic programming+1 | No attempts yet | 4s | 128 MB | Judgeable |
| Ski RoutesCount closed tours that chain one or more uphill lifts and then ski down to the start through strictly lower adjacent cells. | Hard8 | Dynamic programmingGraph+1 | No attempts yet | 10s | 128 MB | Judgeable |
| Paweł i Gaweł 2Two players alternately remove stones from the leftmost or rightmost pile, and you decide who takes the last stone when both play their best. | Hard8 | Game theoryDynamic programming | No attempts yet | 1s | 128 MB | Judgeable |
| BricksCount prime multisets of N obtainable by splitting N in two and then splitting both sides the same number of times. | Hard8 | Dynamic programmingNumber theory+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Text AlgorithmsMove a pawn from the bottom-right to the top-left of a grid where left and up steps cost 1 and diagonal steps are free when row and column colors match. | Hard8 | Dynamic programmingString matching | No attempts yet | 1s | 128 MB | Judgeable |
| Hey, Better BettorGiven a refund rate on final losses and a win chance below half per dollar bet, compute the maximum expected profit over any stopping strategy. | Hard8 | ProbabilityDynamic programming+1 | No attempts yet | 4s | 128 MB | Judgeable |
| HarvardAssign each variable of a program with nested repeats to a memory bank within capacity to minimize access and select costs. | Hard8 | BacktrackingDynamic programming+1 | No attempts yet | 10s | 128 MB | Judgeable |
| Matryoshka DollsReassemble a row of dolls into complete 1 to m sets using adjacent merges while minimizing the number of doll openings. | Hard8 | Dynamic programmingIntervals | No attempts yet | 5s | 128 MB | Judgeable |
| Critical 3-PathFind three vertex-disjoint paths from each start to its target in a weighted DAG with maximum total weight. | Hard8 | Dynamic programmingGraph+1 | No attempts yet | 3s | 128 MB | Judgeable |
| InstallationsOrder jobs with given service times and deadlines to minimize the sum of the two largest lateness penalties. | Hard8 | Dynamic programmingSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| MetalCount how many simple monotone polygons use the given n points as vertices. | Hard8 | Dynamic programmingGeometry+1 | No attempts yet | 1s | 128 MB | Judgeable |
| RoommateTwo roommates follow fixed appliance orders with person-specific durations while sharing each appliance, and the task is to find the earliest time both finish. | Hard8 | Dynamic programmingShortest path | No attempts yet | 1s | 128 MB | Judgeable |
| A Lazy WorkerJobs have processing times with arrival times and deadlines, and the worker picks among available jobs without idling to minimize total executed work. | Hard8 | Dynamic programmingSorting | No attempts yet | 1s | 128 MB | Judgeable |
| StainsTaeyeon covers integer points off the x-axis with diamonds centered on the x-axis and minimizes the sum of their areas. | Hard8 | Dynamic programmingGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Triangle WarFrom a partially filled triangular grid of 10 dots and 18 lines, decide which player wins Triangle War under perfect play. | Hard8 | Game theoryBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Rotate and RewriteDecide whether two rotatable integer sequences can be reduced to a common sequence by substring rewrite rules and report the greatest such length. | Hard8 | Dynamic programmingString matching+1 | No attempts yet | 15s | 128 MB | Judgeable |
| Series-Parallel Parking LotPlace as many extra cars as possible on empty spaces of the encoded lot so every car still reaches the exit through empty spaces. | Hard8 | Dynamic programmingTree+1 | No attempts yet | 2s | 256 MB | Judgeable |
| ZZStarting from Fibonacci-like values a and b, repeat prefix sums c times and output the d-th value modulo 1000000009. | Hard8 | CombinatoricsNumber theory+1 | No attempts yet | 15s | 64 MB | Judgeable |
| Bribing the SyndicateChoose an adaptive bribery order within a fixed budget to maximize the chance of gaining at least c defectors. | Hard8 | Dynamic programmingProbability | No attempts yet | 5s | 128 MB | Judgeable |
| Correcting CuriosityGiven two strings, find the length of the shortest substitution command that rewrites the first into the second. | Hard8 | String matchingString+1 | No attempts yet | 2s | 256 MB | Judgeable |
| String PathCount the N by M letter grids where two given strings each appear on a down-right path from the top-left to the bottom-right corner. | Hard8 | Dynamic programmingCombinatorics | No attempts yet | 1s | 128 MB | Judgeable |
| Beautiful LandscapeMove blocks between neighboring stacks at unit cost so occupied positions sit at pairwise prime distances using the fewest moves. | Hard8 | Dynamic programmingPrefix sum+1 | No attempts yet | 20s | 128 MB | Judgeable |
| Electric Car RallyPlan driving and charging stops across time-dependent roads to reach the last station as early as possible. | Hard8 | Shortest pathGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Leave Your NameEnter the given uppercase name with the fewest presses of letter-change, cursor-move, and insert buttons. | Hard8 | Dynamic programmingBit manipulation+1 | No attempts yet | 12s | 128 MB | Judgeable |
| Crusher's CodeCompute the expected number of loop iterations for two randomized swap sorts on arrays of up to 8 values. | Hard8 | ProbabilityDynamic programming+1 | No attempts yet | 10s | 128 MB | Judgeable |
| DictionaryGiven up to 50 short words, find the fewest vertices of an edge-labeled tree whose downward paths contain every word. | Hard8 | TrieString matching+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Mixing ColoursThe player picks one colour per token and merges adjacent tokens under the rules to maximize the product of picked certainties, breaking ties in ASCII order. | Hard8 | Dynamic programmingProbability | No attempts yet | 5s | 128 MB | Judgeable |
| Moves on an Infinite Binary TreeStarting from the node reached by S, count the distinct nodes reachable by following any subsequence of T on an infinite binary tree. | Hard8 | Dynamic programmingTree+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Longest ChainFind the longest chain of triples with all three coordinates strictly increasing among up to 300,000 points per dataset. | Hard8 | Divide and conquerDynamic programming+2 | No attempts yet | 10s | 128 MB | Judgeable |
| Hidden TreeFind the longest subsequence that forms the leaves of a binary tree where each internal node has equal left and right sums. | Hard8 | Dynamic programmingTree+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Palindrome TripCompute the chance that a uniform random walk from s to t spells a palindrome, stopping early when t becomes unreachable. | Hard8 | ProbabilityGraph+2 | No attempts yet | 10s | 128 MB | Judgeable |
| Increasing Shortest PathFind the cheapest A to B path using at most C edges whose weights strictly increase. | Hard8 | Dynamic programmingShortest path+2 | No attempts yet | 15s | 256 MB | Judgeable |
| The CarpenterCut two non-overlapping diagonal triangles from an n by m black-and-white board and glue them into the largest square with alternating colors. | Hard8 | Dynamic programmingMatrix+1 | No attempts yet | 2s | 128 MB | Judgeable |
| PatienceGiven n, count the unfinished-suit layouts with fewer than n high cards out of place that reach the ordered row. | Hard8 | CombinatoricsDynamic programming+1 | No attempts yet | 2s | 512 MB | Judgeable |
| RNAReport the longest contiguous block shared by both RNA strings whose parenthesis marks balance. | Hard8 | Dynamic programmingString+1 | No attempts yet | 1s | 128 MB | Judgeable |