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 results1,785 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Vera's FashionGiven N tops and N bottoms colored 1 to N, count how many top and bottom pairs have different colors. | Easy1 | MathCombinatorics+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Time MachineGiven three two-digit numbers from a digital clock, count how many of the 6 permutations form a valid HH:MM:SS time. | Easy2 | CombinatoricsBrute force+1 | No attempts yet | 2s | 128 MB | Judgeable |
| DominoesGiven N, compute the total dot count across all unique dominoes with halves ranging from 0 to N. | Easy2 | MathCombinatorics | No attempts yet | 1s | 128 MB | Judgeable |
| UnfriendCount the subsets of nodes in a rooted tree that can be removed, where removing a node forces removal of all its descendants. | Easy2 | TreeBrute force+1 | No attempts yet | 2s | 512 MB | Judgeable |
| What is n, Daddy?Count the ordered pairs (a, b) with 1 <= b <= a <= 5 and possibly a single hand, summing to n. | Easy2 | MathBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Constrained PermutationsCount permutations of 1..n (n at most 9) that satisfy given ordering constraints x before y. | Easy2 | Brute forceCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| NumbersGiven three distinct digits and one of their six permutations, find that number's 1-based rank when all six permutations are sorted ascending. | Easy2 | MathSorting+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| KamilGiven a word Kamil spoke, count the words he could have meant, since each position may map to one of several letters. | Easy2 | MathCombinatorics+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Sums and DifferencesCount ordered pairs from distinct positions where the difference exceeds the sum, which holds exactly when the second element is negative. | Easy2 | MathCombinatorics | No attempts yet | 1s | 128 MB | Judgeable |
| Binomial Coefficient 1Compute the binomial coefficient N choose K for given N up to 10 and K between 0 and N. | Easy2 | CombinatoricsMath | No attempts yet | 1s | 256 MB | Judgeable |
| Lazy Spelling Bee (Large)Count distinct words formed by picking each letter from its neighbors in the target word, modulo 1e9+7. | Easy2 | CombinatoricsString+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Quake Live (Small2)Split the given players into two equal teams so the two skill totals differ as little as possible. | Easy2 | Brute forceCombinatorics | No attempts yet | 5s | 512 MB | Judgeable |
| Tojaengi's Walk to SchoolCount monotone lattice paths from (1,1) to (w,h) that pass through a given shop, modulo 1000007. | Easy2 | CombinatoricsMath | No attempts yet | 1s | 128 MB | Judgeable |
| Card Game ContestFor each of N games, Meiji has A_i decks, or gets one basic deck if A_i is 0. Count the number of distinct ways to enter, modulo M. | Easy2 | MathImplementation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Boolean SatisfiabilityCount the assignments of a disjunction of single literals that make the formula true, where each variable takes true or false. | Easy2 | CombinatoricsMath+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Pascal's TriangleGiven n and k with 1 <= k <= n <= 30, print the k-th entry of row n in Pascal's triangle, equal to C(n-1, k-1). | Easy2 | MathCombinatorics+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Least Common Multiple of at Least Three NumbersGiven five distinct positive integers up to 100, find the smallest number divisible by at least three of them, essentially the minimum LCM over all triples. | Easy3 | MathBrute force+2 | No attempts yet | 2s | 128 MB | Judgeable |
| LotteryGiven N, M, K, compute the probability that two random M-subsets of 1..N share at least K numbers using the hypergeometric distribution. | Easy3 | CombinatoricsMath+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Guitar ConcertGiven up to 10 guitars each covering a subset of up to 50 songs, find the minimum number of guitars needed to play the maximum possible number of songs. | Easy3 | Bit manipulationBrute force+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Count Numbers Made Only of 4 and 7Count integers between A and B (up to 1e9) whose digits are all 4s and 7s. | Easy3 | Brute forceCombinatorics+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Pinary NumbersCount binary strings of length N that start with 1 and have no two consecutive 1s, using Fibonacci-style counting with big integers up to N=90. | Easy3 | Dynamic programmingMath+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Sum DecompositionCount ordered sequences of K integers from 0 to N whose sum equals N, modulo 1,000,000,000. | Easy3 | Dynamic programmingCombinatorics+1 | No attempts yet | 2s | 128 MB | Judgeable |
| CombinationGiven n and m within 100, compute the exact value of the binomial coefficient C(n, m). | Easy3 | MathCombinatorics+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Making Triangles with MatchsticksGiven n identical matchsticks, count the number of non-congruent integer-sided triangles whose perimeter equals n. | Easy3 | MathCombinatorics+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Polygon Diagonal IntersectionsGiven N, a convex N-gon with no three diagonals concurrent, compute the number of interior diagonal intersection points using the combinatorial formula C(N,4). | Easy3 | CombinatoricsMath | No attempts yet | 1s | 128 MB | Judgeable |
| Relax! It's Just a GameFor each score (A, B), check whether the binomial coefficient C(A+B, A) equals the sum A+B, and print the comparison. | Easy3 | MathCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Really Good CompressionGiven N distinct 1000-bit files, decide whether each can be compressed to at most b bits. | Easy3 | MathCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Commute RouteCount monotone east/north lattice paths from (1,1) to (a,b) that avoid n blocked intersections, with a and b at most 16. | Easy3 | Dynamic programmingCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| World Cup NoiseFor each n below 45, count the n-bit strings that contain no two adjacent 1s, and print the result per scenario with a blank line between cases. | Easy3 | Dynamic programmingCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Black and White PaintingCount the 8x8 blocks inside an n by m checkerboard whose bottom-right square is white, given the color of the painting's bottom-right corner. | Easy3 | MathCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Paths on a GridCount monotone lattice paths from the lower-left to the upper-right of an n by m grid. | Easy3 | CombinatoricsMath | No attempts yet | 1s | 128 MB | Judgeable |
| Chances of WinningGiven results of some games among four teams, count the outcomes of the remaining games where team T ends with strictly more points than every other team. | Easy3 | Brute forceImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Don't pass me the ball!Given the scorer's jersey number J, count the ordered increasing 4-tuples of distinct jersey numbers ending at J. | Easy3 | CombinatoricsMath | No attempts yet | 2s | 512 MB | Judgeable |
| Mouse JourneyCount monotone right/down paths on an R by C grid from (1,1) to (R,C) that avoid K blocked cat cells. | Easy3 | Dynamic programmingMatrix+1 | No attempts yet | 2s | 512 MB | Judgeable |
| MaternityGiven the two alleles each parent carries for five genes, decide for each baby whether its five visible traits could result from that pairing. | Easy3 | ImplementationCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Skew BinaryConvert each decimal number into its unique skew binary representation, printed as the sorted ranks of its nonzero digits. | Easy3 | MathGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Prehistoric Operating SystemsCount binary strings of length n with no two adjacent D's, where D means DOORS and O means any other brand, for up to 40 test values of n. | Easy3 | Dynamic programmingCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Sequences without StammersPrint the smallest alphabet size for which a square-free (stammer-free) string of length n exists. | Easy3 | StringCombinatorics+1 | No attempts yet | 3s | 128 MB | Judgeable |
| PostcardCount the contiguous segments that keep at least one mountain of height m or more after trimming both ends. | Easy3 | CombinatoricsArray | No attempts yet | 1s | 512 MB | Judgeable |
| Class PairingsCount the ways to split N students into pairs for each test case and print the result modulo 1000. | Easy3 | CombinatoricsMath | No attempts yet | 1s | 128 MB | Judgeable |
| EncodingCount binary strings of length n that start with 1 and contain no adjacent ones for up to 100 queries. | Easy3 | Dynamic programmingCombinatorics | No attempts yet | 1s | 128 MB | Judgeable |
| PasswordFind the K-th password in lexicographic order whose letters appear in the same column of both 6 by 5 grids, or print NO. | Easy3 | CombinatoricsSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Lexicographic rank of a permutationGiven a permutation of the letters a to h, print its 1-based position in lexicographic order. | Easy3 | CombinatoricsMath | No attempts yet | 1s | 128 MB | Judgeable |
| Counting non-decreasing digit sequencesCount length-N non-decreasing sequences of digits 0 to 9, modulo 1000000007, for each test case. | Easy3 | CombinatoricsNumber theory | No attempts yet | 1s | 128 MB | Judgeable |
| Fashion King HaebinCount all nonempty outfits by picking at most one item from each clothing kind. | Easy3 | CombinatoricsHash map | No attempts yet | 1s | 128 MB | Judgeable |
| Equal Sum SetsCount subsets of {1..n} with exactly k elements that sum to s for each dataset. | Easy3 | Dynamic programmingCombinatorics | No attempts yet | 3s | 128 MB | Judgeable |
| PermutationGiven up to 10 distinct sorted characters and a 1-based position, print the permutation at that position or No permutation when it exceeds n!. | Easy3 | CombinatoricsMath | No attempts yet | 5s | 128 MB | Judgeable |
| Unlock My SafeThe program prints the sorted permutation of digits 1 to N at index floor(N factorial / 3) for each N. | Easy3 | CombinatoricsSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Recycling Bin AllocationFind the waste-to-bin assignment that needs the fewest bin changes across all surveyed cities. | Easy3 | Brute forceCombinatorics | No attempts yet | 1s | 128 MB | Judgeable |
| One Number HintImplement two fixed rules over 6-element subsets of 1 to 12: output the smallest element in S(x) missing from S(y), and answer yes when h lies in S(q). | Easy3 | CombinatoricsImplementation | No attempts yet | 1s | 256 MB | Judgeable |
| Grid Path CountCount right-and-down paths from the top-left to the bottom-right corner that pass through a given cell, if one is specified. | Easy3 | CombinatoricsDynamic programming | No attempts yet | 1s | 256 MB | Judgeable |
| Algebraic TeamworkFor each given n, count the permutations of n elements that are not idempotent modulo 1000000007. | Easy3 | CombinatoricsMath | No attempts yet | 3s | 256 MB | Judgeable |
| Tigger's bouncesCount length-K walks on an R by C grid where each step stays put or moves to a side neighbor, summed over all starts, modulo P per query. | Easy3 | Dynamic programmingCombinatorics | No attempts yet | 1s | 256 MB | Judgeable |
| Valid Parenthesis CountCount the distinct correct parenthesis strings of length L for each test case, modulo 1000000007. | Easy3 | CombinatoricsDynamic programming+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Bessie Gets EvenCount assignments of listed values to seven letters that make the product (B+E+S+S+I+E)(G+O+E+S)(M+O+O) even. | Easy3 | Brute forceCombinatorics+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Binomial Coefficient 2Compute the binomial coefficient C(N, K) modulo 10007 for N up to 1000. | Easy3 | Dynamic programmingCombinatorics | No attempts yet | 1s | 256 MB | Judgeable |
| Ascending NumbersCount length-N digit strings, leading zeros allowed, whose digits never decrease left to right, modulo 10007. | Easy3 | Dynamic programmingCombinatorics | No attempts yet | 1s | 256 MB | Judgeable |
| Bobby's BetDecide whether a bet pays off by computing the binomial chance of rolling at least R on at least X of Y rolls and comparing it to the odds W. | Easy3 | ProbabilityCombinatorics+1 | No attempts yet | 2s | 256 MB | Judgeable |
| PIN Code PossibilitiesCount n-digit codes with leading zeros allowed whose digits add up to s for each test case. | Easy3 | Dynamic programmingCombinatorics | No attempts yet | 3s | 256 MB | Judgeable |
| Safe ZoneCount the K-step walks on segments 0 to N-1 with forced turns at the ends that finish inside segments P to Q. | Easy3 | Dynamic programmingCombinatorics | No attempts yet | 1s | 256 MB | Judgeable |
| Compositions Missing a SequenceCount the ordered compositions of n that use no part from the arithmetic progression starting at m with step k. | Easy3 | Dynamic programmingCombinatorics | No attempts yet | 1s | 256 MB | Judgeable |
| Preparing a knapsack problemRead t up to 1e18 and print k = 300 with sixty 1s plus extra elements chosen by greedy binomial decomposition so exactly t subsets sum to 300. | Easy3 | CombinatoricsImplementation | No attempts yet | 1s | 32 MB | Judgeable |
| Younghoon the PranksterGiven a digit string where 1 and 6 are interchangeable and 2 and 7 are interchangeable, print its k-th candidate in lexicographic order or -1. | Easy3 | CombinatoricsString | No attempts yet | 1s | 128 MB | Judgeable |
| Polynesiaglot (Small 1)Count length-L words over C consonants and V vowels in which each consonant is directly followed by a vowel, modulo 1000000007. | Easy3 | Dynamic programmingCombinatorics | No attempts yet | 5s | 512 MB | Judgeable |
| PolynesiaglotCount length-L strings over C consonants and V vowels with no adjacent consonants and no trailing consonant, modulo 1e9+7. | Easy3 | Dynamic programmingCombinatorics | No attempts yet | 5s | 512 MB | Judgeable |
| Polynesiaglot (Large)Count length-L words over C consonants and V vowels where every consonant is followed by a vowel, modulo 1e9+7. | Easy3 | Dynamic programmingCombinatorics | No attempts yet | 5s | 512 MB | Judgeable |
| Lazy Spelling Bee (Small)Count distinct words formed by replacing each letter with itself or an adjacent letter of the target word. | Easy3 | CombinatoricsString | No attempts yet | 5s | 512 MB | Judgeable |
| PinocchioCount the ordered 4-tuples of distinct positions in S whose letters are A, C, G, T in some fixed assignment. | Easy3 | CombinatoricsMath | No attempts yet | 2s | 512 MB | Judgeable |
| ΣSum Si/Ni over M dice and print the result modulo the prime 1,000,000,007 using modular inverses. | Easy3 | MathNumber theory+2 | No attempts yet | 1s | 512 MB | Judgeable |
| DictionaryFor each of the given 9-letter permutations of a through i, report its 1-based rank in lexicographic order. | Easy3 | CombinatoricsMath+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Secret SantaFor a uniformly random permutation of N names, compute the probability that at least one resident draws their own name, rounded to 8 decimals; N can reach 10^12. | Easy3 | ProbabilityMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Recurrence sequenceCompute the n-th term of a self-convolution recurrence where t(n) sums t(i)*t(n-1-i) for i from 0 to n-1, with n up to 35. | Easy3 | Dynamic programmingMath+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Vote (Small)Given N supporters of A and M of B, find the probability that A leads after every vote in a random arrival order. | Easy3 | MathProbability+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Squares in a grid squareFor each grid side length l, count every square whose sides lie along grid lines, including tilted ones. | Easy3 | MathCombinatorics+1 | No attempts yet | 2s | 512 MB | Judgeable |
| What's Your Tier?Starting at 2000 points, play 20 games with given win, loss, and draw probabilities; compute the probability of ending in each of five tiers. | Easy3 | ProbabilityDynamic programming+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Walking to Sincheon Station, Sam (Small)Count N-digit numbers using only digits 0, 1, 2 that are divisible by 3 and have no leading zero. | Easy3 | MathBrute force+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Nemmo Nemmo (Easy)Count subsets of cells of an N by M grid, with N*M at most 25, that contain no full 2 by 2 square of chosen cells. | Easy3 | Brute forceBit manipulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Sat DownGiven your two cards, count how many of the 18 choose 2 possible opponent hands you beat, and print the win probability to three decimals. | Easy3 | Brute forceImplementation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| ElectionGiven N total votes, M counted votes split as V1 and V2, and a threshold W, decide if the probability that candidate 1 wins (when each remaining vote is a fair coin) exceeds W%. | Easy3 | ProbabilityMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Counting Domino SpotsCompute the total number of spots over all distinct unordered pairs of mark values from 0 to N. | Easy3 | MathCombinatorics | No attempts yet | 2s | 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 |
| Sejin's Group DateGiven N men and M women (M <= N), count the number of M-element subsets of men that could be paired with the women, modulo 1000000007. | Easy3 | CombinatoricsMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Sum of Subrectangle AreasFor each N, compute the total area of all axis-aligned integer subrectangles in an N by N grid. | Easy3 | MathCombinatorics | No attempts yet | 2s | 512 MB | Judgeable |
| NadanSplit K into N distinct positive integers that sum to K, and print one such distribution. | Easy3 | GreedyMath+2 | No attempts yet | 1s | 64 MB | Judgeable |
| Multinomial CoefficientGiven exponents n and m and a power k, compute the coefficient of x^k in (1+x+...+x^n)^m modulo 1,000,000,009. | Easy3 | Dynamic programmingCombinatorics | No attempts yet | 2s | 256 MB | Judgeable |
| License Plate 1Given a format string of length at most 4 with c for letter and d for digit, count plates where no two adjacent characters are identical. | Easy3 | CombinatoricsMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| License Plate 2Count strings matching a pattern of letter and digit slots, where no two adjacent characters are equal, modulo 1,000,000,009. | Easy3 | Dynamic programmingMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Fruit StealingCount the ways to distribute M identical stolen fruits among N labeled kinds so each kind receives at least one. | Easy3 | CombinatoricsDynamic programming+1 | No attempts yet | 1s | 256 MB | Judgeable |
| League of Legensal (Small)Count sequences of 1-second A casts and M-second B casts that fill exactly N seconds, modulo 1,000,000,007. | Easy3 | Dynamic programmingCombinatorics | No attempts yet | 1s | 256 MB | Judgeable |
| SapsanGiven a row of n seats split into n/2 adjacent pairs, find the largest number of occupied seats so that exactly half the seated people sit next to an occupied neighbor. | Easy3 | MathGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Pie ChartOrder class percentages around a pie chart to maximize the count of sector boundaries exactly 50% apart, forming diameter lines through the center. | Medium4 | Brute forceCombinatorics+2 | No attempts yet | 2s | 128 MB | Judgeable |
| ZooCount the ways to place non-attacking lions in a 2 by N grid so that no two lions sit in adjacent cells, modulo 9901. | Medium4 | Dynamic programmingCombinatorics+1 | No attempts yet | 2s | 128 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 |
| SoccerGiven per-interval scoring probabilities for two teams over 18 intervals, compute the probability that at least one team ends with a prime number of goals. | Medium4 | ProbabilityMath+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Similar WordsCount unordered pairs of equal-length words that are related by some bijection between letters, similar to the isomorphic-strings check. | Medium4 | StringHash map+1 | No attempts yet | 2s | 128 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 |
| Perfect Attendance AwardCount length-N attendance strings over O, L, A that have at most one L and no three consecutive A's, modulo 1,000,000. | Medium4 | Dynamic programmingString+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Permutation OrderGiven N, either compute the k-th lexicographic permutation of 1..N or find the rank of a given permutation, using factorial number system logic. | Medium4 | MathCombinatorics+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Gift ExchangeCompute the number of derangements of N items modulo 1,000,000,000. | Medium4 | Dynamic programmingMath+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Circular DanceGiven N people in a circle, compute the minimum adjacent swaps needed to reverse their order up to rotation, which reduces to a closed-form floor formula. | Medium4 | MathCombinatorics | No attempts yet | 2s | 128 MB | Judgeable |