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,704 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Placing TilesGiven a grid with blocked cells, cover every empty cell with 1 x k horizontal or vertical tiles (k is any positive integer, chosen per tile) and minimize the number of tiles. | Medium7 | BacktrackingDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Tofu Seller Jang Hongjun 3Given an N by M grid of letter grades, pick disjoint horizontal or vertical dominoes to maximize the sum of pairwise prices from the price table. | Medium7 | Dynamic programmingBit manipulation+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Junoh Is a Grump!!Count how many distinct strings can be made from a given name by shifting distinct positions total s, each shift 1 to 25. | Medium7 | CombinatoricsDynamic programming+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Longest Palindromic SubstringGiven a lowercase string of up to 100,000 characters, report the length of its longest palindromic substring. | Medium7 | StringString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Why Did the Cow Cross the Road 8Two rows each hold a permutation of N breeds; pair friendly pastures across the road without crossings to maximize the number of crosswalks. | Medium7 | Dynamic programmingIntervals+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Card CollectingCompute the minimum expected time to collect all n cards, choosing when to trade d cards for a chosen card or play for a random pack. | Medium7 | Dynamic programmingProbability+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Counting Palindromes (Small)Count how many subsequences of a string of length up to 30 are palindromes, treating subsequences that use different positions as distinct. | Medium7 | Dynamic programmingString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Heaps from TreesGiven a rooted tree with a value at each node, find the largest subset in which every ancestor-descendant pair has the ancestor's value strictly larger. | Medium7 | TreeDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Counting Palindromic Subsequences (Large)Count subsequences of a string (positions distinguish repeats) that read as palindromes, modulo 10007. | Medium7 | Dynamic programmingString | No attempts yet | 2s | 512 MB | Judgeable |
| Subin and the Melting CandyStarting at the origin and moving only right or up, visit baskets over time to maximize total candies collected, where a basket's candies shrink by one per time unit. | Medium7 | Dynamic programmingSorting | No attempts yet | 1s | 64 MB | Judgeable |
| KUBC League (Large)Given a tournament graph on N players, find the lexicographically smallest longest path starting at player 1. | Medium7 | GraphGreedy+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Zero health with minimum manaEach use of a skill costs more than its previous use by K; find the minimum total mana to remove exactly M health. | Medium7 | Dynamic programmingMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Junoh is top talent!!In a weighted tree, find a simple path with the maximum number of nodes, then among those pick the one with the smallest total edge weight, and report that weight divided by T rounded up. | Medium7 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Rainfall StorageGiven N pillars, arrange them in any order and list every total rain volume obtainable, where volume sums the water trapped above each pillar. | Medium7 | Dynamic programmingSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Hiking GwanaksanOn a graph with distinct vertex heights, each hiker at a vertex must move along an edge to a strictly higher neighbor, repeating until stuck; for every start vertex find the longest such strictly increasing path length. | Medium7 | GraphDynamic programming+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Milk CityOn an N by N grid of milk shops, walk from the top-left to the bottom-right cell moving only right or down, buying packs along the way so the drink types cycle 0,1,2,0,..., and maximize the number of packs bought. | Medium7 | Dynamic programmingMatrix | No attempts yet | 1s | 256 MB | Judgeable |
| Delivering GoodsGiven a directed weighted graph and a set of client junctions, find the minimum number of trucks so each client is reached at its shortest-path time. | Medium7 | GraphShortest path+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Nice NumbersInsert digits 2, 4, or 8 anywhere into a given string so repeated right pushes collapse it to one entry, minimizing length. | Medium7 | GreedyDynamic programming+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Stack ConstructionFor each message, compute the minimum number of stack push, pop, and print operations needed to print it and leave the stack empty. | Medium7 | Dynamic programmingString+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Parenting PartneringSplit the 1440 minute day between two parents, respecting fixed busy blocks, so each gets exactly 720 minutes with fewest custody switches. | Medium7 | GreedyIntervals+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Parenting Partnering (Large)Split a daily circle into baby-care blocks for two parents, respecting fixed activity intervals, so each covers 720 minutes with the fewest exchanges. | Medium7 | GreedyDynamic programming+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Fresh Chocolate (Large)Order the groups to maximize how many receive only freshly opened packs, given leftovers must be consumed first and P is at most 4. | Medium7 | GreedyMath+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Mountain Tour (Small)Choose the order for a daily Euler tour of a 2-regular directed multigraph so the finish time, with waits, is minimized. | Medium7 | GraphDynamic programming+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Dice Straight (Large)Each die shows six distinct numbers; choose at most one number per die so the chosen values form a consecutive run, and maximize its length. | Medium7 | GraphDynamic programming+2 | No attempts yet | 30s | 512 MB | Judgeable |
| Good RectanglesPrecompute an answer table so each query asks how many all-zero subrectangles fit inside a given rectangle of an n by m binary grid. | Medium7 | Dynamic programmingPrefix sum+1 | No attempts yet | 4s | 256 MB | Judgeable |
| Coin tossingGiven head counts from tossing two coins whose head probabilities are independent uniform on [0,1], compute the probability that the first coin's probability is smaller. | Medium7 | ProbabilityMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Coprime triplesCount index triples i < j < k whose three values have gcd 1, with values up to 10^6 and n up to 10^5. | Medium7 | Number theoryCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Cooking CoursesChoose an academy for each of M courses in order, keeping each academy run between S and E long, avoiding one forbidden switch per academy, and paying a switch fee, to minimize total cost. | Medium7 | Dynamic programmingSliding window+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Moving 2Given an N by N grid of candy amounts, collect the most candy over K monotone paths from (1,1) to (N,N), counting each cell only once. | Medium7 | Dynamic programmingImplementation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Boolean Expression CompressorGiven a Boolean expression over four variables, find the length of the shortest equivalent expression using NOT, XOR, and AND. | Medium7 | Dynamic programmingBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Horror Film NightGiven the sets of days each of two people likes films on, find the longest subsequence with no two consecutive films disliked by the same person. | Medium7 | GreedyTwo pointers+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Intelligence InfectionFind the minimum number of spies to message so that every non-enemy spy receives the message and no enemy spy does, given a directed contact graph and a set of enemy spies. | Medium7 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Journal EditingGiven theorems that depend on other theorems and multiple possible proofs with costs, find the minimum total cost to prove Theorem 0. | Medium7 | Dynamic programmingGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Going DutchGiven each person's net balance from the receipts, find the minimum number of money transfers that settles everyone to zero. | Medium7 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Manhattan MorningsChoose a monotone shortest path from house to workplace on the Manhattan grid that passes through as many errand points as possible. | Medium7 | Dynamic programmingSorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Most Distinctive CharacterChoose a length-k bit string minimizing the maximum number of agreeing bits with any of n given strings, breaking ties lexicographically. | Medium7 | Bit manipulationDynamic programming+1 | No attempts yet | 4s | 512 MB | Judgeable |
| Flipping CoinsGiven N coins all tails and exactly K fair tosses chosen adaptively, find the maximum expected number of heads at the end. | Medium7 | ProbabilityDynamic programming+1 | No attempts yet | 4s | 512 MB | Judgeable |
| Knightsbridge RisesAssign cranes to buildings so each building's tower ends with lifting power at least its target, minimizing the output lexicographically. | Medium7 | GreedySorting+2 | No attempts yet | 4s | 512 MB | Judgeable |
| K-th DigitGiven X = A + sqrt(B) with |A - sqrt(B)| < 1, find the K-th least significant digit of floor(X^N) for N up to 1e9 and K up to 4. | Medium7 | MathNumber theory+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Buggy ICPCCount the strings W of the same length as T that produce T on a machine that reverses the line every time a vowel is typed. | Medium7 | CombinatoricsString+1 | No attempts yet | 1s | 1024 MB | Judgeable |
| Fundraising DinnerChoose a subset of people with beauty, fortune, and donation so that no two conflict, and the total donation is maximized. | Medium7 | Dynamic programmingSorting+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Gates of uncertaintyGiven a binary tree of two-input NAND gates where some gates may be stuck, count input assignments that make the faulty circuit differ from the fault-free one. | Medium7 | TreeDynamic programming+1 | No attempts yet | 1s | 1024 MB | Judgeable |
| Removal GameGiven a circle of numbers, remove them one by one paying the gcd of the two neighbors, and minimize the total cost. | Medium7 | Dynamic programmingNumber theory+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Is-A? Has-A? Who Knows-A?Given is-a and has-a facts between at most 500 classes, apply the four transitivity rules and answer whether each queried relation holds. | Medium7 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| HopscotchCount lattice paths from (0,0) to (N,N) where each hop increases x by at least X and y by at least Y, modulo 1e9+7. | Medium7 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Grid ColoringCount completions of an m by n red/blue grid where every blue cell forces the whole prefix rectangle from the top left corner to be blue. | Medium7 | Dynamic programmingCombinatorics+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Drone PackingChoose items to load onto two drones with separate weight capacities so total value is maximized, with no item split or shared. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Deathmatch ScoreboardGiven a partial n-player kill/death table sorted by score, count the completed tables that a finished deathmatch game could produce. | Medium7 | CombinatoricsBrute force+2 | No attempts yet | 10s | 512 MB | Judgeable |
| Round the world ticketCount distinct city sequences, starting and ending at ZAG, that can be flown using a subsequence of the ordered coupons, modulo 1e9+7. | Medium7 | Dynamic programmingHash map+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Robot RaceFor each of up to a million queries on an n by m grid of obstacles, decide whether a monotone path moving only right or down connects the two given empty cells. | Medium7 | Dynamic programmingPrefix sum+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| Single EliminationGiven the fixed win/loss outcome for every pair among 16 players, decide which players can be made champion by choosing all four rounds of pairings. | Medium7 | BacktrackingDivide and conquer+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Friend Palindrome 2Given friends split by parity into girls and boys and a friendship graph, choose the largest group that can be arranged so every non-middle person pairs with an opposite-sex friend. | Medium7 | GraphDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| InitialsEach student's directory starts as last-initial plus first-initial; append letters from the full names so names strictly increase in class order, minimizing total letters added. | Medium7 | Dynamic programmingString+2 | No attempts yet | 3s | 512 MB | Judgeable |
| ArtistChoose exactly K blocks from N to minimize (sum of chosen widths) times (sum of chosen heights), where each block keeps its orientation. | Medium7 | Dynamic programmingSorting+2 | No attempts yet | 1s | 512 MB | Judgeable |
| SanCount subsets of skyscrapers forming a non-decreasing-height left-to-right jump sequence whose gold sum reaches at least K. | Medium7 | Dynamic programmingCombinatorics+1 | No attempts yet | 1s | 64 MB | Judgeable |
| Black or WhiteGiven a start row s and target row t of B/W bricks, find the minimum number of strokes, each painting at most k consecutive bricks one color, to reach t. | Medium7 | Dynamic programmingGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Column AdditionGiven three n-digit strings, erase the fewest digit columns so the first number plus the second equals the third. | Medium7 | Dynamic programmingString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| HikingOn a bipartite graph of peaks and valleys, two players alternate choosing an unvisited neighbor and the player who cannot move loses; report the winner for every starting peak. | Medium7 | Game theoryGraph+2 | No attempts yet | 1s | 256 MB | Judgeable |
| BricksCount the distinct sets of occupied boxes reachable after M bricks fall, where a brick at an occupied position expands its run left or right. | Medium7 | Dynamic programmingIntervals | No attempts yet | 0.2s | 512 MB | Judgeable |
| Menu TourChoose a sequence of restaurants serving courses 1..C in order within budget B, minimizing total Manhattan travel distance; report -1 if impossible. | Medium7 | Dynamic programmingShortest path+2 | No attempts yet | 2s | 512 MB | Judgeable |
| MacaronsCount the ways to tile an N by M rectangle with 1x1 and 1x2 dominoes, with N at most 8 and M up to 10^18, modulo 10^9. | Medium7 | Dynamic programmingBit manipulation+2 | No attempts yet | 5s | 512 MB | Judgeable |
| IngredientsEach dish has a minimum cost and the prestige that goes with that cheapest way; pick a subset of dishes with total cost at most B maximizing prestige, then report the smallest cost achieving it. | Medium7 | Dynamic programmingGraph+2 | No attempts yet | 4s | 512 MB | Judgeable |
| Candy Wall BurglaryA bandit descends and reascends through shelves connected by sparse ladders, collecting jars at most once; find the maximum candy total. | Medium7 | Dynamic programmingGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Bumped!Given an undirected weighted road graph and up to 1000 directed free flights, find the cheapest s-to-t trip using at most one flight. | Medium7 | GraphShortest path+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Company PicnicIn a tree of employees with speeds, pair each node with at most one neighbor on the parent-child edge, maximizing team count then average team speed. | Medium7 | TreeDynamic programming+1 | No attempts yet | 2s | 512 MB | Judgeable |
| RhombinoesGiven live equilateral triangles on a W by H board, find the maximum number of non-overlapping rhombinoes, each covering two live triangles that share a side. | Medium7 | GraphDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Vera and LCSGiven string A and target K, find the smallest i where A's prefix of length i plus N-i copies of A's least frequent letter has LCS exactly K with A. | Medium7 | StringDynamic programming+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Vera and SortingCount permutations of size N for which a recursive quicksort-like routine performs exactly K comparison steps, modulo 1e9+7. | Medium7 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 256 MB | Judgeable |
| MizuyokanGiven a bar divided by N-1 score lines into segments of given lengths, cut along some lines so the longest and shortest resulting pieces differ as little as possible. | Medium7 | Dynamic programmingBinary search+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Minimum Edit 2Compute the minimum number of insertions, deletions, replacements, and adjacent swaps needed to turn string A into string B, with both strings up to length 1000. | Medium7 | Dynamic programmingString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| A fun gameTwo players alternately take one or two numbers from either end of a sequence; decide if the first player can force an even total. | Medium7 | Game theoryDynamic programming+1 | No attempts yet | 1s | 512 MB | Judgeable |
| MateFor each query, count subsequences of S of length D whose last two characters are the given pair XY, modulo 1e9+7. | Medium7 | CombinatoricsDynamic programming+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Rectangle CoverChoose axis-aligned rectangles centered at the origin whose union covers all N points, minimizing the total area. | Medium7 | Dynamic programmingSorting+1 | No attempts yet | 1s | 64 MB | Judgeable |
| Tap Titanz at Moloco (Hard)Given an n by n two-color board, one tap flips a whole connected same-color region; find the minimum taps to make the whole board one color. | Medium7 | GraphBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Separate StringCount the ways to split string t into a sequence of pieces, each of which is one of N given dictionary strings, modulo 1e9+7. | Medium7 | Dynamic programmingTrie+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Snake EscapingGiven a toxicity value for each of 2^L bitmasks, answer Q queries: each query fixes some bits and leaves others free, and asks the sum of values over all matching masks. | Medium7 | Bit manipulationPrefix sum+2 | No attempts yet | 2s | 64 MB | Judgeable |
| Filling a rectangle with blocksCount the ways to tile an N by M rectangle with rectangles of size k by N for any k, each rotatable, modulo 1999. | Medium7 | Dynamic programmingCombinatorics+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Blocks 3Count the tilings of an N by M rectangle using blocks of size k by N for any k, allowing 90-degree rotation, modulo 1999. | Medium7 | Dynamic programmingCombinatorics+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Signals 2Choose a subset of points with distinct x coordinates, sort them by x, and maximize the total Euclidean distance between consecutive chosen points. | Medium7 | Dynamic programmingGeometry+2 | No attempts yet | 1.5s | 256 MB | Judgeable |
| Pokemon HuntPokemon sit on houses along a line, each with a candy value and a deadline; starting at house K, maximize candy collected while walking one house per second. | Medium7 | Dynamic programmingIntervals | No attempts yet | 1s | 512 MB | Judgeable |
| Delivery GuyOn a tree of N restaurants with demand A_i, maximize total delivered peppers in M time units, where each visit costs 1 to deliver and each edge costs 1 to traverse. | Medium7 | TreeDynamic programming+2 | No attempts yet | 2s | 64 MB | Judgeable |
| English RestaurantGiven n tables and random hourly group sizes from 1 to g, find the expected number of seated people after t hours, where each group takes the smallest table that fits. | Medium7 | Dynamic programmingProbability+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Installing AppsChoose a largest subset of apps installable within c free space and order them so each install fits, preferring the lexicographically smallest index set. | Medium7 | Dynamic programmingGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Knockout TournamentArrange the starting line-up of a knockout tournament so that Dale's probability of winning, given pairwise win odds a/(a+b), is maximized. | Medium7 | Dynamic programmingProbability+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Paul the barista picks coffee beansPick the longest subsequence of the given row so that consecutive picked values are congruent mod k or differ by at most d in absolute value. | Medium7 | Dynamic programmingSegment tree+2 | No attempts yet | 1.5s | 64 MB | Judgeable |
| Heaven's Kitchen 2Given an array of integers, choose two non-overlapping nonempty contiguous subarrays and maximize the product of their sums. | Medium7 | ArrayDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Yonsei Water ParkGiven N stones in a line with values K_i, pick a starting stone and a sequence of distinct stones where each jump moves at most D positions, maximizing the sum of visited values. | Medium7 | Dynamic programmingSegment tree+1 | No attempts yet | 1s | 128 MB | Judgeable |
| TrianglesCount all triangles formed by drawn horizontal and diagonal edges in an ASCII picture of a triangular grid up to 3000 by 6000 vertices. | Medium7 | GeometryBrute force+1 | No attempts yet | 6s | 1024 MB | Judgeable |
| Block GameRemove every block so the heights leave in non-decreasing order, minimizing moves of a machine that walks left and right along the shrinking row. | Medium7 | Dynamic programmingGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Regular checkupIn a graph split by a river with B bridges, answer Q queries for the shortest travel time from a given house to a given hospital, or -1 if unreachable. | Medium7 | GraphShortest path+2 | No attempts yet | 1.5s | 256 MB | Judgeable |
| Arrays and gcdCount arrays arr with elements in [1, num] whose running gcd array equals the given array C, modulo 1e9+7. | Medium7 | Number theoryDynamic programming+2 | No attempts yet | 0.5s | 128 MB | Judgeable |
| The Return of the TteokfireCount sequences of M daily bowl counts summing to N, where the first M-1 counts are positive and the M-th is zero. | Medium7 | CombinatoricsMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Snow BootsFind the minimum number of boot pairs Farmer John must discard, given a stack-ordered backpack and snow-depth and step-size limits, to walk from tile 1 to tile N. | Medium7 | Dynamic programmingArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| GiftCount sequences of length N that split into blocks where each block is 0,1,...,L-1 with L at most K, modulo 1e9+7. | Medium7 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Cheap DeliveriesGiven a weighted undirected graph and k up to 18 delivery pairs, find the order of deliveries that minimizes total travel distance, or report -1 if some delivery is unreachable. | Medium7 | GraphShortest path+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Apples and BananasDecide the winner of an alternating game where each move removes one apple, one banana, three apples and one banana, or one apple and three bananas from piles of a apples and b bananas. | Medium7 | Game theoryDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Line of BenthamReplace some people in a line with agents so the total happiness, where each person sums likes over the three ahead, is maximized. | Medium7 | Dynamic programmingGreedy | No attempts yet | 1s | 256 MB | Judgeable |
| File RecoveryDelete elements from a sequence so the remainder parses as length-prefixed blocks that end exactly at the last position, minimizing the largest likelihood among deleted elements. | Medium7 | Dynamic programmingBinary search+2 | No attempts yet | 2s | 512 MB | Judgeable |
| CoinsMaintain the probability that the number of heads among N coins is odd, under M point updates to individual coin probabilities, and report which outcome is more likely after each update. | Medium7 | MathProbability+2 | No attempts yet | 2s | 512 MB | Judgeable |
| HypercubeOn the N-hypercube whose arcs join labels differing in one bit, find the largest predecessor and smallest successor of M, then count all paths of length K. | Medium7 | CombinatoricsBit manipulation+2 | No attempts yet | 0.2s | 1024 MB | Judgeable |