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,020 problems
TitleLevelTopicsSolvedTime limitMemory limitJudge
Coprime Products from Six IndicesGiven N integers, count ordered 6-tuples of indices whose three pairwise products mod 359999 = 599*601 have gcd 1, modulo 1e9+7.Hard9Number theoryCombinatorics+2No attempts yet2s512 MBJudgeable
Beautiful ArchipelagoFor each queried sea level, count unordered pairs of islands (connected land regions after flooding) that are translation-equivalent in shape, over up to 1000x1000 grid and 100000 queries.Hard9Union-findHash map+1No attempts yet2s128 MBJudgeable
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.Hard9StringSorting+2No attempts yet1s128 MBJudgeable
Yin and YangOn a tree with each edge colored black or white, count paths that split at an internal vertex into two legs each having equal numbers of black and white edges.Hard9TreeDivide and conquer+2No attempts yet2s128 MBJudgeable
Accountant NotesFor each note, find every starting row in the summary file where a renamed transcription of the note appears as consecutive rows.Hard9String matchingHash map+2No attempts yet5s512 MBJudgeable
AB-wordsGiven up to 1000 nice ab-words (balanced parentheses words), count the maximum subset of pairwise non-similar words under a recursive similarity relation.Hard9TreeHash map+2No attempts yet1s128 MBJudgeable
MultiplicationGiven prime p and each query pair a and b, find the smallest k with a to the k-th power congruent to b modulo p, or print -1 when b never appears.Hard9Number theoryMath+1No attempts yet5s128 MBJudgeable
Dangerous HashingFind two distinct lowercase strings of equal length (at most 300000) that collide under ten polynomial hashes with bases 29, 31, 37, 41, 43, 47, 53, 59, 61, 67 modulo 1e9+7.Hard9MathNumber theory+2No attempts yet5s512 MBJudgeable
Bracket SubstringsCount how many distinct balanced bracket sequences appear as non-empty substrings of a given bracket string of length up to 500,000.Hard9StringHash map+2No attempts yet2s512 MBJudgeable
Sequence and queries 12Maintain a dynamic sequence under point updates, deletions, and insertions, answering range queries for distinct count and the sum of triple products of distinct values.Hard9Segment treeHash map+2No attempts yet2s512 MBJudgeable
HackerSimulate substring comparisons, substring copy from a fixed string, and range letter-increment operations on a mutable string of length N.Hard9Segment treeHash map+2No attempts yet4s512 MBJudgeable
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.Hard9StringString matching+2No attempts yet2s512 MBJudgeable
Congruence EquationCount ordered pairs (a, b) within 1 to p(p-1) whose residues satisfy a^b = b^a mod p, reducing to counting solutions of a discrete-log exponential congruence.Hard9Number theoryMath+1No attempts yet1s256 MBJudgeable
Gahui's Sequence Mod Play (Large)Maintain a stack under push and pop, and after each type 3 query report the shortest suffix whose remainders mod m cover every residue from 0 to m-1, printing -1 if impossible.Hard9StackTwo pointers+2No attempts yet1s256 MBJudgeable
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.Hard9StringString matching+2No attempts yetNot set16 MBJudgeable
Mischievous JunseokGiven a short English word and a multiset of letters, count the distinct strings obtainable from any contiguous substring with that letter multiset under the recursive half-split-and-reverse rule.Hard9Brute forceRecursion+2No attempts yet2s256 MBJudgeable
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.Hard9StringHash map+2No attempts yet20s512 MBJudgeable
DoublindromesCount distinct substrings of s that are palindromes and split into two non-empty palindromes, with length at least k.Hard9StringString matching+2No attempts yet3s512 MBJudgeable
Master Zhu and RootFor each query (x, y), find the smallest k >= 0 with x^k congruent to y modulo some prime divisor p of n, or report -1.Hard9Number theoryMath+2No attempts yet3s512 MBJudgeable
Find Marble Positions and VelocitiesReconstruct each marble's starting x-coordinate and constant velocity from N+1 unordered snapshots of N linearly moving marbles.Hard10MathCombinatorics+2No attempts yet2s128 MBJudgeable