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,685 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Building a ranchGiven an M by N grid with trees and rocks as obstacles, find the side length of the largest square subgrid that contains no obstacle. | Medium5 | Dynamic programmingMatrix+2 | No attempts yet | 1s | 512 MB | Judgeable |
| EnigmaGiven a digit pattern with question marks and an N, find the smallest matching number with no leading zero that is divisible by N. | Medium5 | Dynamic programmingMath+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Front NineGiven a clamped random walk on [0,h] with step probabilities, compute the expected area under the piecewise-linear terrain over n steps. | Medium5 | ProbabilityDynamic programming+2 | No attempts yet | 6s | 512 MB | Judgeable |
| TilingCount the ways to tile a 3 by W rectangle with 2 by 1 dominoes, printing the result modulo 1e9+7. | Medium5 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sweet, sour, bitter, saltyCut edges of a rooted binary tree so that at least X resulting components each contain at least K nodes, minimizing total cut cost. | Medium5 | TreeDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Candy ChainGiven a candy string and a list of paid parts (each reversible), find the maximum total value obtainable by repeatedly removing sold parts and rejoining the remainder. | Medium5 | Dynamic programmingIntervals+2 | No attempts yet | 7s | 512 MB | Judgeable |
| SugorokuSquares 2 to N+1 are each marked 0 or 1; find the smallest die size j such that some sequence of rolls from 1 to j reaches or passes square N+2 without landing on any square marked 1. | Medium5 | Dynamic programmingBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Hangul LCSGiven two Hangul strings of up to 1000 characters each, compute the length of their longest common subsequence in characters. | Medium5 | Dynamic programmingString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Counting a^i b^j c^k subsequencesCount subsequences of a string of a, b, c that read as some positive number of a's, then b's, then c's, modulo 1e9+7. | Medium5 | Dynamic programmingString+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Consultations before resignationGiven up to 1.5 million days, each with a job of length T_i and pay P_i, pick jobs that fit before day N+1 to maximize total pay. | Medium5 | Dynamic programmingArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Probability that the knight stays on the boardA knight on an N by N board makes K random moves, each of the eight directions equally likely; find the probability it is still on the board after K moves. | Medium5 | Dynamic programmingProbability+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Pascal's triangleBuild Pascal's triangle and sum all entries inside the equilateral sub-triangle whose top cell is row R, position C, with side length W. | Medium5 | ArrayDynamic programming+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Signal 1Choose a subset of points with distinct x-coordinates; maximize the total Euclidean length of the polyline joining them in increasing x order. | Medium5 | Dynamic programmingSorting+2 | No attempts yet | 1.5s | 128 MB | Judgeable |
| Roasting Emma is a barista tooGiven a weighted tree, compute for every vertex the sum of shortest distances to all other vertices. | Medium5 | TreeDFS+2 | No attempts yet | 1.5s | 128 MB | Judgeable |
| QueryreuQMaintain a string under append and pop-back operations, and after each operation print the number of palindromic substrings it contains. | Medium5 | StringDynamic programming+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Drain PipesCount the number of ways to pick quantities of each pipe type, within the given stock, so the chosen pipes sum to exactly x. | Medium5 | Dynamic programmingArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Ah-Choo!Compute the least Dynamic Time Warping distance between two equal-length integer sequences, where every point must match at least one point of the other and matches cannot cross. | Medium5 | Dynamic programmingArray+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Pen Pineapple Apple PenGiven a string of A, P, and p, find the maximum number of disjoint subsequence occurrences of the pattern p, P, A, p in order. | Medium5 | GreedyString+1 | No attempts yet | 1s | 32 MB | Judgeable |
| Uks Is an Apple Fan!!Count the number of paths on an N by M grid where each cell directs movement right, down, or both, and every path must end at cell (N, M). | Medium5 | Dynamic programmingCombinatorics+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Longest Consecutive SubsequenceGiven an integer sequence, find the longest subsequence whose values form an arithmetic run with common difference 1, keeping the original order. | Medium5 | Dynamic programmingHash map+1 | No attempts yet | 2s | 256 MB | Judgeable |
| 1, 2, 3 Sum 5Count the ordered sums of 1, 2, and 3 that add to n, with no equal value adjacent, modulo 1,000,000,009. | Medium5 | Dynamic programmingMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| 1, 2, 3 Addition 7Count ordered compositions of n into exactly m parts, where each part is 1, 2, or 3, modulo 1,000,000,009. | Medium5 | Dynamic programmingCombinatorics+2 | No attempts yet | 0.25s | 512 MB | Judgeable |
| BlogGiven a string of R, G, and B, find the minimum number of contiguous same-color paint operations needed to build it. | Medium5 | Dynamic programmingString+2 | No attempts yet | 1s | 256 MB | Judgeable |
| A Great WayFind the cheapest path from node 1 to node N, where an edge costs c + d*max(0,e-10), breaking ties by fewer waypoints. | Medium5 | GraphShortest path+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Execution TimeGiven ranks and operating speeds of n computers in a chain of ranks, compute when the whole task finishes using transmission time (i-j)^2 between machines. | Medium5 | Dynamic programmingGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Adding 1, 2, 3 (9)Count ordered compositions of n into parts 1, 2, and 3 that use at most m terms, and output each count modulo 1,000,000,009. | Medium5 | Dynamic programmingCombinatorics+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Bit Palindromic NumbersCount integers in [l, r] whose first and last decimal digits match; solve with per-length counts and digit-DP over 10^18 ranges. | Medium5 | MathDynamic programming+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Amusement ParkCitizens at various blocks must reach block 0 by taxi (A per block, one rider) or by sharing a bus (B won, up to 40 riders, one pick-up point). Find the minimum total cost. | Medium5 | Dynamic programmingSorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Making a PalindromeFind the largest odd-length palindrome centered at index i, then answer each query by dropping the rest of the N cards. | Medium5 | String matchingDynamic programming+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Cheap TripsOrder trips cannot be reordered and take no gaps; plan discounts across 120-minute windows to minimize total cost. | Medium5 | Dynamic programmingGreedy | No attempts yet | 2s | 512 MB | Judgeable |
| TeamworkPartition cows in a row into blocks of at most K so each block contributes its maximum times block size; maximize the sum. | Medium5 | Dynamic programmingArray | No attempts yet | 2s | 512 MB | Judgeable |
| Root GameFor each N, decide who wins the subtraction game where a move subtracts any perfect square from a running total and taking the last square wins. | Medium5 | Game theoryDynamic programming+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Restore the ArrayRecover grid A from grid B, where B is built by overlapping A with A shifted down X and right Y so overlapping cells are summed. | Medium5 | MatrixSimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Pipe Move 2Count the ways to push a 2-cell pipe (horizontal, vertical, or diagonal) across an N by N grid so its end reaches (N, N), keeping all covered cells empty. | Medium5 | Dynamic programmingImplementation+2 | No attempts yet | 0.5s | 512 MB | Judgeable |
| ContestGiven N intervals with start time, end time, and prize money, choose non-overlapping contests (end must not touch the next start) to maximize total prize. | Medium5 | Dynamic programmingSorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Cowburger Kitchen WorkerWith M cheeseburgers and K fries available, pick the largest subset of orders, each requiring some of each item, that fits within both limits. | Medium5 | Dynamic programmingGreedy+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Largest Sum Decreasing SubsequenceGiven a sequence, find a strictly decreasing subsequence with the maximum possible sum and print that sum. | Medium5 | Dynamic programmingArray+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Making the Number NCount how many digit-by-digit sequences build the number N when each new digit is attached to the left or right end. | Medium5 | Dynamic programmingString+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Being a Celebrity Is HardGiven a weighted undirected graph and two starting nodes, pick a meeting node minimizing the sum of both shortest distances and breaking ties by Jiheon's distance then index. | Medium5 | Shortest pathGraph+1 | No attempts yet | 1s | 256 MB | Judgeable |
| League of Legends (Large)Count the sequences of skills A (1 second) and B (M seconds) that fill exactly N seconds with no idle time, modulo 1e9+7. | Medium5 | Dynamic programmingCombinatorics+1 | No attempts yet | 3s | 256 MB | Judgeable |
| BackdoorFind the shortest travel time from junction 0 to junction N-1 in an undirected weighted graph, where every intermediate junction marked visible is blocked and only the Nexus may be entered. | Medium5 | Shortest pathGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| FLEXDistribute M extra ten-thousand-won units among N days to minimize the sum of squared drops between consecutive daily spends. | Medium5 | Dynamic programmingGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Promoting a ClubGiven a forest, choose the fewest vertices so that every vertex is either chosen or adjacent to a chosen one (minimum dominating set on a forest). | Medium5 | TreeDynamic programming+2 | No attempts yet | 2s | 256 MB | Judgeable |
| StringsBuild strings by concatenating earlier strings or slicing a substring, then output the sum of ASCII codes of the final string modulo 1e9+7, without materializing the possibly huge string. | Medium5 | Dynamic programmingString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Code WordCount length-l digit sequences on an r by c grid where no two consecutive presses are orthogonally or diagonally adjacent, mod 1e9+7. | Medium5 | Dynamic programmingMatrix+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Four SquaresGiven n up to 50,000, print the minimum number of perfect squares whose sum equals n. | Medium5 | Dynamic programmingMath+2 | No attempts yet | 0.5s | 512 MB | Judgeable |
| Efficient ExchangeGiven a payment amount, minimize the total number of power-of-10 coins exchanged in both directions, allowing both sides to give change. | Medium5 | Dynamic programmingGreedy+2 | No attempts yet | 3s | 512 MB | Judgeable |
| What Does UNIST Stand For?Count ways to pick a prefix of each of N words so the concatenation spells UNIST, modulo 1e9+7. | Medium5 | Dynamic programmingString+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Course SelectionChoose courses with given importance and study time so total time stays within N and total importance is maximized. | Medium5 | Dynamic programmingArray+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Keyboards in ConcertGiven n keyboards, the sets of notes each can play, and the note sequence of a tune, find the minimum number of keyboard switches needed to play the whole tune. | Medium5 | Dynamic programmingHash map+2 | No attempts yet | 1s | 512 MB | Judgeable |
| SnowballSnowballs form at each altitude with size 1 and multiply by x each centimeter they descend; find the total size of all snowballs modulo 1e9+7. | Medium5 | MathPrefix sum+2 | No attempts yet | 0.5s | 256 MB | Judgeable |
| DessertEach day pick one of M desserts to maximize total satisfaction, where repeating the same dessert halves that day's value (rounded down). | Medium5 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 256 MB | Judgeable |
| What's Mine is MinePick non-overlapping ore intervals to maximize total value, where each interval's value is its duration times its mineral's price. | Medium5 | Dynamic programmingSorting+2 | No attempts yet | 0.5s | 512 MB | Judgeable |
| HowlGiven a valid howl over A, H, O, W, construct a valid howl that is strictly longer, or report that none exists. | Medium5 | StringGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Rainbow StringsCount subsequences of a string in which no letter repeats, distinguishing them by position, modulo 11092019. | Medium5 | Dynamic programmingMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| 7-Segment DisplayUsing n seven-segment displays, each showing a digit 0-9 or the two-digit value 11, find the largest multiple of m displayable across the displays. | Medium5 | Brute forceMath+2 | No attempts yet | 3s | 1024 MB | Judgeable |
| Buying Ramen (Small)Buy exactly Ai packs from each factory using 1-pack, 2-pack, or 3-pack deals with different costs, minimizing total money. | Medium5 | GreedyDynamic programming+2 | No attempts yet | 0.5s | 32 MB | Judgeable |
| Stacking Blocks TogetherEach of N students offers a set of distinct block sizes, at most one block per student is used, and we count subsets of students whose chosen blocks sum to exactly H modulo 10007. | Medium5 | Dynamic programmingPrefix sum+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Unstable SubstancesEach substance conflicts with exactly one other; choose a subset with no conflicting pair to maximize total weight. | Medium5 | GraphDynamic programming+2 | No attempts yet | 1.2s | 256 MB | Judgeable |
| A Really Odd SequenceGiven a sequence of integers, find the maximum sum of a contiguous subarray whose length is odd. | Medium5 | ArrayDynamic programming+2 | No attempts yet | 6s | 512 MB | Judgeable |
| Reversing StringsFor each string choose to reverse it or not so the sequence becomes lexicographically sorted, and output the lexicographically smallest such 0-1 choice string. | Medium5 | GreedyString+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Meeting Room Scheduling 4Choose a set of non-overlapping meetings, where touching endpoints are allowed, to maximize the total number of attendees. | Medium5 | Dynamic programmingSorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Painting ExchangeGiven who can sell to whom at what price, find the longest chain of distinct buyers starting from artist 1 where each resale price never drops below the purchase price. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Park Seongwon's ProbabilityCount permutations of up to 15 numbers whose concatenation is divisible by K, and output the probability as a reduced fraction. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Power PlantsGiven restart costs between plants and which plants are already on, find the minimum total cost to reach at least P working plants, or -1. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Search EngineGiven directed links between websites, compute one website's trust score by summing scores of linking sites only when no cycle would result. | Medium6 | GraphDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| FencesPartition up to 16 given fence lengths into disjoint triples, keep only triples that form a valid triangle, and maximize the total area. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Zigzag LineupCount permutations of N distinct heights where adjacent comparisons strictly alternate, modulo 1,000,000. | Medium6 | Dynamic programmingCombinatorics+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Road PavingFind the minimum travel time from city 1 to city N when up to K roads can be paved to cost zero, using layered shortest-path search over (node, paves used). | Medium6 | Shortest pathGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Student ShuffleCount permutations of up to 16 students so that every pair of adjacent heights differs by more than a given value K. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Hexagonal NumbersGiven N up to 1,000,000, compute the minimum number of hexagonal numbers (1, 6, 15, 28, ...) that sum to N. | Medium6 | Dynamic programmingMath+2 | No attempts yet | 2s | 128 MB | Judgeable |
| String DistanceGiven strings O and N, find the minimum number of substring-insertion operations to turn O into N, or output -1 if impossible. | Medium6 | Dynamic programmingString+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Christmas TreeCount the ways to decorate an N-level tree where level k needs k ornaments split evenly among chosen colors, given limited red, green and blue ornaments. | Medium6 | Dynamic programmingCombinatorics+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Problem AssignmentGiven an N x N matrix of student-problem times, find the minimum-cost perfect matching assigning one distinct problem to each student. | Medium6 | Dynamic programmingGraph+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Restricted PermutationsCount permutations of 1..N where every element differs from its index by at most K, using a bitmask DP over a sliding window. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Sum of Tree Path WeightsGiven a weighted tree, compute the sum over all vertex pairs of the product of edge weights along their connecting path, modulo 1e9+7. | Medium6 | TreeDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Assigning Tasks 1Given an N by N cost matrix, assign each person exactly one task to minimize the total assignment cost. | Medium6 | Dynamic programmingBit manipulation+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Picking Trash in the Same Increasing OrderFind the longest common strictly increasing subsequence of trash sizes recorded on two different days. | Medium6 | Dynamic programmingArray+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Infinite Sequence 2Compute A_N for a recursively defined sequence using nested floor divisions, requiring memoized recursion over a bounded set of distinct arguments. | Medium6 | RecursionMath+2 | No attempts yet | 10s | 512 MB | Judgeable |
| Optimal Binary Search TreeGiven up to 300 distinct keys within range 1..n, build a binary search tree minimizing total node visits over all searches for every integer from 1 to n, using an optimal BST DP with unsuccessful search gaps. | Medium6 | Dynamic programmingTree+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Random RobotGiven move probabilities for E, W, S, N and up to 14 steps, compute the probability that the robot's random walk visits no grid cell twice. | Medium6 | Dynamic programmingBrute force+1 | No attempts yet | 1s | 128 MB | Judgeable |
| CandyGiven candy prices, count the distinct ways to pick a multiset of candies whose price sum is a prime number. | Medium6 | Dynamic programmingNumber theory+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Character TrainingGiven character counts and power values per level, decide how to spend at most D training days across characters to maximize total power. | Medium6 | Dynamic programmingGreedy+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Movie Director ShomFind the N-th smallest positive integer whose decimal digits contain at least three consecutive 6s, for N up to 10000. | Medium6 | Binary searchDynamic programming+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Nice NumbersCount integers in the range [L, R] whose binary representation has three consecutive equal bits, using digit DP over bits. | Medium6 | Dynamic programmingBit manipulation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Prefix Reversal 3Given a string, for each prefix length from 1 to N in order you may choose to reverse that prefix, and you must output the lexicographically smallest string achievable after all choices. | Medium6 | StringGreedy+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Palindrome PartitioningGiven an uppercase string up to length 2500, compute the minimum number of pieces to cut it into palindromic substrings. | Medium6 | Dynamic programmingString | No attempts yet | 2s | 128 MB | Judgeable |
| Sum of Lucky NumbersWrite N as a sum of the fewest numbers made only of digits 4 and 7, breaking ties by the lexicographically smallest sequence. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Dongmin SequenceCount sequences of lucky numbers (digits 4/7 only) chosen from a given list of length L, where consecutive elements share first/last digit, modulo 1,234,567,891. | Medium6 | MatrixDynamic programming+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Artist Lee DonghoGiven a black/white grid and a limit on horizontal single-color brush strokes, find the minimum number of cells that end up unpainted or wrongly colored. | Medium6 | Dynamic programmingPrefix sum+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Making the Best Phone NumberSplit a digit string into groups of 2 or 3 to maximize a score based on group types, then output the lexicographically smallest optimal formatting. | Medium6 | Dynamic programmingString+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Morning Three and Evening FourGiven N banana weights, choose non-overlapping length-K blocks to move as a C-second group, minimizing total time and then the number of groups used, with output of chosen block positions. | Medium6 | Dynamic programmingPrefix sum+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Tiling a GridCount the ways to fully tile an N by M grid (N, M up to 14) with 2x1 dominoes, modulo 9901. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| XYZ StringGiven a self-similar X/Y/Z rewriting sequence, answer queries about the stage N string's length, its k-th character, or the count of a given character without building the full string. | Medium6 | RecursionDivide and conquer+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Largest Zero SubmatrixGiven a binary matrix, find the maximum area rectangle of consecutive rows and columns that contains only zeros. | Medium6 | StackDynamic programming+2 | No attempts yet | 2s | 128 MB | Judgeable |
| CubeditorGiven a lowercase string of length up to 5000, find the maximum length of a substring that occurs at least twice, allowing overlapping occurrences. | Medium6 | StringDynamic programming+1 | No attempts yet | 0.5s | 128 MB | Judgeable |
| Tile CodesCount distinct tilings of a 2xN board using 1x2, 2x1, and 2x2 tiles, where mirror-image tilings under left-right flip count as one. | Medium6 | Dynamic programmingCombinatorics+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Making CouplesGiven lists of men's and women's personality values, form min(n, m) man-woman couples that minimize the total absolute difference of matched values. | Medium6 | Dynamic programmingSorting+2 | No attempts yet | 2s | 128 MB | Judgeable |
| PibonacciCompute a Fibonacci-like sequence defined with the irrational constant pi as a recursive step and output it modulo 10^18. | Medium6 | Dynamic programmingRecursion+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Maximum Submatrix SumGiven an N by M integer matrix, find the maximum possible sum over all contiguous rectangular submatrices. | Medium6 | Dynamic programmingMatrix+2 | No attempts yet | 2s | 128 MB | Judgeable |