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 |
|---|---|---|---|---|---|---|
| Hidden CodesGiven code words and a long text, choose non-overlapping covering sequences, each at most 1000 long, maximizing the total length of the code words used. | Medium7 | Dynamic programmingString matching+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Walk the TalkCount the number of distinct monotone paths (only right and/or up hops) through an H by W letter grid whose visited letters spell one of N given words. | Medium7 | Dynamic programmingTrie+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cow PatternsFind every length-K window of a spot-count sequence whose relative order matches a given rank pattern. | Medium7 | String matchingSliding window+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Wiping WordsRepeatedly blank out any word whose column has no support in the next line, or that appears in the last line, until no more words can be wiped. | Medium7 | SimulationImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Serial NumbersGiven up to 10 forbidden digit substrings, find the b-th smallest positive integer whose decimal form contains none of them as a substring. | Medium7 | Dynamic programmingString matching+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TemplateFind a template whose overlapping occurrences cover every position of S, minimizing the template length. | Medium7 | StringString matching+1 | No attempts yet | 3s | 128 MB | Judgeable |
| VirusesGiven a set of forbidden binary words, decide whether an infinite binary sequence exists that avoids all of them as contiguous substrings. | Medium7 | String matchingTrie+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Word EqualizingAppend the given words to x and y any number of times to make them equal, and output the minimum total number of appends, or NIE if impossible. | Medium7 | StringGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Even Palindrome DecompositionDecide whether a string can be split entirely into even-length palindromes, and if so report the minimum and maximum number of parts. | Medium7 | Dynamic programmingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| PalindromesGiven n distinct palindromes, count ordered pairs whose concatenation is also a palindrome, with total length up to 2,000,000. | Medium7 | StringHash map+2 | No attempts yet | 5s | 256 MB | Judgeable |
| Algorithm SpeedupDecide whether a recursively defined Boolean function F on two sequences returns 1 or 0, where F strips the longest prefix and suffix that drop some value. | Medium7 | RecursionHash map+2 | No attempts yet | 8s | 128 MB | Judgeable |
| Error CorrectionGiven letter-to-bits codebook and binary strings, decide if exactly one letter sequence encodes to within one bit flip. | Medium7 | Dynamic programmingString matching+1 | No attempts yet | 1s | 128 MB | Judgeable |
| EraserPick the alphabetically last name that appears as a subsequence in every scrap and keep bitek when nothing later exists. | Medium7 | GreedyString matching | No attempts yet | 1s | 512 MB | Judgeable |
| Substring DrawTwo slips are drawn without replacement from all position-counted substrings of a word, and the tie probability is printed as a reduced fraction. | Medium7 | String matchingCombinatorics+1 | No attempts yet | 1s | 128 MB | Judgeable |
| PatternCount the positions in the text where the pattern matches when every letter is repeated the same number of times. | Medium7 | String matchingTwo pointers+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Lottery TicketsCount numbers from 0 to M-1 whose zero-padded decimal form matches Z in some length-r block at the same positions. | Medium7 | Dynamic programmingString matching | No attempts yet | 1s | 128 MB | Judgeable |
| Suffix ArrayRead a lowercase string of length up to 500000 and print its suffix array and LCP array, writing x for the first LCP entry. | Medium7 | String matchingSorting | No attempts yet | 3s | 256 MB | Judgeable |
| Longest Common SubstringFind the length of the longest substring shared by two lowercase strings and print the lexicographically smallest one of that length. | Medium7 | String matchingBinary search+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Goguryeo and the Crown PrinceGiven two different binary strings of equal length, compute the probability that the first appears before the second in fair coin flips. | Medium7 | String matchingProbability | No attempts yet | 1s | 128 MB | Judgeable |
| Probability ParadoxTwo players each pick a coin-flip pattern and the program computes the chance the first pattern appears before the second. | Medium7 | ProbabilityString matching+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Decoding the HallwayFor each query, decide whether the given string appears as a contiguous substring of the turn record built after n hallway walks. | Medium7 | StringRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Secret MessageCount the operation sequences that build the given string by repeatedly prepending or appending a proper prefix or suffix. | Medium7 | Dynamic programmingString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| PalindromeFind the palindromic substring that maximizes its length times its number of occurrences in the given string. | Medium7 | String matchingString | No attempts yet | 2s | 128 MB | Judgeable |
| PasswordCount length-N strings over the first K uppercase letters that avoid ABCBC and ABABC as substrings, modulo 1,000,000,009. | Medium7 | Dynamic programmingString matching | No attempts yet | 1s | 256 MB | Judgeable |
| Circle of digitsSplit the circular digit string into K contiguous parts so the largest part value is as small as possible, and output that value. | Medium7 | Binary searchDynamic programming+1 | No attempts yet | 5s | 256 MB | Judgeable |
| Best PositionFor each binary blueprint, find the placement with the most matching cells, tie-broken by row then column, and report the grain and livestock counts. | Medium7 | String matchingMatrix+1 | No attempts yet | 10s | 256 MB | Judgeable |
| Repeated Substring CountCount the distinct substrings that occur at least twice in each string of up to 100000 letters. | Medium7 | String matchingString | No attempts yet | 5s | 256 MB | Judgeable |
| Playing with GeometryDecide whether two rectilinear polygons reduce to the same permutomino after deleting empty grid lines and rotating by multiples of 90 degrees. | Medium7 | GeometryString matching+1 | No attempts yet | 1s | 256 MB | Judgeable |
| The Big PictureCount the top-left positions where the given black-and-white painting matches the masterpiece exactly without rotation. | Medium7 | String matching | No attempts yet | 2s | 512 MB | Judgeable |
| Barbarian TabletsEach query asks how many words shown so far contain the tablet word of barbarian S as a contiguous substring. | Medium7 | String matchingTrie | No attempts yet | 4s | 768 MB | Judgeable |
| CensoringRepeatedly delete the leftmost occurrence of any of N forbidden words from string S until none remains and print the result. | Medium7 | String matchingStack+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Typing monkeyGiven per-letter probabilities and two words P and Q, compute the probability that P appears as a substring before Q does. | Medium7 | ProbabilityString matching+1 | No attempts yet | 1s | 256 MB | Judgeable |
| String GameFor each game, decide if Alice wins when both players alternately delete the first or last letter until the string matches the target length. | Medium7 | Game theoryString matching+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Number of distinct substrings 2Count how many different contiguous substrings appear in the given lowercase string of length up to 1,000,000. | Medium7 | String matchingSorting+1 | No attempts yet | 5s | 256 MB | Judgeable |
| CLARKSONSplit the lyrics into consecutive parts that each appear in the script and maximize the shortest part length. | Medium7 | String matchingBinary search+1 | No attempts yet | 1s | 256 MB | Judgeable |
| OOPCount for each pattern with one asterisk how many given words equal it after replacing the asterisk with any string, possibly empty. | Medium7 | String matchingHash map+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Lights Out in the BarnFor each polygon vertex, walk clockwise until angles and edge lengths reveal the start, then report the worst extra distance versus the shortest exit path. | Medium7 | String matchingSimulation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Garbled EmailSplit the garbled string into dictionary words with changed letters spaced at least 5 apart while changing as few letters as possible. | Medium7 | Dynamic programmingTrie+1 | No attempts yet | 60s | 512 MB | Judgeable |
| Box Factory (Large)Match boxes and toys of equal type in order on run-length encoded lines to maximize the number of pairs. | Medium7 | Dynamic programmingString matching | No attempts yet | 5s | 512 MB | Judgeable |
| Selling RNA StrandsFor each query pair P, Q, count how many dictionary strings start with P and end with Q, where the prefix and suffix may overlap. | Medium7 | TrieString matching | No attempts yet | 2s | 1536 MB | Judgeable |
| PasswordGiven finishes over N years, find the lexicographically largest password substring allowed by rules and count its occurrences. | Medium7 | ArrayString matching+1 | No attempts yet | 4s | 256 MB | Judgeable |
| Suffix array 2Sort all suffixes of a string lexicographically and output the starting index of each suffix in sorted order. | Medium7 | StringSorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Stair Climbing WorkoutCount length-N balanced U/D walk strings (never going below 0, ending at 0) that contain a given piece as a contiguous substring. | Medium7 | Dynamic programmingCombinatorics+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Easy ReadingGiven a book text and a picture of painted cells, find the shortest prefix-contiguous text segment whose pen strokes draw exactly that picture up to translation. | Medium7 | String matchingHash map+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Chameleon SubstringGiven a string S, find the longest substring that is both a prefix and a suffix of S and also appears somewhere strictly inside S. | Medium7 | String matchingString+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Prefix and SuffixFor each prefix of S that is also a suffix, output its length and how many times it occurs as a substring. | Medium7 | String matchingPrefix sum+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Strings and QueriesFor a string S, F(i) is the length of the longest common suffix of S and the prefix of S ending at position i; answer M queries for F(i). | Medium7 | StringString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Forest University (Small)Count the fraction of topological orderings of a tiny rooted forest whose label string contains each given cool word as a substring, printed as an irreducible fraction. | Medium7 | Dynamic programmingTopological sort+2 | No attempts yet | 100s | 512 MB | Judgeable |
| Longest Palindromic SubstringGiven a lowercase string of up to 100,000 characters, report the length of its longest palindromic substring. | Medium7 | StringString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Looping PlaylistGiven a circular sequence of N notes, each song is a maximal run whose notes fit one major scale and has at least two notes; find the minimum number of songs covering the loop. | Medium7 | GreedyString matching+2 | No attempts yet | 1.5s | 512 MB | Judgeable |
| Reverse and RejoinSplit a fixed sequence into two non-empty parts, reverse each part, and print the lexicographically smallest result among all split positions. | Medium7 | ArrayString matching+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Separate StringCount the ways to split string t into a sequence of pieces, each of which is one of N given dictionary strings, modulo 1e9+7. | Medium7 | Dynamic programmingTrie+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Prefix Free CodeGiven n prefix-free strings, rank a given concatenation of k of them among all ordered k-selections sorted alphabetically, modulo 1e9+7. | Medium7 | TrieCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| A Very Nasty Graph ProblemBuild the lexicographically smallest de Bruijn sequence of order N over two symbols, a shortest binary string containing every N-bit number. | Medium7 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Repeated PatternAppend at most K letters to S so it becomes repetitions of one word, and output the longest possible word length (at most N), or 0. | Medium7 | String matchingString+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Selling RNA StrandsGiven N RNA strings, answer M queries that count strings matching a prefix P and suffix Q. | Medium7 | String matchingHash map+2 | No attempts yet | 1.5s | 1536 MB | Judgeable |
| Longest Common SubstringGiven up to 10 lowercase strings, each up to 100,000 characters, find the length of the longest substring shared by all of them. | Medium7 | StringBinary search+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Contiguous Repeated StringGiven string S and k, choose k appended characters so that the resulting string has the longest substring of the form TT (a block repeated twice back to back), and report that length. | Medium7 | StringBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Beer MugsGiven a string of N characters over 20 brands, find the longest substring that is a palindrome after permuting it freely. | Medium7 | Bit manipulationHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Palindrome SentencesGiven up to 13 distinct words, count ordered arrangements of a subset of them whose concatenation without spaces forms a palindrome. | Hard8 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Count Palindromic Word SequencesCount ordered sequences of given words, space-joined, whose concatenation (ignoring spaces) is a palindrome of length at most K, modulo a prime. | Hard8 | Dynamic programmingString matching+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Merge WordsGiven up to 12 uppercase words, find the shortest string containing all of them as substrings, breaking ties by lexicographic order. | Hard8 | Dynamic programmingBit manipulation+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Number ConcatenationGiven a subsequence left after deleting digits from the concatenation of 1,2,...,N, find the smallest N that could produce it. | Hard8 | String matchingBinary search+2 | No attempts yet | 2s | 128 MB | Judgeable |
| LaserCount primitive direction vectors (a,b) with max(a,b) <= K whose periodic grid-wraparound character string contains each given word as a substring. | Hard8 | Number theoryMath+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Palindrome EncodingGiven a binary string, repeatedly delete the second half of any even-length palindromic substring and find the minimum length achievable. | Hard8 | Dynamic programmingString+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Partial DNA SubstringsGiven a DNA string, count distinct substrings occurring at least m times and find the K-th one under length-then-lex order. | Hard8 | String matchingBinary search+1 | No attempts yet | 2s | 16 MB | Judgeable |
| Compressing a StringFind the minimum length of a string obtained by optimally applying nested k(S) run-length style compression to a given lowercase string of length up to 200. | Hard8 | Dynamic programmingString+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Binary Sequence RotationGiven the last column of a sorted matrix of all circular rotations of an unknown binary string, reconstruct the lexicographically smallest rotation (first row) or report impossibility. | Hard8 | String matchingSorting+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Square-Substring-Free NumberGiven N up to 10^18, find the smallest number at least N whose decimal representation contains no perfect square as a substring. | Hard8 | Dynamic programmingString matching+1 | No attempts yet | 1s | 1024 MB | Judgeable |
| Easy Group MatchingGiven a text sequence and two patterns, count group-matching positions for each pattern, then find the smallest integer n that maximizes group matches for the concatenated pattern P1·n·P2 and report that count. | Hard8 | Dynamic programmingPrefix sum+1 | No attempts yet | 30s | 1536 MB | Judgeable |
| Balanced Bracket SegmentMaintain a dynamic string under prefix/suffix bracket insertions and after each insertion report the shortest valid contiguous bracket substring covering the new character. | Hard8 | StackString matching+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Martian DNA FormulaCompress a DNA string into the shortest possible run-length style notation using nested parentheses with repeat counts. | Hard8 | Dynamic programmingString+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Logo MatchingGiven a permutation pattern of length n and a sequence of m distinct heights, find all starting positions where a length-n window matches the relative order pattern. | Hard8 | String matchingArray+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Vigenère Cipher AnalysisDetermine, for each candidate Vigenère key length up to K, whether the unique decrypted plaintext contains two given cribs at non-overlapping positions, and report the plaintext, ambiguous, or impossible. | Hard8 | String matchingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Unchanged PictureDetermine whether two plotter-drawn vector pictures are geometrically similar under translation, rotation, and uniform scaling but no mirroring. | Hard8 | GeometryString matching+1 | No attempts yet | 5s | 128 MB | Judgeable |
| BundlingGiven permitted bundle templates and a dependency chain among instructions, compute the minimum number of bundles to pack the sequence and, among those, the minimum number of stops needed. | Hard8 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Secret Code: Largest NumberGiven a noisy string, find the largest decimal number it could decode to, either fixing one language for all digits or allowing a different language per digit, using digit-word subsequence matching. | Hard8 | Dynamic programmingString matching+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Term GeneratorParse a formula, convert it to a normal form by expanding nested sums and products according to given rewriting rules, then implement a cyclic generator that outputs requested numbers of terms, some possibly skipped without printing, based on huge signed counters. | Hard8 | String matchingRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Proof GeneratorConvert a logical formula to a canonical disjunctive normal form using given rewrite rules, then cyclically output the k-th next satisfying terms under given axioms for a sequence of queries. | Hard8 | String matchingRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Software Industry RevolutionGiven a wildcard pattern (with ? and *) and a text, find the minimum-complexity substring of the text that matches the whole pattern, or report impossible. | Hard8 | String matchingDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Stammering AliensGiven a string and a minimum repeat count m, find the longest substring occurring at least m times (overlaps allowed), breaking ties by rightmost starting position, using suffix array or suffix automaton techniques. | Hard8 | String matchingBinary search+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Using sedFind the minimum number of sed-style leftmost non-overlapping replacement operations needed to turn one small string into another, given up to 10 rewrite rules. | Hard8 | BFSString matching+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Keyword SearchGiven up to 12 base strings, count positions in a text where some permutation-concatenation of all base strings occurs as a substring, treating duplicate resulting strings once. | Hard8 | String matchingBit manipulation+2 | No attempts yet | 10s | 128 MB | Judgeable |
| Fibonacci WordGiven a bit pattern p and an index n up to 100, count the possibly overlapping occurrences of p inside the Fibonacci word F(n), whose length grows exponentially. | Hard8 | String matchingDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Intellectual PropertyGiven two code bases as raw strings, find the k longest maximal substrings of the JCN base that also occur in the TDP base, with exact positions and lengths. | Hard8 | String matchingSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Tail PalindromeGiven two lowercase strings a and b, find the shortest string x such that exactly one of ax, bx is a palindrome, and among ties the lexicographically smallest x. | Hard8 | StringString matching+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SpaghettiDecide whether two labeled Fortran IV programs run the same sequence of statements for every input, ignoring unconditional gotos and labels. | Hard8 | GraphImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Fill the CrosswordFill a crossword grid with a given word list so every slot holds a listed word exactly once and crossings match; also decide if no solution exists. | Hard8 | BacktrackingTrie+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Crosswords InsiderGiven a list of words and a crossword grid template, decide whether each word can fill one run of empty cells and output the lexicographically smallest filled grid. | Hard8 | BacktrackingSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Pattern MatchingDecide whether digit sequences match patterns where digits match exactly and * and # stand for even and odd counts of arbitrary digits. | Hard8 | Dynamic programmingString matching | No attempts yet | 1s | 128 MB | Judgeable |
| Alpha of Degree kGiven a dictionary, answer queries asking for the shortest chain from word s to word t where each step shares a suffix-prefix overlap of length at least k, with a cap on chain length. | Hard8 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| City MergerGiven up to 14 uppercase city names, find the length of the shortest string that contains every name as a consecutive substring, allowing overlaps. | Hard8 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Name the CrossingGiven named crossings of orthogonal streets, infer an equal-strength and stronger-than relation between streets, then answer whether each queried crossing name is valid. | Hard8 | GraphUnion-find+2 | No attempts yet | 1s | 128 MB | Judgeable |
| InsecurityGiven a hexadecimal bitstring and lists of usernames and passwords, find which username concatenated with which password encrypts to that string under a growing left-shift XOR scheme. | Hard8 | Bit manipulationBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Balanced Garden in a RowCount balanced binary strings of length N whose every substring has at most two more L than P, and find the lexicographic rank of a given string modulo M. | Hard8 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Zigzag NumbersCount numbers in [A, B], up to 500 digits, that are divisible by M and whose adjacent digit comparisons alternate up then down. | Hard8 | Dynamic programmingMath+2 | No attempts yet | 2s | 128 MB | Judgeable |
| File SearchCount how many non-empty subsets of the files can be exactly the result set of some substring query. | Hard8 | StringTrie+2 | No attempts yet | 5s | 128 MB | Judgeable |
| File RecoverCount the distinct contiguous substrings that occur at least twice in a given string, for several test cases up to 100000 characters each. | Hard8 | StringString matching+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Ambiguous CodesDecide whether a set of hexadecimal code words is ambiguous, and if so report the length of the shortest message with two distinct decodings. | Hard8 | StringGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Milk PatternsGiven N integers, find the length of the longest contiguous subsequence that repeats at least K times, counting overlapping occurrences. | Hard8 | String matchingBinary search+2 | No attempts yet | 1s | 128 MB | Judgeable |