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 |
|---|---|---|---|---|---|---|
| WerewolfCount the role assignments with exactly W werewolves that satisfy all accusations and defenses, modulo 1000000007. | Medium7 | GraphDynamic programming+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Early Exam EvacuationEach of M writers seated in an N-row auditorium exits front or back to minimize passing plus crowding cost. | Medium7 | Dynamic programmingSorting+1 | No attempts yet | 2s | 256 MB | Judgeable |
| HotelsCount triplets of distinct towns in a tree whose three pairwise distances are all equal. | Medium7 | TreeDynamic programming+1 | No attempts yet | 3s | 256 MB | Judgeable |
| The Little BirdA bird jumps from tree 1 to tree n in flights of at most k and minimizes landings on trees at least as tall as the takeoff tree. | Medium7 | Dynamic programmingStack+1 | No attempts yet | 2s | 256 MB | Judgeable |
| PackingBuy the fewest backpacks from the shop so all items fit without splitting items or exceeding capacities. | Medium7 | Dynamic programmingBit manipulation | No attempts yet | 1s | 256 MB | Judgeable |
| TeamsSplit the row into the most contiguous teams so each student's team size lies within their given range, and count those optimal splits. | Medium7 | Dynamic programmingSegment tree+1 | No attempts yet | 5s | 256 MB | Judgeable |
| PasswordCount length-N strings over the first K uppercase letters that avoid ABCBC and ABABC as substrings, modulo 1,000,000,009. | Medium7 | Dynamic programmingString matching | No attempts yet | 1s | 256 MB | Judgeable |
| Gold MinesPick an axis-aligned rectangle over weighted points to maximize the sum of enclosed weights. | Medium7 | Dynamic programmingPrefix sum+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Relay HorsesMove all petitions sitting on a ring of stations to the capital so the sum of horse days used and days each petition spends traveling is smallest. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 64 MB | Judgeable |
| Bridge RemovalStarting from any island, a crew that spends a bridge length to cross or remove it must delete every bridge of a tree in the shortest total time. | Medium7 | Dynamic programmingTree+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Mattress stain removalCover all stained cells on an m by n grid with the fewest 3 by 3 blocks placed inside the grid. | Medium7 | Dynamic programmingBit manipulation | No attempts yet | 3s | 256 MB | Judgeable |
| Switch ArrayFind the fewest restricted toggles that turn each given bit string into all zeros. | Medium7 | RecursionDynamic programming+1 | No attempts yet | 1s | 256 MB | Judgeable |
| The Club TripEach of n classmates rides only if one named classmate also rides; fill up to k bus seats with the largest group that respects every such condition. | Medium7 | GraphDynamic programming+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Road WorkSchedule cars from both ends through one shared lane to minimize how many drivers wait past their patience limit. | Medium7 | Dynamic programmingSimulation | No attempts yet | 1s | 512 MB | Judgeable |
| Bounty Hunter Jeong-eunA ship visits every planet sorted by x on an outward and a return monotone leg with minimum total Euclidean length. | Medium7 | Dynamic programmingGeometry | No attempts yet | 1s | 256 MB | Judgeable |
| Pontoon BridgeFind the smallest connected set of water squares that touches both banks of a river given as water intervals per row. | Medium7 | Shortest pathDynamic programming | No attempts yet | 1s | 256 MB | Judgeable |
| ShoppingA shopper starts at the entrance, visits each of N shops in a row under the given order constraints, and ends at the exit with the shortest total walk. | Medium7 | Dynamic programmingIntervals | No attempts yet | 1s | 256 MB | Judgeable |
| Circle of digitsSplit the circular digit string into K contiguous parts so the largest part value is as small as possible, and output that value. | Medium7 | Binary searchDynamic programming+1 | No attempts yet | 5s | 256 MB | Judgeable |
| Circle and MarbleEach move shifts one marble along an arrow to the next circle, and you decide if the first or second player wins under best play. | Medium7 | Game theoryTree+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Kebab HouseCount subsets of the work seconds with gaps of at least t+1 such that each kebab misses at most q_i minus x_i ingredients, modulo 1e9+7. | Medium7 | Dynamic programmingCombinatorics+1 | No attempts yet | 2s | 256 MB | Judgeable |
| A Cure for the Common CodeCompute the shortest encoded length of each lowercase string using count-plus-parentheses notation for repeats. | Medium7 | Dynamic programmingString | No attempts yet | 5s | 256 MB | Judgeable |
| Generalized Roman NumeralsGiven a string of Roman letters, list every distinct value it can take under all parenthesizations of the subtract-when-smaller rule. | Medium7 | Dynamic programmingIntervals+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Black and White StonesShagga reorders black and white stones so all black stones stand left of white ones with minimum cost, paying A per swap and A minus B for adjacent swaps. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Dividing the namesSplit 2N names into N streets and N avenues so the total length of shortest unique prefixes on all N by N crossing signs is minimal. | Medium7 | TrieDynamic programming | No attempts yet | 3s | 256 MB | Judgeable |
| Two YachtsPick priced time intervals so no day is covered more than twice and the total price is maximal. | Medium7 | Dynamic programmingIntervals+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Power TillerCount distinct positions reachable by steps of lengths 1, 2, 4 and so on moving only right or up inside an A by B rectangle. | Medium7 | Bit manipulationDynamic programming+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Can't stop playingStick each arriving power-of-two block to the left or right end, merge equal neighbours, and report if one block can remain with the smallest direction string. | Medium7 | Dynamic programmingBit manipulation+2 | No attempts yet | 10s | 256 MB | Judgeable |
| VocabularyCount ways to replace every question mark with a lowercase letter so the three words are distinct and in lexicographic order. | Medium7 | Dynamic programmingString+1 | No attempts yet | 5s | 256 MB | Judgeable |
| Alien InvadersDestroy each alien within its time window using bombs, where a bomb of power R kills all aliens present within distance R at cost R, for minimum total fuel. | Medium7 | Dynamic programmingDivide and conquer+2 | No attempts yet | 3s | 256 MB | Judgeable |
| Why-Salesman TourDecide whether a metric graph with up to 14 vertices has a Hamiltonian cycle of total length exactly L. | Medium7 | Dynamic programmingBit manipulation+1 | No attempts yet | 9s | 256 MB | Judgeable |
| The Safe SecretFor each ring rotation, replace each ? with +, - or * and parenthesize to get the min and max values, then join their digits in order. | Medium7 | Dynamic programmingIntervals | No attempts yet | 1s | 256 MB | Judgeable |
| Table Tennis Team LineupReorder the queue with the fewest take-and-reinsert moves so each consecutive block of K holds the next K weakest players. | Medium7 | Dynamic programmingSorting+1 | No attempts yet | 1s | 64 MB | Judgeable |
| KnightsCount non-attacking knight placements on an M by N board with M up to 4 and N up to 1e9, modulo 1000000009. | Medium7 | Dynamic programmingMatrix+1 | No attempts yet | 60s | 256 MB | Judgeable |
| AntennasPlace carrier-specific or shared antennas on a line so each house interval meets a matching coverage interval at minimum cost. | Medium7 | Dynamic programmingSorting+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Apartment floor planCover an N by M floor with integer-sided rectangles that each touch the outer edge so the sum of squared area deviations from K is minimal. | Medium7 | Dynamic programmingDivide and conquer+1 | No attempts yet | 2s | 64 MB | Judgeable |
| LRFill each ? with an allowed character to form a valid L and R expression with the largest possible value, or report invalid. | Medium7 | Dynamic programmingString+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Snake GameGuide a snake that steps forward or climbs one row while reversing direction and eat every apple with the fewest button presses. | Medium7 | Dynamic programmingShortest path+1 | No attempts yet | 1s | 32 MB | Judgeable |
| FrisbeeChoose and order some of up to 20 cows so their total height reaches H while maximizing the worst remaining strength margin. | Medium7 | Dynamic programmingSorting | No attempts yet | 1s | 256 MB | Judgeable |
| Cow JogCows start in fixed order with fixed speeds, and you assign the fewest lanes so no two cows in one lane ever meet by time T. | Medium7 | Dynamic programmingBinary search+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Moovie MoovingChoose the fewest movies, each used at most once, whose showings chain together to cover every moment from time 0 to time L. | Medium7 | Dynamic programmingBit manipulation+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Grass CownoisseurStarting from field 1 and returning to it, visit the most distinct fields while traveling at most one directed path backwards. | Medium7 | GraphTopological sort+1 | No attempts yet | 1s | 256 MB | Judgeable |
| SIRO ChallengeJiro starts at station s, visits as many of up to 16 ramen stations as possible, and returns within time t, paying rail travel plus eating time. | Medium7 | Dynamic programmingShortest path+2 | No attempts yet | 8s | 512 MB | Judgeable |
| WTF TransformationChoose the ID array that maximizes the two-phase rotating sum and output that maximum with the lexicographically smallest optimal ID array. | Medium7 | Dynamic programmingPrefix sum+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Cutting the Cake 2JOI chooses the first slice of a round cake, then both sides take exposed ends in turn against an opponent who always takes the larger end. | Medium7 | Game theoryDynamic programming+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Slave to achievements 1Craft as many N-cost daggers as possible and reclaim 0-to-K chips per dagger until fewer than N remain then print each final remainder probability modulo 1e9+7. | Medium7 | Dynamic programmingProbability+2 | No attempts yet | 3s | 256 MB | Judgeable |
| Jan's coloring bookCount proper colorings of one of eight fixed maps using at most three of K colors with adjacent areas different. | Medium7 | GraphCombinatorics+1 | No attempts yet | 1s | 64 MB | Judgeable |
| Library shelf tidyingGiven current and target shelf layouts, find the minimum number of books to lift when sliding a book into an empty spot on the same shelf costs nothing. | Medium7 | Dynamic programmingBinary search | No attempts yet | 1s | 64 MB | Judgeable |
| Cow HopscotchCount paths from the top-left to the bottom-right cell moving down and right where consecutive cells hold different values. | Medium7 | Dynamic programmingPrefix sum | No attempts yet | 1s | 256 MB | Judgeable |
| Coin type identificationDetermine each coin fixed type from the pairwise weighing results, printing ? when it is not unique. | Medium7 | Union-findTopological sort+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Palindrome Path 3Count the paths from the top-left to the bottom-right corner moving only right or down whose letters form a palindrome, modulo 1000000007. | Medium7 | Dynamic programmingMatrix | No attempts yet | 1s | 256 MB | Judgeable |
| Trapped in the HaybalesMeasure the total length of starting positions between sorted bales from which repeated run-up breaks can reach neither the leftmost nor the rightmost bale. | Medium7 | Dynamic programmingSorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| BowlingCount the distinct bowling games whose frame symbols and running totals match the blurred notes. | Medium7 | Dynamic programmingSimulation | No attempts yet | 1s | 256 MB | Judgeable |
| Tug of WarDecide if 2n contestants, each with one left spot, one right spot, and a strength, split into two disjoint teams of n whose strength sums differ by at most k. | Medium7 | GraphDynamic programming | No attempts yet | 3s | 256 MB | Judgeable |
| CateringCover all n event locations with at most k routes starting from the depot so the total equipment moving cost is minimal. | Medium7 | GraphShortest path+1 | No attempts yet | 4s | 256 MB | Judgeable |
| Virtual Keyboard TypingFind the fewest arrow and select presses that type the given text on a sliding-cursor virtual keyboard, including the final Enter. | Medium7 | Dynamic programmingShortest path+1 | No attempts yet | 4s | 256 MB | Judgeable |
| 369 Game CountCount numbers from A to B that are multiples of 3 or contain the digit 3, 6, or 9, and output the count modulo 20150523. | Medium7 | Dynamic programmingString+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Cutting an L-shaped paperThe program cuts the given L-shaped sheet with guillotine cuts into integer-sided squares with the fewest pieces. | Medium7 | Dynamic programmingGeometry+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Queen BeeSimulate N days of growth on an M by M grid where each inner cell copies the largest daily growth among its left, upper-left, and upper neighbors. | Medium7 | Dynamic programmingPrefix sum | No attempts yet | 2s | 256 MB | Judgeable |
| MatChoose a set of top-anchored and bottom-anchored rectangles with disjoint interiors that maximizes total profit. | Medium7 | Dynamic programmingIntervals+1 | No attempts yet | 1s | 512 MB | Judgeable |
| A Journey to GreecePlan a round trip from Athens that visits every listed site within time G, using at most one fixed-time taxi jump. | Medium7 | Dynamic programmingShortest path+1 | No attempts yet | 2s | 1024 MB | Judgeable |
| SouvenirsBuy souvenirs from merchants in order with gold and silver coins and choose how to pay each price to maximize the number bought. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Block StackingCount distinct front-view colorings of supported stacks of width W and height at most H built from unlimited blocks of widths 1 to K, modulo 1e9+7. | Medium7 | Dynamic programmingCombinatorics+1 | No attempts yet | 1s | 32 MB | Judgeable |
| Covering the gridPlace corner-touching rectangles chaining from the top-left cell to the bottom-right cell to maximize the sum of covered cell values. | Medium7 | Dynamic programmingPrefix sum | No attempts yet | 1s | 256 MB | Judgeable |
| Gift BoxesStarting from sector 0 of a circular hall, a courier with capacity K must hand one gift to each of N teams and return, minimizing total walking time. | Medium7 | Dynamic programmingGreedy | No attempts yet | 3s | 512 MB | Judgeable |
| Cutting the Tofu BoardPair up adjacent cells of a graded N by N board to maximize the sum of pair prices, leaving cells unpaired when that pays more. | Medium7 | Dynamic programmingBit manipulation+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Tetris 2Count the ways to tile a 3 by N rectangle with the six tetrominoes except the straight piece, modulo 1,000,000. | Medium7 | Dynamic programmingMatrix | No attempts yet | 2s | 256 MB | Judgeable |
| Calvinball championshipGiven a valid team-number sequence, compute its 1-based lexicographic rank among all such records for n players, modulo 1000007. | Medium7 | CombinatoricsDynamic programming | No attempts yet | 1s | 64 MB | Judgeable |
| School CanteenCount length-n menus over k meals with no meal repeated l times in a row, modulo 4000000009. | Medium7 | Dynamic programmingMatrix+1 | No attempts yet | 5s | 256 MB | Judgeable |
| Calvinball team splitSplit up to 16 players into the fewest teams with no disliked pair sharing a team, breaking ties by the smallest assignment sequence. | Medium7 | GraphBacktracking+2 | No attempts yet | 1s | 256 MB | Judgeable |
| KimchiPick bury and take-out days at most D apart to maximize aging days times take-out temperature plus crock value while temperatures fall. | Medium7 | Dynamic programmingSliding window+1 | No attempts yet | 1s | 256 MB | Judgeable |
| 500-Yen SavingVisit shops in order, paying with held coins and bills, to collect the most 500-yen coins in change and spend the least for them. | Medium7 | Dynamic programmingSimulation+1 | No attempts yet | 8s | 256 MB | Judgeable |
| Cutting BrowniesGiven a B by D brownie sheet where Harry cuts depth and Vicky cuts breadth, decide if the named starting player has a forced win. | Medium7 | Game theoryDynamic programming+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Shortest Boolean ExpressionGiven a fully parenthesized boolean expression over x, y, and z with &, |, and !, print the length of the shortest equivalent expression, ignoring spaces. | Medium7 | Dynamic programmingBrute force+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Bicycle picture puzzleThe program reads W, H, and S and prints the probability that a random scramble needs fewer optimal swaps than S. | Medium7 | CombinatoricsProbability+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Ambulance AnticsPlan tours from the hospital that carry up to three patients each to bring every patient back in the least total driving time. | Medium7 | Dynamic programmingShortest path+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Counting Soundex StringsCount case-insensitive strings up to length L whose Soundex code equals the given code, modulo 1000000007. | Medium7 | Dynamic programmingString+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Sheep FrenzyMove across a grid with mountains to reach every sheep and spend one second eating each, using the fewest seconds, or report impossible. | Medium7 | Dynamic programmingBFS+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Longest Common PathTwo friends each walk a shortest route from school to their own home, and the goal is to maximize the shared consecutive stretch of both routes. | Medium7 | Shortest pathGraph+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Kings on a ChessboardCount the ways to place k non-attacking kings on an x by y board and print each answer modulo 1,000,000,007. | Medium7 | Dynamic programmingBit manipulation+1 | No attempts yet | 5s | 256 MB | Judgeable |
| String StretchingGiven a lowercase string up to length 200, find the shortest base string that builds it by repeated insertions anywhere, breaking ties alphabetically. | Medium7 | Dynamic programmingString+1 | No attempts yet | 1s | 256 MB | Judgeable |
| SongGiven a 26 by 26 pair score table, pick an L-note song starting from C that maximizes the sum of adjacent pair scores. | Medium7 | Dynamic programmingMatrix+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Design a TreeCount binary tree shapes with exactly N left edges and M right edges modulo 9999991 for up to 10000 queries. | Medium7 | CombinatoricsDynamic programming+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Hero PowerEarn charge during star phrases and spend it on activations that double note points without wiping future phrases to maximize the score. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Alicia's Afternoon AmbleVisit all points on a bitonic tour from the leftmost hotel to the rightmost parlour and back, minimizing total Euclidean length. | Medium7 | Dynamic programmingGeometry+1 | No attempts yet | 1s | 256 MB | Judgeable |
| String GameFor each game, decide if Alice wins when both players alternately delete the first or last letter until the string matches the target length. | Medium7 | Game theoryString matching+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Power EggsFind the fewest egg drops in the worst case that pin down the highest safe floor for N floors and K eggs, or report Impossible past 32. | Medium7 | Dynamic programmingCombinatorics+1 | No attempts yet | 1s | 256 MB | Judgeable |
| The Running GamePick disjoint segments of the given sequence so the sum of each segment weighted by its position inside the segment is as large as possible. | Medium7 | Dynamic programmingPrefix sum+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Optimal ability loadoutChoose a subset of abilities with given trigger chances and damage values to maximize the expected damage of one attack under a random trigger order. | Medium7 | Dynamic programmingProbability | No attempts yet | 1s | 512 MB | Judgeable |
| Choo ChooPassengers request trips between numbered cities with per-person fares, and the train picks whom to board within its capacity to maximize total fare revenue. | Medium7 | GraphShortest path+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Taxi sharingSplit up to 15 employees into taxis of four or fewer and order each drop-off route to minimize total distance fares plus boarding fees. | Medium7 | Dynamic programmingShortest path+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Word by mouthSimulate the recursive WBM(m) vote, where faulty friends always forward cat, and report each loyal friend's majority word. | Medium7 | SimulationDynamic programming+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Chess TournamentCount the equal two-team splits in which every pair across the teams played at least once, and print the lexicographically smallest team containing player 1. | Medium7 | GraphUnion-find+1 | No attempts yet | 3s | 256 MB | Judgeable |
| RiskCompute the attacker win probability in a Risk battle with D-sided dice where the defender picks one or two dice after seeing the attack roll. | Medium7 | Dynamic programmingProbability+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Journey to "The World's Start"Pick the cheapest travel card whose range lets you ride from stop 1 to stop n with transfer delays within t minutes. | Medium7 | Dynamic programmingBinary search+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Aqueduct ConstructionEach town must connect to a distinct spring through downhill hops of limited length so the combined aqueduct length is minimal. | Medium7 | Shortest pathGraph+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Coin ExchangeFind the fewest swaps along graph edges that place every black coin on a black vertex and every white coin on a white vertex. | Medium7 | Shortest pathGraph+1 | No attempts yet | 8s | 256 MB | Judgeable |
| Exposing corruptionBribe members to switch parties within a budget while keeping rivals in different parties, and report the largest achievable DSP and PPP sizes. | Medium7 | Dynamic programmingGraph+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Keep it energizedBuy energy packs at level shops so the stored energy covers each level cost in order for the least total cash. | Medium7 | Dynamic programmingSegment tree+2 | No attempts yet | 3s | 256 MB | Judgeable |
| CLARKSONSplit the lyrics into consecutive parts that each appear in the script and maximize the shortest part length. | Medium7 | String matchingBinary search+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Stepping Stones on Ingyeong LakeChoose stones from 1 to N with jumps of length at most K so the product of the chosen numbers has as few trailing zeros as possible. | Medium7 | Dynamic programmingGraph+1 | No attempts yet | 5s | 256 MB | Judgeable |