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 results139 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Trie ShardingSplit the strings among N labeled non-empty servers to maximize the total trie node count and report the maximum and the count of optimal splits modulo 1e9+7. | Hard8 | Dynamic programmingTrie+1 | No attempts yet | 5s | 512 MB | Judgeable |
| A Lot of GamesGiven a trie of strings, play the prefix-building game k times with the loser starting next; report who wins the last game. | Hard8 | TrieGame theory+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Substring CountCount length-L lowercase strings that contain exactly C of N given words (N at most 6, L at most 50) as substrings, modulo 1,000,000,009. | Hard8 | Dynamic programmingString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Subsets whose lexicographic order matchesCount non-empty subsets of the integers from A to B whose numeric order equals their lexicographic decimal order, modulo P. | Hard8 | CombinatoricsDynamic programming+2 | No attempts yet | 8s | 512 MB | Judgeable |
| Favorite musicGiven n note strings and q pairs, find the shortest string containing both given fragments as contiguous substrings, allowing overlap. | Hard8 | String matchingTrie+2 | No attempts yet | 1s | 256 MB | Judgeable |
| ExamGiven each student's fixed semester points and a distribution of exam points, find the probability that the grade string avoids all forbidden substrings. | Hard8 | Dynamic programmingString matching+2 | No attempts yet | 1.5s | 512 MB | Judgeable |
| Dictionary GameWords are destroyed by prefix cuts; after each insertion into the dictionary, report which player wins the impartial game under optimal play. | Hard8 | Game theoryTrie+2 | No attempts yet | 5s | 512 MB | Judgeable |
| PasswordsCount length A to B alphanumeric passwords with mixed case and a digit that avoid blacklist substrings, where digits can stand in for similar letters. | Hard8 | Dynamic programmingString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Binary CodeEach of n binary words has at most one unreadable bit; decide whether the ?s can be filled so no word is a prefix of another. | Hard8 | TrieGreedy+2 | No attempts yet | 2s | 2048 MB | Judgeable |
| RhymeGiven N distinct words, find the longest sequence using each word at most once where consecutive words rhyme: their longest common suffix has length at least the longer word's length minus one. | Hard8 | StringTrie+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Standing Out from the HerdFor each name in the herd, count its substrings that occur in no other name. | Hard8 | StringString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |
| The Jet-Black WingsMaintain a multiset under global XOR updates and queries asking for the sum of the K smallest elements. | Hard8 | TrieBit manipulation+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Similar WordsGiven a set of distinct words, choose as many prefixes as possible so that no two chosen words differ by deleting one leading letter. | Hard8 | TrieTree+2 | No attempts yet | 4s | 512 MB | Judgeable |
| Prefix Suffix SearchGiven N words and Q prefix/suffix pairs, report for each query how many words match both prefix and suffix. Total input length is up to 2.5 million. | Hard8 | String matchingTrie+2 | No attempts yet | 3s | 512 MB | Judgeable |
| XOR MSTGiven N labeled vertices where the edge between any two has weight equal to the XOR of their labels, find the total cost of the minimum spanning tree. | Hard8 | TrieMinimum spanning tree+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sequence and Queries 20Maintain a multiset that starts with only 0, supporting insert, delete, and max-XOR queries where every element is XORed with x. | Hard8 | TrieBit manipulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| XOR SubmatrixBuild the N by M matrix with A[i][j] = V[i] xor U[j] and find the submatrix whose elementwise xor is maximal. | Hard8 | Bit manipulationTrie+2 | No attempts yet | 2s | 512 MB | Judgeable |
| K-th SubstringGiven a string S, answer queries that ask for the K-th distinct substring of S in lexicographic order, or -1 if it does not exist. | Hard8 | StringTrie+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Ali's TypewriterGiven a keypress sequence that builds strings in a buffer and prints them, answer queries counting how often printed string x occurs inside printed string y. | Hard8 | StringTrie+2 | No attempts yet | 1s | 512 MB | Judgeable |
| AbbreviationCount the ways to split a query string into pieces, where each piece is a prefix of some dictionary word, with duplicates counted as distinct. | Hard8 | Dynamic programmingString matching+2 | No attempts yet | 2.5s | 1024 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 |
| 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 |
| Crazy LCPGiven N strings and Q range queries, for each range [L, R] report the maximum longest common prefix over all pairs of distinct strings in that range. | Hard8 | StringTrie+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Exciting MenusGiven N strings with a joy value per position, maximize over all substrings the product of its length, the joy at its end, and the number of strings having it as a prefix. | Hard8 | TrieString+2 | No attempts yet | 4s | 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 |
| min-xorMaintain a dynamic set under insertions and deletions, and after each min-xor query report the smallest XOR of any two elements currently in the set. | Hard8 | TrieBit manipulation+2 | No attempts yet | 0.4s | 8 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 |
| 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 |
| The CodeGiven a prefix code entered via button presses, find the code words that resynchronize decoding after any loss of leading bits. | Hard9 | TrieString+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 |
| Dictionary SurveyFind how many leading pages of the integers from A to B in lexicographic order pin down both A and B. | Hard9 | TrieMath+1 | No attempts yet | 3s | 256 MB | Judgeable |
| XOR QueriesMaintain an array under appends, rollbacks of the last k elements, and range queries for max XOR, count <= x, and k-th smallest. | Hard9 | TrieSegment tree+2 | No attempts yet | 2s | 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 |
| mexAfter XORing every element of a sequence with each query value x, report the mex (smallest missing non-negative integer) of the sequence. | Hard9 | Bit manipulationTrie+2 | No attempts yet | 1s | 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 |
| Bitwise XorCount non-empty subsequences in which the pairwise xor of every two chosen elements is at least x, modulo 998244353. | Hard9 | Bit manipulationTrie+2 | No attempts yet | 2s | 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 |
| 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 |