#string-suffix-structures
CF 1387C - Viruses
CF 1387C - Viruses Rating: 2900 Tags: *special, dp, shortest paths, string suffix structures Solve time: 1m 43s Verified: no Solution Problem Understanding We are given a system where each “gene” is an integer label, and every gene greater than 1 can expand into a sequence of genes according to a fixed mutation rule. Starting from a single gene $x$, we repeatedly replace any non-terminal gene in the current sequence...
CF 906E - Reverses
CF 906E - Reverses Rating: 3300 Tags: dp, string suffix structures, strings Solve time: 4m 49s Verified: no Solution Problem Understanding We are given two strings of equal length. The first string, s , is the original string. The second string, t , is obtained after several pairwise disjoint substrings of s were reversed. The hurricane has already performed those reversals and produced t . Our task is to recover...
CF 914F - Substrings in a String
CF 914F - Substrings in a String Rating: 3000 Tags: bitmasks, brute force, data structures, string suffix structures, strings Solve time: 2m 54s Verified: yes Solution Problem Understanding We are given a mutable string and a sequence of queries. Each query either changes a character at a specific position or asks how many times a smaller string appears as a substring within a specific substring of the main string. The...
CF 1276F - Asterisk Substrings
CF 1276F - Asterisk Substrings Rating: 3400 Tags: string suffix structures Solve time: 2m 9s Verified: yes Solution Problem Understanding We are given a string s consisting of lowercase English letters, and we want to count all distinct substrings that appear in s or in any version of s where exactly one character has been replaced by an asterisk. Formally, for each position i , we define a string t_i...
CF 2038I - Polyathlon
CF 2038I - Polyathlon Rating: 2500 Tags: binary search, data structures, hashing, string suffix structures, strings Solve time: 1m 33s Verified: yes Solution Problem Understanding We are asked to simulate a multi-sport elimination competition with a twist: each participant has a binary skill vector indicating which sports they are proficient in. When a sport is played, the participants who lack skill in that sport are eliminated, provided that at least...
CF 2045H - Missing Separators
CF 2045H - Missing Separators Rating: 2200 Tags: dp, sortings, string suffix structures, strings Solve time: 1m 41s Verified: no Solution Problem Understanding We are given a single long string made by writing several unknown words one after another in alphabetical order and then removing all separators. The original structure is a dictionary: words are distinct and sorted lexicographically. Our task is to recover any valid decomposition of the string...
CF 2172H - Shuffling Cards with Problem Solver 68!
CF 2172H - Shuffling Cards with Problem Solver 68! Rating: 2500 Tags: hashing, string suffix structures, strings Solve time: 2m 18s Verified: yes Solution Problem Understanding We are given a deck of $2^k$ cards represented as a string of lowercase letters. The deck can be rotated by moving the first $m$ cards to the end. After this optional rotation, the deck is riffle-shuffled $t$ times. A perfect riffle shuffle splits...
CF 2181L - LLM Training
CF 2181L - LLM Training Rating: 2800 Tags: math, string suffix structures Solve time: 2m 24s Verified: no Solution Problem Understanding We are given several token sequences, each sequence representing a text where some positions are produced by a language model and others are written directly by a user. Only the positions marked as generated contribute to the training loss. For every generated position, the model predicts the token using...