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 results575 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Graph Maximum MatchingGiven a small graph, decide whether some edges can be kept so every vertex has degree exactly 1. | Easy2 | GraphBacktracking+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Come Back HomeCount simple paths of exact length K from the bottom-left to the top-right cell of a small grid, avoiding blocked cells and revisits. | Easy3 | BacktrackingDFS+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Password GenerationGenerate all length-L increasing letter combinations from a given set of C letters that contain at least one vowel and two consonants, printed in lexicographic order. | Easy3 | BacktrackingBrute force+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Placing CardsGiven up to 10 cards with 1 or 2 digit numbers, count the distinct integers formed by ordering exactly k chosen cards. | Easy3 | Brute forceBacktracking+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Breed AssignmentCount the breed assignments for N cows under same/different constraints, or report 0 if they conflict. | Easy3 | GraphBacktracking+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Going to the MoviesGiven a truck capacity C and up to 16 cow weights, pick a subset whose total weight is as large as possible without exceeding C. | Easy3 | Brute forceBacktracking+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Stuttering StringsFor each input case, the program prints every length-n string over * and ! whose runs stay within the given limits, in lexicographic order with * first. | Easy3 | BacktrackingRecursion+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Even More DicePrint every nondecreasing roll of n m-sided dice that sums to s in lexicographic order for each test case. | Easy3 | BacktrackingRecursion | No attempts yet | 5s | 512 MB | Judgeable |
| All PermutationsPrint every permutation of the numbers 1 to N in lexicographic order, one per line. | Easy3 | BacktrackingRecursion | No attempts yet | 1s | 256 MB | Judgeable |
| Travel of AlphabetsCount all length-L walks on a letter grid and the distinct strings among them, discarding any word containing a, c, or m. | Easy3 | BacktrackingDFS+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Sums of 1, 2, 3 (2)Find the k-th composition of n using parts 1, 2 and 3 in lexicographic order, or print -1 when it does not exist. | Easy3 | BacktrackingDynamic programming | No attempts yet | 1s | 512 MB | Judgeable |
| Modern Art Plagiarism (Small)Decide whether the smaller tree is a connected subgraph of the larger tree, with only the shapes mattering, not the original labels. | Easy3 | TreeBacktracking | No attempts yet | 5s | 512 MB | Judgeable |
| String PermutationPrint every permutation of a short string of distinct characters, in the order given by the original character positions. | Easy3 | BacktrackingRecursion+1 | No attempts yet | 5s | 512 MB | Judgeable |
| N and M (1)Print every length-M sequence of distinct numbers chosen from 1 to N, in increasing lexicographic order. | Easy3 | BacktrackingRecursion | No attempts yet | 1s | 512 MB | Judgeable |
| N and M (2)Print all ascending sequences of M distinct numbers chosen from 1 to N, in lexicographic order. | Easy3 | BacktrackingRecursion+1 | No attempts yet | 1s | 512 MB | Judgeable |
| N and M (3)Print every length-M sequence from 1 to N in lexicographic order, allowing repeats. | Easy3 | BacktrackingRecursion+2 | No attempts yet | 1s | 512 MB | Judgeable |
| N and M (4)Print all non-decreasing sequences of length M chosen from 1 to N, each exactly once, in lexicographic order. | Easy3 | BacktrackingRecursion | No attempts yet | 1s | 512 MB | Judgeable |
| Length M sequences from N numbersGiven N distinct numbers and an M, print every length-M permutation of the numbers in lexicographic order without repeats. | Easy3 | BacktrackingRecursion+2 | No attempts yet | 1s | 512 MB | Judgeable |
| N and M (6)Given N distinct natural numbers and M, print every ascending M-element subsequence in lexicographic order without repeats. | Easy3 | BacktrackingSorting+2 | No attempts yet | 1s | 512 MB | Judgeable |
| N and M (10)Given N numbers and an M, print every non-decreasing length-M selection of the numbers in lexicographic order without duplicates. | Easy3 | BacktrackingSorting+2 | No attempts yet | 1s | 512 MB | Judgeable |
| The Rice Cake Seller and the TigerPick one rice cake kind from each day's set so consecutive picks differ; output the daily picks or -1 if impossible. | Easy3 | Dynamic programmingBacktracking+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Livestock LineupGiven at most 7 'must be milked beside' constraints among 8 cows, output the alphabetically first permutation satisfying all of them. | Easy3 | Brute forceBacktracking+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Sudoku VariantGiven a 3x3 grid with at most three empty cells, count the ways to fill the empties so no digit repeats in any row or column. | Easy3 | Brute forceBacktracking+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Sum of SubsequencesCount how many non-empty subsequences of up to 20 integers sum exactly to a given target S. | Medium4 | BacktrackingBrute force+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Lucky StringsCount the distinct rearrangements of a short string (length up to 10) that have no two adjacent equal characters. | Medium4 | BacktrackingCombinatorics+1 | No attempts yet | 2s | 256 MB | Judgeable |
| DominoesGiven an N x N grid of domino values (N up to 6), find the minimum and maximum of the cycle-sign-adjusted product over all row-column permutations. | Medium4 | Brute forceBacktracking+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Remarkable PrimesGiven N, output all N-digit primes whose every left-hand prefix (1 to N digits) is also prime, in ascending order. | Medium4 | BacktrackingMath+1 | No attempts yet | 2s | 4 MB | Judgeable |
| Number Board JumpCount the distinct length-6 digit strings obtainable by starting anywhere on a 5x5 digit board and making five moves to adjacent cells. | Medium4 | DFSBrute force+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Shut the Box IGiven a target sum and a sorted list of open card values, choose the subset summing to the target that is lexicographically largest when sorted. | Medium4 | BacktrackingArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TransportWith at most 20 items, choose a subset whose total weight is at most W and whose total value is as large as possible. | Medium4 | Brute forceBacktracking+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Bale ShareAssign N bales (N up to 20) to three barns so the largest barn total is as small as possible, and print that smallest possible largest total. | Medium4 | Brute forceRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Sultan's SuccessorsFor each 8x8 board, place 8 non-attacking queens to maximize the sum of the numbers on the occupied squares. | Medium4 | BacktrackingRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Mapping the RouteSimulate a west, north, east, south backtracking search on a small walled grid, number the route cells, mark other visited cells with ???, and draw the maze. | Medium4 | DFSBacktracking+2 | No attempts yet | 1s | 128 MB | Judgeable |
| LottoFor each set of k numbers in ascending order, print all 6-element subsets in lexicographic order, separated by blank lines. | Medium4 | BacktrackingRecursion+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Who owns the Amiga?Given constraint lines over five rooms, decide whether the Amiga owner is uniquely determined and print that student, or state it cannot be found. | Medium4 | Brute forceImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Making ZeroInsert +, -, or a space between consecutive numbers 1 to N and print every expression that evaluates to 0, in ASCII order. | Medium4 | BacktrackingBrute force+1 | No attempts yet | 1s | 128 MB | Judgeable |
| BalanceCount the orders and pan choices for placing n distinct weights so the left pan is never heavier than the right at any step. | Medium4 | Brute forceBacktracking+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Peg SolitaireMove pegs by jumping over adjacent pegs into empty holes to leave as few pegs as possible with the fewest moves. | Medium4 | BacktrackingBrute force+1 | No attempts yet | 1s | 128 MB | Judgeable |
| DraughtsFind the most dark pieces one light piece can capture in a single chain of diagonal jumps on a 10x10 draughts board. | Medium4 | BacktrackingDFS+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Balanced TeamsSplit twelve cows with given skill levels into four teams of three to minimize the gap between the strongest and weakest team sums. | Medium4 | Brute forceBacktracking | No attempts yet | 1s | 128 MB | Judgeable |
| Treasure HuntersAssign up to 8 treasures to up to 6 hunters with differing valuations to minimize the gap between the richest and poorest hunter totals. | Medium4 | BacktrackingBrute force | No attempts yet | 1s | 128 MB | Judgeable |
| Maximum Jumps for a Checkers KingGiven up to 20 checkerboards, find for each board the red king with the longest capture chain and print its row, column, and jump count. | Medium4 | BacktrackingDFS+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Two's Round TripsList every route that starts at house 2, visits no house twice, returns to house 2, and print them as digit strings in numeric order. | Medium4 | BacktrackingDFS+1 | No attempts yet | 1s | 256 MB | Judgeable |
| QuentoFind a no-revisit path using exactly M digits on the fixed 3x3 board whose left-to-right value equals N and print the lexicographically smallest one. | Medium4 | BacktrackingDFS | No attempts yet | 1s | 256 MB | Judgeable |
| Wi-Fi Towers (Small)Choose which towers to upgrade to protocol B so the total score is maximized, where upgrading a tower forces every tower in its range to be upgraded too. | Medium4 | GraphBrute force+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Clever TitleFor each uppercase word, count how many orderings of the n author names let you pick one uppercase letter from each name, left to right, to spell the word. | Medium4 | BacktrackingBrute force+2 | No attempts yet | 5s | 512 MB | Judgeable |
| N and M (7)Given N distinct numbers and a length M, print every length-M sequence drawn from the numbers with repetition allowed, deduplicated and in increasing lexicographic order. | Medium4 | BacktrackingRecursion+2 | No attempts yet | 1s | 512 MB | Judgeable |
| N and M (8)Given N distinct natural numbers and a length M, print all non-decreasing sequences of length M drawn from the numbers, in lexicographic order. | Medium4 | BacktrackingSorting+1 | No attempts yet | 1s | 512 MB | Judgeable |
| N and M (9)Given N numbers (with duplicates) and length M, print every distinct length-M selection in increasing lexicographic order, using each copy at most once. | Medium4 | BacktrackingSorting+1 | No attempts yet | 1s | 512 MB | Judgeable |
| N and M (11)Given N numbers and a length M, list every length-M sequence drawn from the numbers, allowing repeats, in increasing lexicographic order without duplicates. | Medium4 | BacktrackingRecursion+2 | No attempts yet | 1s | 512 MB | Judgeable |
| N and M (12)Given N numbers and a length M, list all non-decreasing length-M sequences drawn from the numbers with repetition, in lexicographic order. | Medium4 | BacktrackingSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| First In Last OutAssign distinct hexadecimal digits to the letters in LIST + FILO = STACK so the addition holds, and print every solution in lexicographic order. | Medium4 | Brute forceBacktracking+2 | No attempts yet | 1s | 32 MB | Judgeable |
| Counting Langford SequencesCount Langford sequences of length 2n where the numbers at positions x and y are equal, for n up to 12. | Medium4 | BacktrackingRecursion+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Muscle LossCount orderings of N workout kits (N at most 8) such that a starting total of 500, which drops by K each day, never falls below 500. | Medium4 | Brute forceBacktracking+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Broken CalculatorStarting from 1 on a calculator limited to D digits, find the largest value reachable after exactly P multiplications by digits 2-9, or report -1 if impossible. | Medium5 | BacktrackingBrute force+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Gap Pair SequenceConstruct the lexicographically smallest sequence where each number from a given set appears twice with exactly that many numbers between the two occurrences, or report -1 if impossible. | Medium5 | BacktrackingCombinatorics+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Sum of Numbers 6Given N and the bottom value of a Pascal-like sum triangle built from a permutation of 1..N, reconstruct the lexicographically smallest top row. | Medium5 | CombinatoricsBacktracking+2 | No attempts yet | 2s | 128 MB | Judgeable |
| The Famous Seven PrincessesCount connected 7-cell shapes on a 5x5 grid of S/Y students where at least 4 cells are S. | Medium5 | BacktrackingDFS+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Alphabet PathFind the longest path from the top-left cell of a grid moving to adjacent cells while never revisiting a letter already used, maximizing visited cells. | Medium5 | BacktrackingDFS+1 | No attempts yet | 2s | 256 MB | Judgeable |
| SequenceFind the K-th lexicographically smallest non-decreasing sequence of N positive integers summing to M. | Medium5 | BacktrackingCombinatorics+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Inequality SignsGiven a sequence of < and > signs, place k+1 distinct digits 0-9 to satisfy all comparisons and output the lexicographically largest and smallest resulting digit strings. | Medium5 | BacktrackingGreedy+1 | No attempts yet | 1s | 256 MB | Judgeable |
| History of FootballGiven final points of n (up to 8) football teams under win/draw/loss scoring, count the number of distinct match outcome assignments consistent with those totals. | Medium5 | BacktrackingCombinatorics+1 | No attempts yet | 2s | 64 MB | Judgeable |
| The Industrial Spy's LetterGiven up to 7 digit shreds, count the distinct primes formable by arranging any subset of them (leading zeros dropped), over up to 200 test cases. | Medium5 | BacktrackingCombinatorics+1 | No attempts yet | 1.5s | 128 MB | Judgeable |
| SudokuFill the five empty cells (marked 0) in a 9x9 Sudoku grid so every row, column, and 3x3 box contains the digits 1 through 9 exactly once. | Medium5 | BacktrackingImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SafecrackerGiven a target T and up to 12 distinct uppercase letters, find five distinct letters whose signed power sum equals T; if several work, print the lexicographically greatest string. | Medium5 | Brute forceBacktracking+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Sum It UpGiven a target and up to 12 numbers, list every distinct subset sum equal to the target, sorted in decreasing lexicographic order. | Medium5 | BacktrackingSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The ClocksGiven nine clock dials and nine moves that each rotate a fixed subset of dials by 90 degrees, find the shortest move sequence that sets every dial back to 12 o'clock. | Medium5 | Brute forceBacktracking+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Listing Square Arrangements in Lexicographic OrderList every partition of n whose parts are non-increasing, and print the sequences in decreasing lexicographic order. | Medium5 | BacktrackingRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Escaping the FarmAmong up to 20 cow weights, find the largest subset whose base-10 sum produces no carry in any digit position. | Medium5 | Bit manipulationBrute force+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SlurpysGiven up to 10 short strings, decide whether each one is a Slurpy, meaning a Slimp followed by a Slump under the recursive grammar in the statement. | Medium5 | RecursionString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Peculiar PrimesList every integer in [X, Y] whose prime factors all belong to a given set of at most 10 primes, or print none. | Medium5 | BacktrackingMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| BananasDecide for each word whether it fits the recursive grammar of a monkey language, where words wrap other words in N and in B...S. | Medium5 | StringRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Pattern GeneratorFor each (n, k) pair, print all n-bit strings with exactly k ones in decreasing numeric order, separated by blank lines. | Medium5 | BacktrackingRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| King Thrór's GoldCount the ways to choose exactly k distinct bar values summing to T, and list all solutions in lexicographic order when there are at most 20. | Medium5 | Dynamic programmingBacktracking+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TähekabeOn an N x N letter grid, decide for each of up to 10 query words whether a simple path from the start cell spells it, without reusing a cell. | Medium5 | BacktrackingDFS+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| TransportationChoose a subset of passenger orders so that no route segment exceeds capacity n, maximizing total revenue. | Medium5 | BacktrackingBrute force | No attempts yet | 1s | 128 MB | Judgeable |
| RelocationSplit up to 10 furniture items between two cars with capacity limits so that every item gets moved in the fewest number of paired trips. | Medium5 | Dynamic programmingBinary search+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Network SaboteurSplit N nodes (N <= 20) into two sets A and B so the total weight of edges crossing between them is maximized. | Medium5 | Brute forceBacktracking+1 | No attempts yet | 1s | 128 MB | Judgeable |
| MinesweeperCount the largest possible number of second-row mines, including the marked ones, that fits the first-row digit clues. | Medium5 | BacktrackingBrute force | No attempts yet | 1s | 128 MB | Judgeable |
| Opening the SafeDecide for each given quadruple of digits whether its four numbers can be combined with arithmetic operations and parentheses to make 24. | Medium5 | BacktrackingBrute force | No attempts yet | 1s | 128 MB | Judgeable |
| VirologyDecide for each 14-gene sample whether the genes split into four triples or runs plus one pair. | Medium5 | BacktrackingBrute force | No attempts yet | 3s | 128 MB | Judgeable |
| N-QueenCount the ways to place N non-attacking queens on an N by N board for N under 15. | Medium5 | BacktrackingBit manipulation | No attempts yet | 10s | 128 MB | Judgeable |
| NonogramDecide whether exactly one black-and-white grid fits the given row and column run lengths and print it, else print not unique. | Medium5 | BacktrackingBrute force+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Make the target from four numbersDecide whether the first four integers can form the fifth using each exactly once with +, -, *, / and parentheses. | Medium5 | Brute forceBacktracking+1 | No attempts yet | 1s | 128 MB | Judgeable |
| GREAT + SWERC = PORTOCount the assignments of distinct digits to letters that make the word sum correct with nonzero leading letters. | Medium5 | BacktrackingBrute force | No attempts yet | 2s | 256 MB | Judgeable |
| Permutation with no spacesRecover the permutation from 1 to N whose decimal forms concatenate to the given digit string, choosing the lexicographically smallest one on ties. | Medium5 | BacktrackingBrute force+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Next Unique-Digit NumberFind the smallest integer above N that uses no zero and repeats none of the digits 1 to 9, printing 0 when none exists. | Medium5 | BacktrackingCombinatorics+1 | No attempts yet | 1s | 256 MB | Judgeable |
| BoggleFind every dictionary word that can be spelled on each letter grid with adjacent cells and no cell reused, treating q as qu. | Medium5 | BacktrackingTrie+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Each digit at most twiceFind the largest integer L not greater than U whose decimal digits each appear at most twice. | Medium5 | BacktrackingGreedy+1 | No attempts yet | 3s | 256 MB | Judgeable |
| CheckersFind the Black piece that captures every White piece in one chained jump, or report Multiple or None. | Medium5 | BacktrackingDFS+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Map ColouringColor each map with the fewest colors so bordering countries differ and print 1 to 4, or many when more are needed. | Medium5 | BacktrackingGraph | No attempts yet | 5s | 256 MB | Judgeable |
| CheckersCount the black kings that can capture all white kings in one chain of diagonal jumps. | Medium5 | BacktrackingDFS | No attempts yet | 2s | 256 MB | Judgeable |
| KenKen You Do It?Count the assignments of numbers 1 to n to the given cage cells that meet the target under the operator with distinct values in shared rows and columns. | Medium5 | BacktrackingBrute force | No attempts yet | 2s | 256 MB | Judgeable |
| 2048 (Hard)Slide and merge tiles on an N by N board for at most ten moves to maximize the largest tile. | Medium5 | Brute forceBacktracking+1 | No attempts yet | 1s | 512 MB | Judgeable |
| 2048 (Easy)Find the largest tile reachable within at most five 2048 moves on a given board where no new tiles appear. | Medium5 | Brute forceBacktracking+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Googlander (Small)Count all distinct walks on an R by C grid where the walker moves straight or turns right and follows forced moves until both moves are blocked. | Medium5 | BacktrackingSimulation | No attempts yet | 5s | 512 MB | Judgeable |
| Arithmetic Digit Numbers 2Count the integers from 1 to N, with N up to 10^18, whose decimal digits form an arithmetic sequence. | Medium5 | BacktrackingCombinatorics+1 | No attempts yet | 0.5s | 512 MB | Judgeable |
| Survivor (Small)Pick which foods to eat and in what order, respecting each shelf life, to maximize total survival time. | Medium5 | BacktrackingDynamic programming | No attempts yet | 5s | 512 MB | Judgeable |
| Dire Straights (Small)Split the hand into groups of consecutive values to make the shortest group as long as possible. | Medium5 | BacktrackingSorting | No attempts yet | 5s | 512 MB | Judgeable |
| Doubly-sorted grid (small)Given a partially filled R by C letter grid with R and C at most 4, count the completions whose rows and columns are non-decreasing modulo 10007. | Medium5 | BacktrackingDynamic programming | No attempts yet | 5s | 512 MB | Judgeable |