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
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Jumping YoshiStarting from the first pebble, follow jumps allowed when two spot counts sum to their distance and report the farthest reachable pebble. | Medium6 | GraphBFS+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Loda TeleportationsGiven N strings in order, find the longest subsequence where each earlier string is both a prefix and a suffix of the later one. | Medium6 | Dynamic programmingString matching+1 | No attempts yet | 1s | 64 MB | Judgeable |
| Performance Assessment 1Find the shortest sequence over 1 to M missing as a contiguous block of A and count such sequences modulo 1e9+7. | Medium6 | String matchingHash map+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Equivalent PasswordsGiven an ordered list of short numeric passwords, find the worst-case number typed when passwords equivalent to an earlier typed one are skipped. | Medium6 | Brute forceHash map+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Multi-pianoChoose a nonnegative step K so the walk that starts at the first pitch and moves by K on each rise or fall matches the true pitches in the most positions. | Medium6 | Hash mapPrefix sum+1 | No attempts yet | 1s | 64 MB | Judgeable |
| Crime House (Large)Decide if an enter and leave log with masked identities fits a single door and find the smallest possible number of people left inside. | Medium6 | GreedySimulation+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Charging Chaos (Large)Find a bit mask applied to every outlet string that makes the outlet set match the device set with the fewest flipped bits, or report that it is impossible. | Medium6 | Bit manipulationHash map+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Professor Normal's Marble GameChildren on a grid repeatedly drop out when short on marbles, then survivors pass 12 marbles to neighbors; count the exchanges or the children who play forever. | Medium6 | SimulationQueue+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Multi-base happy numbersFor each set of bases, find the smallest integer above 1 whose repeated digit-square iteration reaches 1 in every listed base. | Medium6 | MathSimulation+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Crop Triangles (Large)Generate n points with a given recurrence and count triples whose coordinate sums are divisible by 3 on both axes. | Medium6 | MathCombinatorics+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Stone GroupsStarting from stone counts A, B, C, repeatedly double the smaller of two unequal groups and subtract it from the larger; decide whether all three can become equal. | Medium6 | BFSMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| RATS SequenceSimulate a RATS sequence term by term for up to M steps, detecting the first term that repeats an earlier value or first takes the chain form 1233*4444 or 5566*7777. | Medium6 | SimulationImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Prefix and SuffixCount the distinct substrings of S that both start with string A and end with string B, where A and B may overlap within a substring. | Medium6 | StringHash map+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Array SumReorder two arrays to make some sum value repeat as often as possible; report the maximum repeat count and the largest such sum. | Medium6 | SortingHash map+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Robert FloydStitches walks up to 2048 unit steps on a huge grid, leaving bile on each edge crossed, and you must count the regions the bile walls split the map into. | Medium6 | GeometrySimulation+1 | No attempts yet | 1.2s | 256 MB | Judgeable |
| Number of good substringsCount how many distinct substrings of s contain at most k bad letters, counting equal substrings once. | Medium6 | StringHash map+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Martian VolleyballGiven an axis-parallel polygon, find the minimum number of points outside the court such that every side has a point on its supporting line. | Medium6 | GeometryGraph+2 | No attempts yet | 1s | 512 MB | Judgeable |
| SetGiven multiset of cards, each with a count of figures (1 to 3) and a shape (circle, square, triangle), find the maximum number of disjoint triples where each characteristic is all-same or all-different. | Medium6 | CombinatoricsGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| BarbellsGiven up to 14 bars and 14 plates, find every total weight obtainable by putting plates on both sides of one bar so that the two sides balance. | Medium6 | Brute forceHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Headstrong StudentFor each fraction x/y, report how many decimal digits come before the repeating part starts and how long that repeating part is (0 if the decimal terminates). | Medium6 | MathNumber theory+2 | No attempts yet | 8s | 512 MB | Judgeable |
| Where To Go?A note string uses upper case letters and each station name uses lower case letters, so a match between them is an equality-pattern match between two windows of different alphabets. | Medium6 | StringString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Stupendous BowtiesGiven N distinct integer points, count unordered pairs of axis-aligned right triangles that share only the right-angle vertex. | Medium6 | GeometryCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| O CanadaEach move flips a 2x2 block of an N x N red/white grid. Count pairs of given grids that can reach each other by such moves. | Medium6 | Bit manipulationHash map+2 | No attempts yet | 1s | 512 MB | Judgeable |
| HackerFind the first string t such that the strings from S to t contain exactly K strings sharing t's rolling-hash value, then print those K strings. | Medium6 | Hash mapMath+1 | No attempts yet | 0.5s | 128 MB | Judgeable |
| AliensGiven N points, choose an integer axis value s minimizing new points needed so the set is symmetric about x = s/2, then output those points. Ties go to the smallest s, output sorted by x then y. | Medium6 | Hash mapSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Plane GameGiven N points, rotate and translate them arbitrarily so that as many points as possible lie on the two coordinate axes; output that maximum count. | Medium6 | GeometryBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Why Did the Cow Cross the Road 9Given a circular sequence where each cow label appears exactly twice, count pairs of cows whose chords necessarily cross. | Medium6 | ArrayHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Bovine Genomics (Gold)Given N spotted and N plain DNA strings of length M, find the shortest window of consecutive positions whose substrings separate every spotted string from every plain one. | Medium6 | StringHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Bot or notScore pairs of secondary accounts by shared posts they follow, then count accounts similar to a known human. | Medium6 | ImplementationHash map+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Nothing But The TruthGiven facts about which person was at which place and when, count how many claims in a text (who met whom, who was where) are definitely false. | Medium6 | StringIntervals+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Googlements (Small)Given a googlement G that may have already decayed, count all length-L digit strings that reach G after zero or more decay steps. | Medium6 | GraphSimulation+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Dice Straight (Small)Given N dice with six distinct faces each, find the longest run of consecutive integers you can place on top using each die at most once. | Medium6 | GreedyHash map+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Subarray XOR sumsFor a sequence, count how often each XOR value appears among all contiguous subarrays, then report the most frequent value, breaking ties by choosing the smallest. | Medium6 | Prefix sumBit manipulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Abandoned AnimalGiven each store's stock and the ordered list of purchases, count how many store assignments make store numbers nondecreasing: zero, one, or many. | Medium6 | GreedyArray+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Lemonade TradeGiven a sequence of one-way lemonade exchanges walked in order, find the maximum litres of blue obtainable starting from one litre of pink, capped at 10. | Medium6 | Dynamic programmingHash map+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Domino KillingGiven up to 100000 dominoes on a grid with orientations, count how many topple after a push using the 90-degree blocking rule. | Medium6 | SimulationHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| School PairingFor each query range, count pairs of positions whose skill grades sum to K. | Medium6 | Hash mapPrefix sum+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Jumbled passwordGiven a string, find the smallest index past the midpoint where the suffix differs from the prefix of equal length in exactly one character. | Medium6 | StringString matching+2 | No attempts yet | 0.5s | 1024 MB | Judgeable |
| Hidden HierarchyBuild a directory tree from file paths, and print the smallest set of directories (expanding or collapsing as needed) that covers every directory whose total size is at least t. | Medium6 | TreeHash map+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Card block reversalGiven a permutation of 1..N, choose one contiguous block to reverse so that the final number of positions i with card i is maximized, breaking ties by leftmost start then leftmost end. | Medium6 | ArrayHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| TataramonGiven a sequence, pick each value at most twice to maximize the sum, and among all maximum-sum picks output the lexicographically smallest subsequence. | Medium6 | GreedySorting+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Greeting CardCount how many pairs of given lattice points lie exactly 2018 units apart. | Medium6 | Hash mapMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Milk MeasurementSort the measurements by day, then count the days where the set of cows with the maximum current milk output changes after applying each update. | Medium6 | SortingHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Thinking StationFor each K from 1 to N, split the first N cars into blocks of K (dropping the remainder) and count distinct blocks up to reversal; report the K values with the maximum count. | Medium6 | StringHash map+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Adventurer on a QuestMaintain a set of completed quest numbers under insertions and range queries asking how many integers in [L, R] are not yet completed. | Medium6 | Hash mapSorting+2 | No attempts yet | 3s | 256 MB | Judgeable |
| GeneticsGiven N DNA strings of length M, find the one string that differs from every other string in exactly K positions. | Medium6 | StringBrute force+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| Array and GahuiProcess point updates on an array and after each one count index pairs whose two values have GCD greater than one. | Medium6 | Hash mapNumber theory+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Subway in SeoulGiven up to 10 subway lines, each listing stations (0 is the start), find the minimum number of transfers to reach a destination station. | Medium6 | GraphBFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| The Mirror Cat Leaves a Mirror Behind When It DiesGiven N cats in fire order, each living cat emits beams in four directions blocked by any mirror; a cat dies if hit, leaving a mirror below its cell; count survivors. | Medium6 | SimulationHash map+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| ParallelepipedGiven n rectangular sheets, pick 6 to form the faces of a rectangular box (opposite faces must match in size), maximizing the volume. Output -1 if impossible. | Medium6 | Hash mapSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Memory AllocationSimulate first-fit malloc and free over 100,000 memory cells and print requested variable values in command order. | Medium6 | IntervalsSimulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Random Index VectorsMerge two sparse signed index lists to output their element-wise sum, product, and each list rotated left by k with wraparound. | Medium6 | Two pointersHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Subprime Fibonacci SequenceGenerate terms with the divide-out recurrence and find the shortest repeating pair of consecutive terms within the first n terms, then print the cycle. | Medium6 | SimulationHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Substring PermutationGiven strings S and P, decide whether some permutation of P is a substring of some permutation of S. | Medium6 | Hash mapTwo pointers+1 | No attempts yet | 1s | 512 MB | Judgeable |
| LiarsGiven each person's claimed range for the truth-teller count, find the maximum possible number of truth-tellers within any consistent assignment. | Medium6 | Hash mapPrefix sum+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Arithmetic ProgressionsGiven up to 5000 distinct numbers, find the length of the longest subset that forms an arithmetic progression. | Medium6 | ArrayHash map+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Watch Where You StepFind the maximum number of new one-way sidewalks you can add to a zoo graph without creating any new reachability between attractions. | Medium6 | GraphBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Making a ShapeIn a grid of 0s and 1s, find the largest connected group of 1s obtainable by flipping exactly one 0 cell to 1. | Medium6 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Guess the AnimalGiven N animals and their traits, find the maximum number of yes answers Elsie can hear before her questions pin down exactly one animal. | Medium6 | ImplementationGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| ParametriziranCount pairs of equal-length words over lowercase letters and question marks that can be made identical by filling the question marks. | Medium6 | Bit manipulationHash map+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Coloring PracticeCount how many 3x3 subgrids contain exactly i black cells for each i from 0 to 9, given up to 1e5 black cells on a huge grid. | Medium6 | Prefix sumHash map+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Life in WartimeGiven N distinct cities (all below 250) in an infinite binary heap tree, count cities that either host a unit or lie on the unique path between two units. | Medium6 | TreeHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Christmalo.winGiven N short strings, pick two and a shared letter to splice their prefix and suffix, minimizing the total deleted characters. | Medium6 | StringHash map+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Count SquaresGiven coordinates of h horizontal and v vertical lines, count how many axis-aligned squares have all four sides drawn by those lines. | Medium6 | ArrayHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| TriangleGiven N plane points and Q query points, count epsilon-isosceles triangles having the query point as vertex and two distinct given points as the others, where two side lengths differ by less than 0.0001. | Medium6 | GeometryHash map+1 | No attempts yet | 2s | 512 MB | Judgeable |
| JOIOJIGiven a string of J, O, and I, find the longest contiguous substring with equal counts of all three letters. | Medium6 | Prefix sumHash map+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Beer VisionCount the nonzero shift vectors (X, Y) for which some set of stars, shifted by that vector, equals the given set of points. | Medium6 | Hash mapGeometry+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Problematic Public KeysGiven M flawed RSA-style public keys, find the prime factors of each and print all distinct primes in ascending order, five per line. | Medium6 | Number theoryMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Typo SquattingFor each domain name, count how many other given domains differ from it in exactly one character position. | Medium6 | Hash mapString+2 | No attempts yet | 4s | 512 MB | Judgeable |
| HaikuGiven a set of syllables, decide whether the three input phrases can each be split into syllables so their syllable counts are 5, 7, and 5. | Medium6 | Dynamic programmingString+2 | No attempts yet | 1s | 512 MB | Judgeable |
| One of EachGiven a sequence containing every value 1 to k at least once, find the lexicographically smallest subsequence that includes each value exactly once. | Medium6 | GreedyStack+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Firetrucks Are RedGiven sets of numbers describing each of n people, output n-1 edges (p, q, r) where r appears in both sets, so that all people end up connected, or report that this is impossible. | Medium6 | Union-findGraph+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Robot AssemblyMaintain a growing set of unions between robot parts and answer, for each query part, how many parts currently belong to its robot. | Medium6 | Union-findImplementation+1 | No attempts yet | 4s | 1024 MB | Judgeable |
| CatCount how many distinct strings you can form by joining a non-empty suffix of a with a non-empty prefix of b. | Medium6 | StringString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Triangles (Silver)Given N points, sum twice the areas of all right triangles whose legs are parallel to the axes, modulo 1e9+7. | Medium6 | MathGeometry+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Arithmetic SequencesGiven a set of distinct integers, find the size of the largest subset that can be ordered as an arithmetic sequence. | Medium6 | Dynamic programmingSorting+2 | No attempts yet | 1.5s | 512 MB | Judgeable |
| Subarray Average of a SequenceCount the contiguous subarrays of a given sequence whose elements have an average exactly equal to K. | Medium6 | Prefix sumHash map+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Two PrefixesGiven strings s and t, count distinct strings formed by concatenating a non-empty prefix of s with a non-empty prefix of t. | Medium6 | StringString matching+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Sequence RestorationReconstruct any original length-N sequence given all its overlapping length-M contiguous subsequences in arbitrary order. | Medium7 | Hash mapGraph+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Triangles in a Planar GraphCount the triangles (3-cycles) in a planar graph with up to 100,000 vertices and 300,000 edges, exploiting the sparse edge bound for efficiency. | Medium7 | GraphHash map+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Stepping-Stone Race 2Find the minimum total Euclidean jump length from the origin to any stone whose y-coordinate equals a target line, moving only between stones within dx,dy of 2. | Medium7 | Shortest pathGraph+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Counting Submatrices with Divisible SumsCount contiguous submatrices of an N by M matrix (N,M up to 256) whose sum is divisible by K, requiring an efficient prefix-sum plus hashing technique. | Medium7 | Prefix sumHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| RectangleGiven up to 1500 points, find the maximum area rectangle (not necessarily axis-aligned) whose four vertices are among the points. | Medium7 | GeometryHash map+1 | No attempts yet | 2s | 1024 MB | Judgeable |
| Median of a Contiguous SubsequenceCount odd-length contiguous subarrays of a permutation of 1..N whose median equals a given value B. | Medium7 | Prefix sumHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| The Dragon and the KnightsGiven n lines forming an arrangement with m marked points, determine whether every region of the arrangement contains at least one marked point. | Medium7 | GeometryHash map+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Size of the DictionaryCount distinct words formed as base words themselves, plus prefix-of-one-base-word concatenated with suffix-of-another-base-word combinations. | Medium7 | TrieString matching+1 | No attempts yet | 2s | 128 MB | Judgeable |
| High SecurityGiven up to 50000 length-5 passwords over 62 characters, count pairs of passwords for each Hamming distance from 0 to 5. | Medium7 | StringCombinatorics+2 | No attempts yet | 3s | 256 MB | Judgeable |
| KINA Is Not AbbreviationGiven a text, find the abbreviation (initials of a consecutive word window) that is unambiguous per the stated rules and maximizes letter-count reduction, breaking ties lexicographically. | Medium7 | String matchingHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| AmbiguousSplit a scrambled, space-free string into a unique sequence of dictionary words matching letter multisets, first and last letters, reporting ambiguity or impossibility. | Medium7 | Dynamic programmingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Find the MultiplesCount index pairs (i,j) with a_i nonzero such that the decimal number formed by a_i...a_j is divisible by a given prime Q, for a pseudo-randomly generated digit sequence of length up to 1e5. | Medium7 | MathHash map+2 | No attempts yet | 2s | 128 MB | Judgeable |
| HyperdromeCount substrings of S whose characters can be rearranged into a palindrome, where only the parity of each letter's count matters. | Medium7 | Bit manipulationPrefix sum+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Cut It Out!Given n triangular holes and 2n smaller triangles produced by splitting each hole along a cevian, match the two pieces to each hole using side lengths and angles. | Medium7 | GeometryHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| We've Got Chemistry, BabeParse chemical formulas into atom counts, then find positive integer coefficients with gcd 1 that balance the reaction, or report that none or many exist. | Medium7 | MathNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Mastermind: The Best Next GuessGiven prior Mastermind guesses and their black/white peg counts, find the guess that minimizes the largest group of codes still consistent with each possible response. | Medium7 | Brute forceSimulation+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Life FormsGiven up to 100 DNA strings, find every longest contiguous substring that appears in strictly more than half of them, printed in alphabetical order. | Medium7 | StringBinary search+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Eventually Periodic SequenceGiven N, a start n, and a function f written in postfix, follow the iteration x -> f(x) mod N and report the length of its eventual cycle. | Medium7 | MathSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Help!Given two patterns of literal words and named placeholders, find the lexicographically smallest word phrase matching both, or output a minus sign if none exists. | Medium7 | StringHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Edit Step LaddersGiven a lexicographically sorted dictionary, find the longest sequence of words where each consecutive pair differs by one insertion, deletion, or substitution, and the sequence follows dictionary order. | Medium7 | Dynamic programmingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Blenjeel Sand Worms and Color WrigglesA snake of n cells starts filling the left column of an n by m colored grid and must reach the right column, moving one end per wriggle, always keeping n distinct-colored cells; find the minimum number of wriggles. | Medium7 | BFSSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| BeadsGiven two 13-bead rings, each with 13 gray and 13 yellow beads, find the fewest swaps of a 3-bead block between the rings to put all gray on top. | Medium7 | BFSString+2 | No attempts yet | 1s | 128 MB | Judgeable |