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,706 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| AntCount walks of exactly k edges from one cube vertex to another, never reusing the edge just used, modulo p. | Medium7 | MatrixDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Supernumbers in a PermutationGiven a permutation, find every value that appears in some longest increasing subsequence, and print them in increasing order. | Medium7 | Dynamic programmingBinary search+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Physical EducationJasio can skip up to k duels where he is the left student; find the leftmost final position he can reach. | Medium7 | ArrayDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Land SwindleFor each meadow square choose at most one rectangle ending there, maximize the total perimeter, where each rectangle must contain only meadow squares. | Medium7 | Dynamic programmingPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| TramsGiven a weighted tree, pair up the leaf nodes choosing disjoint simple paths to minimize or maximize the total length. | Medium7 | TreeDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Divisor GameFor each divisor d of N below N, players Bajtus and Bitus get scores a(d), b(d) when they write d; find the first player's advantage under optimal play when each boy starts. | Medium7 | Dynamic programmingGame theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| VacationChoose vacation days from a 3n-day forecast, taking at most k days in every window of n consecutive days, to maximize the total temperature. | Medium7 | Dynamic programmingSliding window+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TowerPartition the sequence of brick widths into consecutive blocks so that block sums do not increase from bottom to top, maximizing the number of blocks. | Medium7 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Two PostmenSplit the edges of a tree rooted at node 1 between two postmen starting at the root so the later finishing time is minimized. | Medium7 | TreeDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Amusement ParkCount how many distinct longest common subsequences two lists of up to 10000 numbers share, modulo 1000000007. | Medium7 | Dynamic programmingCombinatorics | No attempts yet | 1s | 128 MB | Judgeable |
| Returning BlocksCount the ways to fill empty cells of a 2-by-n board with distinct blocks so every row and column reads in increasing order. | Medium7 | Dynamic programmingCombinatorics | No attempts yet | 1s | 128 MB | Judgeable |
| Error CorrectionGiven letter-to-bits codebook and binary strings, decide if exactly one letter sequence encodes to within one bit flip. | Medium7 | Dynamic programmingString matching+1 | No attempts yet | 1s | 128 MB | Judgeable |
| AllianceGiven a bipartite graph, pick the smallest set of edges so that every vertex which has any edge has at least one chosen incident edge. | Medium7 | GraphGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Two-Colored Towers of HanoiThe task is to compute the minimum moves to gather odd disks on peg B and even disks on peg C under Hanoi rules. | Medium7 | Dynamic programmingRecursion+1 | No attempts yet | 1s | 128 MB | Judgeable |
| AptekaPay each swapped person by distance times their fee and reach the front with the smallest total cost. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 512 MB | Judgeable |
| OfficialsIn a rooted tree of officials, match each denouncer with a distinct descendant subordinate to maximize the number of executed officials. | Medium7 | GreedyTree+1 | No attempts yet | 1s | 512 MB | Judgeable |
| HalloweenGiven the sequence of required costumes, find the fewest put-ons when costumes stack and removals are free. | Medium7 | Dynamic programmingIntervals | No attempts yet | 1s | 128 MB | Judgeable |
| ABCFind the length of the longest nondecreasing common subsequence of two strings over a, b, and c. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Room NumbersCount the distinct numbers formed by flipping each 6 or 9 in n independently that are at most h, modulo 9999997. | Medium7 | Dynamic programmingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TagA pursuer at K always steps toward an evader at J on a tree while the evader moves or waits to maximize the capture time. | Medium7 | TreeGame theory+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Number of Obtainable AmountsCount the distinct totals formable from bounded banknotes where each denomination is a multiple of the previous one, modulo 1e9+7. | Medium7 | Dynamic programmingMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| HamsterSchedule food packages with spoil days, meal counts and qualities to maximize total meal quality over M days. | Medium7 | Dynamic programmingSorting | No attempts yet | 2s | 128 MB | Judgeable |
| Paper StripsCount the sets of dyadic pieces from repeated halving that exactly tile sectors a to b, modulo m. | Medium7 | Dynamic programmingDivide and conquer+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Magic RectangleCount the ways to fill a 3 by N grid with 1 to 3N so each row and column increases, matching the prefilled cells, modulo 1000007. | Medium7 | Dynamic programmingCombinatorics | No attempts yet | 2s | 128 MB | Judgeable |
| Banner RepairTransform one uppercase banner string into another with block insertions and deletions where each block of length S costs X plus S times Y. | Medium7 | Dynamic programmingString | No attempts yet | 10s | 128 MB | Judgeable |
| VisasChoose visa requests and give each a distinct day inside its window for the largest total payment. | Medium7 | Dynamic programmingSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| AcceleratorMatch every red point on a discrete circle to a distinct blue point so the sum of shorter-arc distances is as small as possible. | Medium7 | Dynamic programmingSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Slicing TreePlace the rotated rectangles under the slicing-tree constraints so the enclosing rectangle has minimum area. | Medium7 | Dynamic programmingTree | No attempts yet | 1s | 128 MB | Judgeable |
| Color LengthMerge two color strings while keeping each order so the sum of first-to-last spans of all colors is as small as possible. | Medium7 | Dynamic programming | No attempts yet | 10s | 128 MB | Judgeable |
| LaptopPlace each unit-time task inside its release time and deadline so idle gaps between tasks are as few as possible. | Medium7 | Dynamic programmingGreedy+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Pizza DeliveryChoose which houses on a road to visit and in what order so earnings minus delivery times give the largest total profit. | Medium7 | Dynamic programmingIntervals | No attempts yet | 1s | 128 MB | Judgeable |
| Popping GroupsDecide whether a string of a and b can be fully erased by repeatedly deleting maximal runs of at least two equal letters. | Medium7 | Dynamic programmingString+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Cellular NetworkYou sort n cells by their probabilities and split them into w ordered zones to minimize the expected number of paged cells. | Medium7 | Dynamic programmingSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SticksYou keep a connected set of sticks that meet only at endpoints without crossing to maximize total length. | Medium7 | Dynamic programmingGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ParentsPick from 1 to K nodes of a valued tree with no parent-child pair so the sum of picked values is as large as possible. | Medium7 | Dynamic programmingTree | No attempts yet | 5s | 128 MB | Judgeable |
| Nile River Dam ReleasesSchedule dam releases so every forecast window gets a release and cascades flow downstream, at the lowest total cost. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SightseeingCount the routes from city S to city F whose length equals the shortest distance or is exactly one unit longer. | Medium7 | Shortest pathGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Oh, Those Achin' FeetSplit each route's pedestrian load evenly across all shortest street paths and print every square's total load. | Medium7 | Shortest pathBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Bulletin boardsArrange ordered framed pictures into consecutive strips with shared frames and centering to fit the smallest area rectangle. | Medium7 | Dynamic programmingSimulation | No attempts yet | 1s | 128 MB | Judgeable |
| Young, Poor and BusyTwo travelers starting from Hakodate and Tokyo meet in one city for at least 30 minutes and both return home between 08:00 and 18:00 at the lowest total fare. | Medium7 | Shortest pathGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| NimDecide whether the moving-first team wins the team take-away game with per-player take limits where the last take loses. | Medium7 | Game theoryDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Lottery TicketsCount numbers from 0 to M-1 whose zero-padded decimal form matches Z in some length-r block at the same positions. | Medium7 | Dynamic programmingString matching | No attempts yet | 1s | 128 MB | Judgeable |
| The jury is outSelect k of up to 100 candidates with the closest prosecution and defence totals, breaking ties by larger combined score then smaller index list. | Medium7 | Dynamic programming | No attempts yet | 1s | 128 MB | Judgeable |
| Russian DollsArrange all dolls into nested chains where each doll fits only inside a strictly roomier one to minimize the total cost of leftover empty space. | Medium7 | Dynamic programmingSorting+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Let's go on an adventurePlan a route from the start to the destination within a fuel limit that collects the largest possible total of region values, counting each visited region once. | Medium7 | Dynamic programmingShortest path+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Dreaded Alternating GamePick the side, even or odd, that wins a token-moving game on a directed board when both players play perfectly. | Medium7 | Game theoryGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Chemicals MonitoringVictor admits the maximum-priority subset of streams that one shared output unit can report in stack order. | Medium7 | Dynamic programmingStack+2 | No attempts yet | 4s | 256 MB | Judgeable |
| Movie Theater SeatingDecide whether S solo guests and C couples fit into R rows of 8 seats with reserved seats while keeping neighbors and front seats empty. | Medium7 | Dynamic programmingBit manipulation+1 | No attempts yet | 2s | 64 MB | Judgeable |
| You Shall Not Pass!!Choose up to C coaching subtrees in a forest to maximize the number of teams covered by at least one chosen subtree. | Medium7 | Dynamic programmingTree | No attempts yet | 1s | 128 MB | Judgeable |
| CipherGiven total character volume, word count, and rank, reconstruct the I-th message in lexicographic order or report corruption. | Medium7 | Dynamic programmingCombinatorics+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Hurry PlotterMaximize the number of horizontal segments a sweeping plotter draws within a time limit, where drawn moves cost double and the final row skips the return trip. | Medium7 | Dynamic programmingSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| ACM CoalitionPick parties whose seats cover the shortage and grant one demand each so ACM's remaining board votes are maximal. | Medium7 | Dynamic programming | No attempts yet | 1s | 128 MB | Judgeable |
| Royal GemsFill each cell of an n by m board with one of four gems to maximize the ruby count while every ruby, emerald, and sapphire neighbors the required higher gems. | Medium7 | Dynamic programmingBacktracking+2 | No attempts yet | 1s | 128 MB | Judgeable |
| DiamondsArthas opens boxes outward from his starting keys to collect every diamond with the fewest openings. | Medium7 | Dynamic programmingIntervals+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Border ConflictChoose the shortest subsequence polyline through the given points so every original point lies within distance D of it. | Medium7 | Dynamic programmingGeometry+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Array GameThe player shifts all numbers left or right each turn to maximize the total signed value collected when numbers land on fixed plus and minus cells. | Medium7 | Dynamic programmingIntervals | No attempts yet | 1s | 128 MB | Judgeable |
| ACM RevengeCompute the number of deaths before the first hunter reaches a treasure room in a binary tree with traps and toggling exits. | Medium7 | TreeDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Jeju Island TourPick two vertex-disjoint directed paths in a DAG so the total number of vertices on both paths is as large as possible. | Medium7 | Dynamic programmingGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Flight Boarding OptimizationYou split the rows into k contiguous zones and order their boarding phases, keeping queue order inside each zone, to minimize total boarding difficulty. | Medium7 | Dynamic programmingIntervals+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Geometric PatternsFor each given n, print the numbers of spanning trees of the 2 by n rectangular grid and the 2 by n circular grid modulo 10007. | Medium7 | CombinatoricsDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SkyscrapersCount permutations of 1 to n whose visible building counts from the left and right equal the given values. | Medium7 | CombinatoricsDynamic programming | No attempts yet | 6s | 512 MB | Judgeable |
| Treasure ChestsOpen up to 12 treasure chests in the order that leaves the most keys, spending colored keys before wild ones to fill each lock. | Medium7 | Dynamic programmingBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Delta QuadrantStarting anywhere on a weighted tree, find the shortest closed tour that visits all but k planets and returns to the start. | Medium7 | Dynamic programmingTree | No attempts yet | 5s | 128 MB | Judgeable |
| Erasing GameCount the ordered sequences A whose entries can each be matched to a distinct entry of S that is at least as large. | Medium7 | CombinatoricsSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| NP-hardFind the shortest route that visits each of up to 1500 cities once when every city keeps all lower-numbered cities on one side of it. | Medium7 | Dynamic programmingIntervals | No attempts yet | 2s | 256 MB | Judgeable |
| Anagrams divisible by 11Count distinct digit permutations of N with no leading zero that are multiples of 11, modulo 1e9+7. | Medium7 | Dynamic programmingCombinatorics+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SubwayFind a subway route that uses the fewest line boardings and, among those, takes the most minutes. | Medium7 | Shortest pathGraph+2 | No attempts yet | 8s | 128 MB | Judgeable |
| Catch the BombGiven forbidden left and upper neighbor pairs over 26 letters, find the largest fillable square grid, capped at 20. | Medium7 | GraphTopological sort+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Lock PatternCount valid lock patterns on a 3 by 4 grid whose Manhattan segment lengths sum to L while avoiding the dots in S. | Medium7 | Dynamic programmingBit manipulation | No attempts yet | 5s | 128 MB | Judgeable |
| Math HomeworkCount N-digit strings, leading zeros allowed, whose divisibility by each of 1 to 6 matches a given pattern, modulo 1e9+7. | Medium7 | MatrixNumber theory+1 | No attempts yet | 1s | 128 MB | Judgeable |
| No ChangePay the ordered purchases with distinct coins, each covering one consecutive group within its value, to maximize unused value, or print -1. | Medium7 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Pogo-CowStarting from any target and hopping in one direction with non-decreasing jump lengths, collect the maximum total points from visited targets. | Medium7 | Dynamic programmingSorting | No attempts yet | 1s | 128 MB | Judgeable |
| Bonus CardsDmitry compares his chance of winning a seat when he enters with a double-slot card and with a single-slot card. | Medium7 | ProbabilityDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Factorials with an even number of trailing zeroesCount how many k from 0 to n have a factorial ending in an even number of zeros for each query. | Medium7 | Number theoryDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| BoxCount left-packed orderings of boxes with total width at most W so no unpacked box still fits the leftover space. | Medium7 | Dynamic programmingCombinatorics | No attempts yet | 5s | 128 MB | Judgeable |
| Distance Between Two IntegersSum the digitwise absolute differences over every ordered pair of integers from A to B, modulo 1,000,000,007. | Medium7 | Dynamic programmingCombinatorics+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Cup of CowardsChoose hits from five bounded characters to reach at least L damage at minimum cost, breaking ties by smaller damage. | Medium7 | Dynamic programmingSorting | No attempts yet | 3s | 128 MB | Judgeable |
| Super AntsAn ant on a grid cell collects its value and spawns clones along eight rays within the remaining time, and you compute the total score modulo 1e9+7. | Medium7 | Dynamic programmingPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Card TrickGiven the cards on the observed hopping path, compute the chance that a random start among positions 1 to 10 ends on the same final card. | Medium7 | Dynamic programmingProbability+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Young diagrams and Young tableauxCount the fillings of the given Young diagram with numbers 1 to N that rise weakly across rows and strictly down columns. | Medium7 | Dynamic programmingCombinatorics+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Infix to PrefixGiven a prefix expression with spaces and parentheses removed, compute the smallest and largest values over all valid parses. | Medium7 | Dynamic programmingIntervals+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Jingle BallsMove as few balls as possible so the two sides of every split differ by at most one ball, or report impossible. | Medium7 | Dynamic programmingTree | No attempts yet | 1s | 128 MB | Judgeable |
| The course Mirko winsFind the directed cycle where Mirko beats Slavko with the fewest roads, breaking ties by the largest time difference. | Medium7 | Shortest pathGraph+1 | No attempts yet | 3s | 128 MB | Judgeable |
| TraitorCover as many marked nodes of a forest as possible by assigning each a distinct neighboring watcher with no two marked nodes watching each other. | Medium7 | Dynamic programmingTree | No attempts yet | 1s | 128 MB | Judgeable |
| Speed CamerasPlace the most cameras on the intersections of a tree so no simple route passes more than k cameras. | Medium7 | GreedyTree+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Genetic engineeringDelete the fewest elements so the rest splits into blocks of k equal values, and print the lexicographically smallest among the longest such genomes. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Sum of all numbers made from even digitsAdd up every distinct number that can be formed from the available copies of digits 2, 4, 6 and 8, modulo 1,000,000,007. | Medium7 | Dynamic programmingCombinatorics+1 | No attempts yet | 1s | 128 MB | Judgeable |
| The Urge to MergeYou pick disjoint adjacent pairs in a 3 by n grid to maximize the sum of the products of paired values. | Medium7 | Dynamic programmingBit manipulation | No attempts yet | 5s | 128 MB | Judgeable |
| XenospeakGiven words per page and a page number, print the first and last words on that page over tilings of a, ab and bb ordered by length then alphabetically. | Medium7 | CombinatoricsDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Optimal MilkingEach day one machine value changes, then choose nonadjacent machines with maximum total output and add it to the overall sum. | Medium7 | Segment treeDynamic programming | No attempts yet | 1s | 128 MB | Judgeable |
| Ride the dominoes on a chessboardPlace exactly K non-overlapping dominoes on an N by 3 board of integers to maximize the sum of covered cells. | Medium7 | Dynamic programmingBit manipulation | No attempts yet | 3s | 128 MB | Judgeable |
| The Four Towers of HanoiMove all N disks to the last peg with four pegs in the fewest moves and print the count per test case. | Medium7 | Dynamic programmingMath | No attempts yet | 3s | 128 MB | Judgeable |
| Cow DecathlonAssign each cow to one event to maximize base scores plus prefix bonuses that cascade when thresholds are met. | Medium7 | Dynamic programmingBit manipulation | No attempts yet | 1s | 128 MB | Judgeable |
| Secret MessageCount the operation sequences that build the given string by repeatedly prepending or appending a proper prefix or suffix. | Medium7 | Dynamic programmingString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| BytecomputerRepeatedly add an entry to its right neighbor in a -1, 0, 1 sequence to make it non-decreasing with the fewest operations, or report BRAK if impossible. | Medium7 | Dynamic programmingArray | No attempts yet | 3s | 512 MB | Judgeable |
| LaserChoose up to K rays from the origin to hit the most first-quadrant segments, with no segment hit by two rays. | Medium7 | Dynamic programmingGeometry+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Code BreakingCount digit assignments to a rooted tree that place at least one of M forbidden 5-digit strings on its specified upward path, modulo 1234567. | Medium7 | Dynamic programmingTree+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Xiao Long BaoChoose the order to eat N dumplings in a row to maximize total flavor, with each eaten dumpling adding its bonus to uneaten dumplings within its reach. | Medium7 | Dynamic programmingIntervals | No attempts yet | 1s | 128 MB | Judgeable |
| SkiingStarting at (0,0) with fixed downhill speed and bounded lateral acceleration, choose the longest reachable target sequence with smallest indices on ties. | Medium7 | Dynamic programmingMath+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Split the sequenceSplit the sequence into k+1 contiguous parts so the total product score from the cuts is maximal, and print the score with one optimal cut list. | Medium7 | Dynamic programmingDivide and conquer+2 | No attempts yet | 2s | 128 MB | Judgeable |