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,800 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| DictionaryFor each of the given 9-letter permutations of a through i, report its 1-based rank in lexicographic order. | Easy3 | CombinatoricsMath+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Thief of the Circular VillageCount the starting positions of a circular window of M houses whose total amount stays below K. | Easy3 | Sliding windowPrefix sum+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Turing machine halting in ten stepsSimulate a Turing machine for at most 10 steps on each query tape and report whether it reaches the halting state. | Easy3 | SimulationImplementation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Strategy GameDistribute J times R point values to players in turn order, sum each player's points, and find the highest scorer, breaking ties by last move. | Easy3 | ArraySimulation | No attempts yet | 1s | 512 MB | Judgeable |
| Formula 1 World ChampionGiven each driver's finishing place in every race, compute total points under several scoring systems and print the champion(s), breaking ties by listing all joint champions. | Easy3 | ImplementationArray+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Card TradeGiven two sorted card piles, find the largest N such that Alice and Beatriz can each give away N cards of distinct kinds that the other does not own. | Easy3 | Two pointersArray+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Peaks of a Musical LoopCount local maxima and minima in a circular sequence of samples where consecutive values differ and the first and last differ. | Easy3 | ImplementationArray+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Averages in PlaceGiven N, print the one fixed N x N table whose row and column averages each land inside their own row and column, with -1 for N=2. | Easy3 | ImplementationMath+2 | No attempts yet | 1s | 64 MB | Judgeable |
| The Calculus of AdaGiven n values of a polynomial at evenly spaced inputs, find the degree of the minimal-degree polynomial and its value at the next input using finite differences. | Easy3 | MathImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Hyper Rock-Scissors-PaperGiven each player's gesture in a 15-gesture rock-paper-scissors variant, find the single gesture that beats at least one shown gesture and loses to none, or report Draw. | Easy3 | ImplementationArray+2 | No attempts yet | 8s | 512 MB | Judgeable |
| Sum of Pairwise ProductsGiven N integers, sum the products of every pair of distinct positions. | Easy3 | MathArray+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Small Weird MeasurementsCount the subarrays in which the signs of consecutive differences strictly alternate (length 1 counts, equal neighbours break it). | Easy3 | ArrayImplementation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Why Did the Cow Cross the Road 5Given N traffic lights with B known broken positions, find the minimum number of broken lights to repair so that some K consecutive lights all work. | Easy3 | Sliding windowArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Why Did the Cow Cross the Road 1Given observations of which side of the road each of 10 cows stands on, count how many times a cow changes sides between consecutive observations of that cow. | Easy3 | ArrayImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Closest bus stopsGiven n distinct integer coordinates on a line, find the smallest absolute difference between any two and count how many pairs achieve it. | Easy3 | SortingArray+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Salt and Pepper (Small)Given an M by N brightness matrix and odd window size W, output the median of every W by W window. | Easy3 | ArraySorting+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Kim's DinerMaintain a list of pending orders under append, sort by (time, table), and delete-by-table commands, printing the list after each query. | Easy3 | SimulationSorting+2 | No attempts yet | 2s | 256 MB | Judgeable |
| High-End ArtworkStamps are pressed onto a paper in a given order; later presses overwrite earlier ones. Print the final grid, using '.' for untouched cells. | Easy3 | SimulationArray+1 | No attempts yet | 4s | 512 MB | Judgeable |
| Sickly YeongjeongMap each symptom to its medicine name, then for every query list output the matching medicines in order or YOU DIED if any symptom is untreatable. | Easy3 | Hash mapImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Hyobin's TutoringMultiply N matrices in the given order and print the sum of the product's entries modulo 1,000,000,007, or -1 if the shapes do not line up. | Easy3 | ImplementationMath+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Sum GameGiven two length-N sequences of daily scores, find the largest K where the prefix sums of both sequences are equal. | Easy3 | Prefix sumArray | No attempts yet | 1s | 512 MB | Judgeable |
| Ttakji GameFor each of N rounds, compare two cards by counting stars, then circles, then squares, then triangles, and print which player wins or a draw. | Easy3 | ImplementationArray+1 | No attempts yet | 2s | 512 MB | Judgeable |
| CrammingGiven N chapters, each with a study time and a score, choose a subset whose total study time fits in T to maximize the total score. | Easy3 | Dynamic programmingArray+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Reverse NonogramGiven a solved nonogram grid of '.' and 'X', print the run-length clues for every row and then every column. | Easy3 | ImplementationSimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Cezar's BlackjackGiven the values of N drawn cards summing to at most 21, decide whether to draw again based on how many remaining cards exceed the gap to 21. | Easy3 | ImplementationMath+2 | No attempts yet | 1s | 64 MB | Judgeable |
| Amusement AnticipationFor each sequence, find the starting position of the longest contiguous arithmetic run that ends at the last element. | Easy3 | ImplementationArray | No attempts yet | 2s | 512 MB | Judgeable |
| Game of ThrownsTrack a token around a circle of children through clockwise or counterclockwise throws, undoing the last m throws on command. | Easy3 | StackSimulation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| FitnessSimulate moves around 8 circularly numbered stations and print the visited sequence, marking it reject if fewer than 5 distinct stations appear or any station repeats. | Easy3 | SimulationImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Musical ChairsSimulate musical chairs: each round every remaining player shifts M seats clockwise, the player at seat S is eliminated, and seats are renumbered until R rounds pass. | Easy3 | SimulationImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Another Brick in the WallSimulate laying bricks in pile order across h layers of width w, and report whether every layer fills exactly before the pile runs out. | Easy3 | SimulationImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Number PairsCount pairs of distinct values in a sequence that sum to a target K, where order does not matter and each element is used once. | Easy3 | ArrayHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Palindromic PasswordFor each six-digit number, print the closest six-digit palindrome, breaking ties by choosing the smaller one. | Easy3 | ArrayBrute force+1 | No attempts yet | 3s | 512 MB | Judgeable |
| Name CompatibilityInterleave two equal-length names letter by letter, replace each letter with its stroke count, then repeatedly sum adjacent digits (keeping the ones digit) until two remain. | Easy3 | ImplementationSimulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Aron's Place in LineGiven the shirt colors of people in line, where each maximal run of equal colors is one group, find the position Aron occupies at the back. | Easy3 | ImplementationString+2 | No attempts yet | 1s | 32 MB | Judgeable |
| Olivander's wand boxesGiven N wand lengths and N box sizes, decide whether every wand can be paired with a distinct box whose size is at least the wand length. | Easy3 | SortingGreedy+2 | No attempts yet | 1s | 64 MB | Judgeable |
| Odd GnomeFor each group of unique IDs whose non-king elements increase by exactly one, output the 1-based position of the single out-of-order gnome. | Easy3 | ArrayImplementation | No attempts yet | 2s | 512 MB | Judgeable |
| Vera and ABCDEGiven a string of N letters from A to E, render the 5x3 pattern for each letter side by side and print the resulting 5 rows of 3N characters. | Easy3 | ImplementationString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Äventyr 1On a path 1 to N, vertices become active over time; after each activation, answer the distance from a query vertex to the nearest active vertex, or -1 if none exists yet. | Easy3 | ArraySorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| LifeguardsGiven N shifts, remove exactly one so that the total time covered by the remaining shifts is maximized. | Easy3 | IntervalsBrute force+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Going Down 2Given N rows of three digits, move down choosing reachable cells and report the maximum and minimum possible sum of the digits passed through. | Easy3 | Dynamic programmingArray | No attempts yet | 1s | 512 MB | Judgeable |
| Sorting numbers 5Read up to a million integers and print them in non-decreasing order, one per line. | Easy3 | SortingArray+1 | No attempts yet | 10s | 128 MB | Judgeable |
| Round and Round SnailA snail walks a clockwise square spiral from the origin, one cell per second; given n seconds, print its coordinates. | Easy3 | ImplementationSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Multiply and DivideGiven three integers in fixed order, insert one multiplication and one division sign to maximize the value, evaluated left to right. | Easy3 | MathImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Team Tic Tac ToeGiven a filled 3x3 board of letters, count single cows that own a full line and two-cow teams that together own a line with both letters present. | Easy3 | Brute forceImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| RouterSimulate a buffer of size N: packets arrive in order, 0 means one is handled and removed from the front, and a packet arriving with the buffer full is dropped. | Easy3 | QueueSimulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Stroop EffectGiven sequences of two-digit word-ink codes, check whether each sequence satisfies the counts and the no-three-in-a-row rule for a valid Stroop test. | Easy3 | ImplementationSimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Twenty Thousand Leagues Under the SeaAmong N cages with given hole sizes, pick the largest hole whose area is under M and report its input index, or output Too small. | Easy3 | ArrayBrute force+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Tide PodsScore each model person by the number of shared traits times their score, then output the largest minus smallest score. Multiple data sets follow, and each result gets its own header and trailing blank line. | Easy3 | ArrayImplementation | No attempts yet | 2s | 512 MB | Judgeable |
| Appalling ArchitectureGiven a grid of filled 1x1 boxes forming one grounded component, compare the center of gravity's x-coordinate with the leftmost and rightmost ground-contact x to say left, balanced, or right. | Easy3 | ArrayMath+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Professor Na's Bad HandwritingReplace every 0 and 6 digit with 9 in each score, cap at 100, then print the integer nearest the average, breaking ties upward. | Easy3 | ImplementationMath+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Paper FoldingGiven an N by N grid of numbers (N is a power of two), fold the paper in half repeatedly adding overlapping cells until one number remains; print it. | Easy3 | ArrayMath+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Chaarshanbegaan at CafebazaarGiven up to 100 dart coordinates, score each by its distance from the board center and print the total score. | Easy3 | MathImplementation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| TurnaroundsGiven the seconds when each team scored, report how many points fell in the first half and how many times the lead changed from strictly behind to strictly ahead. | Easy3 | ImplementationSimulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Sugoroku and PiecesMove pieces forward one square on a 2019-square board, but block moves onto the goal or an occupied square, then report each piece's final position. | Easy3 | SimulationArray+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Slimming PlanSimulate daily weight changes from the repeating D-day plan and report the day the weight reaches T, or output -1 if it never does. | Easy3 | SimulationArray+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Teenage MutantCompare each of your k trait characters against all n ancestor strings at the same position, count positions where yours differs from every ancestor, and output that count over k. | Easy3 | ArrayString+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Switches and LampsGiven N switches that each light some lamps and together cover every lamp, decide whether leaving out one switch still covers all lamps. | Easy3 | ImplementationHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Shell GameGiven N shell swaps and Elsie's guess after each swap, find the highest number of correct guesses she could make over all possible starting positions of the pebble. | Easy3 | SimulationBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Phone Number CompatibilityInterleave two 8-digit phone numbers, repeatedly replace adjacent pairs by the units digit of their sum until two digits remain, and print the score with leading zeros. | Easy3 | ImplementationSimulation+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Why Did APC Become a Subtask Contest?Given N problems each with an easy and hard difficulty and a solve limit K, find the maximum score Hyunjung can earn with skill L. Each problem's easy part is worth 100 and the hard part adds 40, and solving the hard part counts as one problem. | Easy3 | GreedySorting+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Keyboard EventGiven key presses with keyboard number, time, and character, print the characters ordered by time, breaking ties by keyboard number. | Easy3 | SortingImplementation+1 | No attempts yet | 1s | 256 MB | Judgeable |
| I AM IRONMANSimulate N games: look up each opponent in a win/loss table, add W or subtract L (floored at 0), and report whether the score ever reaches G. | Easy3 | SimulationImplementation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Only Three!Count how many length-3 windows of a digit string are strictly increasing and are not extended to a run of four or more consecutive digits. | Easy3 | StringImplementation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| What if a car takes the side of its owner, Kim Pyojun?For each window length k from 1 to N, find the starting index of the length-k subarray with the largest standard deviation, breaking ties by the smallest index. | Easy3 | ArrayPrefix sum+2 | No attempts yet | 1s | 512 MB | Judgeable |
| You Have To Solve This One!Sort the array, then answer range-sum queries over the sorted sequence efficiently. | Easy3 | SortingPrefix sum+1 | No attempts yet | 1s | 512 MB | Judgeable |
| GerrymanderingSum precinct votes into districts, find each district's winner, compute lost and excess wasted votes per party, then output the overall efficiency gap. | Easy3 | ImplementationMath+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| SticksGiven the heights of N sticks in a row, count how many sticks are visible when the row is viewed from the right, where a stick is visible only if it is strictly taller than every stick to its right. | Easy3 | ArrayImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Lost LineupGiven each of Jimmy's friends' distance (number of people between them and Jimmy) from the front, reconstruct the original lineup with Jimmy first. | Easy3 | ArraySorting+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Awkward PartyGiven a row of n language labels, find the smallest gap between two positions holding the same label, or n if all labels are distinct. | Easy3 | ArrayHash map+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Mountain RangesGiven non-decreasing viewpoint altitudes along a trail, find the length of the longest run where each consecutive altitude increase is at most X, starting anywhere. | Easy3 | ArrayTwo pointers+2 | No attempts yet | 0.1s | 512 MB | Judgeable |
| Cat FoodGiven a binary picture rotated 90 degrees counterclockwise, check whether it equals the students' picture under the reverse rotation. | Easy3 | ImplementationMatrix+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Summer Hand FanFor each fan compute the price plus the sum C + 2C + ... + mC for the number of K-hour intervals fully completed during the walk Q, then output the cheapest fan index. | Easy3 | MathImplementation+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Black and WhiteGiven an n by n grid of B and W cells, check that every row and column is balanced and has no three cells of the same color in a row. | Easy3 | ArrayImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Square Eye TestIn a grid containing exactly one colored square border with a one-cell gap at the middle of a side, report which side has the gap. | Easy3 | ImplementationArray+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Cow GymnasticsGiven K rankings of N cows, count the pairs where one cow beats the other in every ranking. | Easy3 | Brute forceArray+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Boxing Day Football AnalysisGiven the order of N goals scored by two teams, report the final score, the number of tied scores reached during the match, and the longest run of successive goals that flipped a deficit into a lead. | Easy3 | SimulationImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| BiodiversityGiven the species names of N animals, print the species that appears more times than all other species combined, or NONE. | Easy3 | Hash mapImplementation+2 | No attempts yet | 3s | 512 MB | Judgeable |
| IcebergsGiven N simple polygons, compute the total area and print its floor as an integer. | Easy3 | GeometryMath+2 | No attempts yet | 3s | 512 MB | Judgeable |
| PRIMFor each of T test cases, given an array of n integers, replace every element with the smallest prime that is at least that element, then print the sum. | Easy3 | Number theoryMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| CHROMGiven two parent permutations and two crossover points n and m, build the offspring by keeping parent 1's segment [n, m) in place and filling the rest from parent 2 in order. | Easy3 | ArrayImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| DISPERFor each professor, treat all student marks as one set, compute the variance of those marks, and report the professor with the highest dispersion to two decimals. | Easy3 | MathImplementation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Sequence and Queries 37Maintain an array under point updates, and for range queries report how many entries are even or odd. | Easy3 | ArrayPrefix sum+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Duplicate FilesGiven file names and unique IDs, keep the smallest ID for each distinct name and print the surviving IDs in increasing order. | Easy3 | Hash mapSorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| New Year and NamingGiven two cyclic string sequences, return the concatenation of the pair selected by each queried year index. | Easy3 | ImplementationMath+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Please Write the If Statements for MeGiven N titles ordered by increasing power upper bounds, print for each of M power values the first title whose bound is at least that value. | Easy3 | Binary searchArray+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| LabelsGiven the difference sequence D of an unknown sequence A with values in [1, N], output A if it is uniquely determined, otherwise -1. | Easy3 | ArrayImplementation+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| SortingGiven a list of question difficulties, determine the minimum number of adjacent swaps needed to sort them into increasing order. | Easy3 | SortingGreedy+1 | No attempts yet | 1s | 512 MB | Judgeable |
| LunchBoxGiven N lunch boxes and each school's request ki, choose schools to satisfy fully (all ki boxes or none) so the count of served schools is maximized. | Easy3 | GreedySorting+2 | No attempts yet | 0.5s | 512 MB | Judgeable |
| Advertising on the FenceGiven n intervals over boards 1 to m, decide whether their union covers every board from 1 to m. | Easy3 | IntervalsSorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Restoring the SequenceGiven n, m, and m board values, decide whether they are 1..n with exactly one number erased, and print that number. | Easy3 | ImplementationMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Gold BarsGiven three bar weights with an even total, decide whether the bars already split evenly, or which single bar to cut in two so the pieces divide equally. | Easy3 | MathImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Maximum ProductSplit the array after one index so the product of the two part sums is maximized, and print that index. | Easy3 | Prefix sumArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Amateur AgronomistFind the longest contiguous segment of a flower row that does not contain three equal values in a row, and print its start and end indices. | Easy3 | ArrayTwo pointers+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Good IntervalsGiven a set S of integers and a target n, count the number of intervals [A,B] with A<B that avoid all elements of S and contain n. | Medium4 | MathArray+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Line UpReconstruct a line of N people (heights 1..N) given for each height how many taller people stand to its left, using reverse insertion. | Medium4 | ArrayGreedy+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Sum of SubsequencesCount how many non-empty subsequences of up to 20 integers sum exactly to a given target S. | Medium4 | BacktrackingBrute force+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Online Egg SalesGiven N eggs and M customers' maximum bid prices, pick the selling price (lowest if tied) that maximizes total revenue when all customers bidding at least that price buy an egg, capped at N sales. | Medium4 | SortingGreedy+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Temporary Class PresidentGiven each student's class per grade for 5 grades, find the student who shared a class with the most distinct other students, choosing the smallest index on ties. | Medium4 | ArrayBrute force+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Coffee Shop Game 2Given an array, answer Q online queries each asking a range sum (with swapped bounds allowed) followed by a point update. | Medium4 | Segment treePrefix sum+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Platform Support PillarsGiven platforms with heights and horizontal spans, compute the total length of vertical support pillars placed slightly inside each platform's ends resting on the floor or a lower platform. | Medium4 | SimulationSorting+2 | No attempts yet | 2s | 128 MB | Judgeable |