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 results457 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| ICPCConcatenate all lowercase words of length 1 through N in length-then-alphabetical order; count occurrences of the substring "icpc" modulo 1e9+7, with N up to 1e9. | Hard8 | CombinatoricsString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |
| K==SCount sequences of length N over 26 letters that avoid any of Q given forbidden strings as contiguous substrings, modulo 1e9+7, where N can be up to 1e9. | Hard8 | String matchingDynamic programming+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Ambiguous EncodingGiven a set of distinct binary codewords, decide whether two different character sequences can encode to the same bit string, and if so print the length of the shortest such string. | Hard8 | String matchingBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Fantastic FožgajCount length-m lowercase strings over 26 letters that avoid any of n forbidden patterns as a substring, modulo 1e9+7, with m up to 1e9. | Hard8 | Dynamic programmingString matching+2 | No attempts yet | 1.5s | 512 MB | Judgeable |
| Banned WordsCount length-L strings over 26 letters avoiding a given set of banned substrings, modulo 998244353, with L up to 1e9. | Hard8 | String matchingTrie+2 | No attempts yet | 2s | 512 MB | Judgeable |
| TrenerCount ways to pick one surname from each length bucket so every shorter surname is a substring of every longer one, modulo 1e9+7. | Hard8 | StringDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Searching for StringsCount how many distinct permutations of the needle string N occur as a contiguous substring of the haystack string H. | Hard8 | Sliding windowString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Heavy BurgerMaintain a string of parentheses under range flips, and for each query on a substring report the minimum number of characters to insert so the substring becomes a balanced parenthesis sequence. | Hard8 | Segment treeString matching+2 | No attempts yet | 3s | 1024 MB | Judgeable |
| Shom CodeGiven binary codes assigned to up to 26 letters, find the minimum length of a binary string decodable as three or more distinct letter sequences, or -1 if none exists. | Hard9 | TrieBFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Hard MatchingGiven a text sequence and two number patterns, count positions where consecutive-sum grouping matches each pattern, then find the smallest glue value x maximizing matches of the concatenated pattern with x inserted between them and report that match count. | Hard9 | String matchingPrefix sum+2 | No attempts yet | 30s | 1536 MB | Judgeable |
| Casting SpellsGiven a string, find the maximum length of a substring of the form ww^R w w^R (a palindrome ww^R followed immediately by itself) across up to 40 large test cases. | Hard9 | String matchingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| OutsourcingGiven two directed labeled graphs (factories) with start and final nodes, decide whether the two sets of label sequences realizable as paths from start to final are identical. | Hard9 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Old MemoriesGiven pieces of an original text and an altered copy with at most d edits, list all original strings whose edit distance to the copy is at most d and where every position lies inside some piece occurrence. | Hard9 | String matchingDynamic programming+2 | No attempts yet | 10s | 128 MB | Judgeable |
| ContactGiven a binary string and a length range [A,B], report the N largest occurrence counts and all patterns achieving each count, with output ordering rules. | Hard9 | StringSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| JukeboxEach song has a title and artist; decide which artist fields to drop so the total length of shortest unique substrings over all title and remaining artist strings is minimized. | Hard9 | StringBrute force+2 | No attempts yet | 3s | 128 MB | Judgeable |
| ExamGiven each student's distribution over exam scores, find the exact probability that the sequence of European marks from all students avoids every listed unpleasant string. | Hard9 | Dynamic programmingString matching+2 | No attempts yet | 2s | 128 MB | Judgeable |
| PurifyRepeatedly delete forbidden substrings from P, always choosing the earliest-ending occurrence and removing the shortest such forbidden word, then print what remains. | Hard9 | StringTrie+2 | No attempts yet | 1s | 64 MB | Judgeable |
| Accountant NotesFor each note, find every starting row in the summary file where a renamed transcription of the note appears as consecutive rows. | Hard9 | String matchingHash map+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Axes of SymmetryFor each simple polygon, count its axes of symmetry; n can reach 100000, so the check must run in near-linear time. | Hard9 | String matchingGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Isles in a Triangular GridEnumerate all non-congruent triangular-grid isles of up to ten triangles, canonicalizing each by the lexicographically smallest clockwise boundary-turn word. | Hard9 | GeometryBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| HamstersFind the shortest lowercase string containing at least m occurrences of the given hamster names, counted with multiplicity. | Hard9 | String matchingDynamic programming+2 | No attempts yet | 3s | 512 MB | Judgeable |
| PeriodicityFor each name, find the lexicographically smallest bit string of the same length whose set of periods equals the name's set of periods, or XXX if none exists. | Hard9 | StringPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Computational BiologyFor each query length m, find a length-m word whose every cyclic rotation appears in s, maximizing the total count of those rotations in s. | Hard9 | StringSorting+2 | No attempts yet | 5s | 128 MB | Judgeable |
| FragmentsCount how many times each digit string appears as a contiguous substring across the decimal forms of all numbers in a union of disjoint integer intervals up to 10^18. | Hard9 | String matchingDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Quasi-templateCount the distinct words that, as substrings of v with possibly overhanging copies, can tile across the whole input; report the count and the shortest, lexicographically smallest such word. | Hard9 | String matchingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Fibonacci WordCount occurrences of a given binary pattern in the Fibonacci word F_m and count distinct subwords occurring at least that many times, mod 20062006, with m up to 1e9. | Hard9 | StringDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Prefix-SuffixesCount proper borders summed over all substrings of a given lowercase word of length up to 10^5. | Hard9 | String matchingString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Palindromic EquivalenceCount words of the same length that have palindromic substrings at exactly the same positions as the given word. | Hard9 | StringString matching+2 | No attempts yet | 1s | 128 MB | Judgeable |
| PuzzleBuild the longest string over the first n capital letters that avoids all forbidden substrings, or print No when no maximum exists. | Hard9 | String matchingTrie+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Dragon PatternCount how many times pattern S appears as a contiguous block in the length 2^n direction string of the order-n left dragon curve. | Hard9 | String matchingRecursion+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Expression and SubstringFind the shortest string that matches the given regular expression and contains S as a substring, breaking ties by lexicographic order. | Hard9 | Shortest pathGraph+1 | No attempts yet | 10s | 256 MB | Judgeable |
| Same Suffix ArrayCount the strings that differ from the given length N string in exactly one position and keep the same suffix array. | Hard9 | StringString matching+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Counting StringsCount strings over the lowercase alphabet whose length lies between L*K and L*K+N and in which at most K non-overlapping copies of a given pattern S can be found. | Hard9 | Dynamic programmingString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Bracket SubstringsCount how many distinct balanced bracket sequences appear as non-empty substrings of a given bracket string of length up to 500,000. | Hard9 | StringHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| HackerSimulate substring comparisons, substring copy from a fixed string, and range letter-increment operations on a mutable string of length N. | Hard9 | Segment treeHash map+2 | No attempts yet | 4s | 512 MB | Judgeable |
| Distinct Substring QueriesMaintain a string under push-back and pop-front operations, reporting the number of distinct substrings after each of up to a million queries. | Hard9 | StringString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Incremental Double Free StringsFind the nth string of length k(k+1)/2 that uses one letter j times for each j up to k and has no two equal adjacent letters, in alphabetical order. | Hard9 | CombinatoricsDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Tarot Sham BoastGiven up to 10 equal-length strings over {R,P,S} and a length n random string, sort the strings by the probability each occurs as a contiguous block. | Hard9 | String matchingProbability+2 | No attempts yet | 2s | 512 MB | Judgeable |
| PseudoknotFind the largest t such that the string splits into u v z^R u^R y z with |u|>=t and |z|>=t, or report -1 if no such split exists. | Hard9 | StringString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |
| IntuidiffFind the minimum number of blocks, each a substring of the first string or a single new character, whose concatenation equals the second string. | Hard9 | String matchingGreedy+2 | No attempts yet | 7s | 512 MB | Judgeable |
| Crazy RotationsGiven a row of coloured lights, find the smallest rotation amount that can appear at position p in a non-decreasing sequence of rotation craziness values. | Hard9 | String matchingCombinatorics+2 | No attempts yet | 15s | 512 MB | Judgeable |
| KabobsCount length-K strings over the given alphabet that satisfy all substring-implication rules of the form b>e, modulo 10^7. | Hard9 | Dynamic programmingString+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Want to solve a problem?For given K and C, choose A > 0 to maximize the characters saved by writing K+A repeated K+A times instead of K repeated K times, minus C times A. | Hard9 | String matchingMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| MessageCount length-n lowercase strings that contain a given pattern p as a substring, modulo m, where n can reach 10^12 and p has length at most 50. | Hard9 | Dynamic programmingString matching+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Beautiful ManyeongroCount directed paths in a rooted tree whose edge-label string equals a given pattern P. | Hard9 | TrieDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Parameterized Pattern MatchingFind every substring of text T that p-matches pattern P, where parameter names must correspond under a bijection and tokens match exactly. | Hard9 | StringString matching+2 | No attempts yet | Not set | 16 MB | Judgeable |
| Sequence and Queries 34Maintain two integer sequences under updates and range queries: for a suffix of a compute the longest match against b and how many suffixes achieve it, compare suffixes of b, and test whether a concatenation of two b-substrings is itself a substring of b. | Hard9 | String matchingSegment tree+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Speed Reading CourseCount how many positions i where c contains the given m-bit word w, with c defined by an arithmetic progression modulo n against threshold p. | Hard9 | Number theoryString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |
| String AlgorithmFor every k, cut s into blocks of length k, discard the tail, and count block pairs whose Hamming distance is at most one. | Hard9 | StringHash map+2 | No attempts yet | 20s | 512 MB | Judgeable |
| AdditionDesign a short string-rewriting script in a custom language that reads two binary numbers joined by + and rewrites them into their binary sum. | Hard9 | String matchingSimulation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| DoublindromesCount distinct substrings of s that are palindromes and split into two non-empty palindromes, with length at least k. | Hard9 | StringString matching+2 | No attempts yet | 3s | 512 MB | Judgeable |
| JokeGiven a text and up to ten patterns with per-letter erasure costs, delete letters so that no pattern occurs, minimizing total cost. | Hard9 | String matchingDynamic programming+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Flip a CoinTwo players each pick a heads/tails string of length up to 20; a fair coin is flipped until one or both strings appear, and we must output the probabilities of Alice winning, Bob winning, and a tie. | Hard9 | ProbabilityDynamic programming+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Jong Hyok and StringGiven n pattern strings, for each query string Q count the substrings T of the patterns with the same set of (pattern, end position) occurrence pairs as Q. | Hard9 | StringTrie+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Right Expansion Of The MindGroup n infinite strings, each formed by a finite prefix s followed by repeats of t, so that within each group every pair is mutually a subsequence of the other; minimize the number of groups. | Hard9 | StringString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Fibonacci Digit CountCount occurrences of the substring "11" within the first N characters of the infinite string formed by writing 1, 2, 3, ... in Fibonacci (Zeckendorf) representation. | Hard9 | MathDynamic programming+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| String Palindrome QueriesMaintain a lowercase string under block moves, reversals, and single-character insertions, answering after each change whether a given substring reads the same forwards and backwards. | Hard10 | StringString matching+1 | No attempts yet | 2s | 256 MB | Judgeable |