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 results907 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| &+ +&Over all N^2 pairs, compute the sum modulo 1999 of pairwise ANDs, and the bitwise AND of all pairwise sums. | Medium5 | Bit manipulationMath+1 | No attempts yet | 1.5s | 512 MB | Judgeable |
| Life on a TorusSimulate Conway's Life on a wrapped 8x8 torus and find the smallest repeat period reached after any transient. | Medium5 | SimulationHash map+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Binary StringDelete the fewest bits from a binary string so the remaining subsequence keeps no leading zeros and has value at most K. | Medium5 | StringGreedy+2 | No attempts yet | 0.5s | 512 MB | Judgeable |
| Nim Game 3Given Nim pile sizes, count how many first moves (choosing a pile and removing stones) leave the opponent in a losing position. | Medium5 | Game theoryBit manipulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| From A to BGiven two integers a and b, find the minimum number of operations (divide an even number by two, or add one) needed to turn a into b. | Medium5 | GreedyBit manipulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Word MemorizationTrack which letters are currently remembered and, after each forget or recall query, report how many dictionary words contain only remembered letters. | Medium5 | Bit manipulationHash map+2 | No attempts yet | 4s | 1024 MB | Judgeable |
| Looking for TasteGiven N numbers, choose at most K of them so their bitwise OR is as large as possible. | Medium5 | Bit manipulationGreedy+2 | No attempts yet | 3s | 512 MB | Judgeable |
| BinomialGiven a sequence, count ordered pairs (i, j) where the binomial coefficient C(a_i, a_j) is odd, using the Lucas theorem bit condition. | Medium5 | CombinatoricsBit manipulation+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Painting ExchangeGiven who can sell to whom at what price, find the longest chain of distinct buyers starting from artist 1 where each resale price never drops below the purchase price. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Park Seongwon's ProbabilityCount permutations of up to 15 numbers whose concatenation is divisible by K, and output the probability as a reduced fraction. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Power PlantsGiven restart costs between plants and which plants are already on, find the minimum total cost to reach at least P working plants, or -1. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| FencesPartition up to 16 given fence lengths into disjoint triples, keep only triples that form a valid triangle, and maximize the total area. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Making WordsFor each 3x3 letter board, find which center letters yield the fewest and the most dictionary words of length 4 or more, along with those counts. | Medium6 | StringBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Student ShuffleCount permutations of up to 16 students so that every pair of adjacent heights differs by more than a given value K. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Moonlit Maze EscapeFind the shortest path from start to any exit in a grid maze where doors need matching keys collected along the way, tracked as key-state BFS. | Medium6 | BFSBit manipulation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Problem AssignmentGiven an N x N matrix of student-problem times, find the minimum-cost perfect matching assigning one distinct problem to each student. | Medium6 | Dynamic programmingGraph+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Restricted PermutationsCount permutations of 1..N where every element differs from its index by at most K, using a bitmask DP over a sliding window. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| TheaterConstruct the longest sequence of distinct nonempty actor subsets where consecutive scenes differ by exactly one actor and the play starts and ends with a single actor. | Medium6 | Bit manipulationCombinatorics+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Coin FlippingGiven an N by N grid of H/T coins (N up to 20), find the minimum number of tails achievable by flipping any subset of rows and columns. | Medium6 | Bit manipulationBrute force+2 | No attempts yet | 6s | 128 MB | Judgeable |
| Assigning Tasks 1Given an N by N cost matrix, assign each person exactly one task to minimize the total assignment cost. | Medium6 | Dynamic programmingBit manipulation+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Friendly BrothersGiven a reduced fraction a/b, find the shortest repeating turn pattern (length at most 60) of two people eating half the remaining cake so one person's total share equals a/b. | Medium6 | Number theoryMath+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Sum of Largest Power-of-Two DivisorsGiven A and B up to 10^15, compute the sum over that range of the largest power-of-two divisor of each integer. | Medium6 | MathNumber theory+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Counting Divisible NumbersCount integers in a range that are divisible by at least one element of a given array using inclusion-exclusion over subsets and LCM. | Medium6 | CombinatoricsMath+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Nice NumbersCount integers in the range [L, R] whose binary representation has three consecutive equal bits, using digit DP over bits. | Medium6 | Dynamic programmingBit manipulation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Coin Flips IIGiven an N by M grid of coins, find the minimum number of top-left rectangle flips needed to turn every coin to heads. | Medium6 | MatrixGreedy+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Maze EscapeFind the minimum time to escape a maze where the player can press a button to rotate an entire row and column of rooms by 90 degrees, changing their door layout. | Medium6 | BFSBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Turning On the LightsFind the minimum number of bulb presses, each flipping a cell and its 8 neighbors, needed to turn all bulbs on an N×M grid (N,M ≤ 8) on, or report impossibility. | Medium6 | Bit manipulationBrute force+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Coin FlipsFind the minimum number of row and column flips on an odd N by M 0/1 grid so every row and column has an even count of 1s, or output -1. | Medium6 | MathBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Tiling a GridCount the ways to fully tile an N by M grid (N, M up to 14) with 2x1 dominoes, modulo 9901. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Making a RectangleGiven up to 16 sticks, choose four disjoint groups forming two equal-length pairs of sides to maximize the rectangle's area, or return -1 if impossible. | Medium6 | Bit manipulationDynamic programming+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Turning Off the LightsGiven a row of L bulbs and a fixed T-slot switch device that can be pressed at any aligned position any number of times, find the minimum number of bulbs left on. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Cow PizzaCount subsets of up to 20 toppings that avoid containing every topping of any given forbidden constraint set, using inclusion-exclusion or bitmask enumeration. | Medium6 | Bit manipulationCombinatorics+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Baby Goat LineupGiven binary labels A through B, find the X-th label when ordered first by popcount then by numeric value. | Medium6 | CombinatoricsBit manipulation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Card GameGiven 9 piles of 4 cards, compute the probability that repeatedly removing a uniformly random matching-rank pair of top cards clears all cards. | Medium6 | ProbabilityDynamic programming+1 | No attempts yet | 2s | 128 MB | Judgeable |
| CiphertextGiven up to 40 positive integers and a target K, find a subset (as a bitstring) whose sum equals K, exploiting the small total sum with meet-in-the-middle or subset-sum search. | Medium6 | Dynamic programmingBit manipulation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Binary XORGiven binary strings, find the closest achievable XOR combination (using at least one XOR) to a target, breaking ties by fewest operations then lexicographic order. | Medium6 | Bit manipulationMath+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Circular NetworkGiven a cycle of N nodes and P path requests, choose a direction for each request to minimize the total number of distinct cycle edges converted. | Medium6 | GreedyBit manipulation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| LampsGiven N lamps in a circle updating by XOR with the right neighbor each second, compute the states after M steps efficiently using binary exponentiation over XOR shifts. | Medium6 | Bit manipulationMath+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Word ChainGiven up to 16 vowel-only words, chain them by matching first and last letters without repeats to maximize the total length used. | Medium6 | Bit manipulationDynamic programming+1 | No attempts yet | 2s | 128 MB | Judgeable |
| LieDetect the first parity query in a sequence that becomes inconsistent with earlier ones, using weighted union-find over prefix-sum parities. | Medium6 | Union-findBit manipulation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Hamming PathGiven N binary codes, build implicit graph edges between codes at Hamming distance 1 and output shortest paths from code 1 to each queried code via BFS. | Medium6 | BFSBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Coin Flipping 2Given an N x N grid of H/T coins, find the minimum number of tails achievable by flipping any subset of rows and columns. | Medium6 | Brute forceBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| QR DecodingParse a 19-byte QR data payload bit by bit and decode its numeric, alphanumeric, byte, and kanji mode segments into a formatted output string. | Medium6 | Bit manipulationString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Logical Expression EquivalenceParse two concatenated boolean expressions with C-style operator precedence and decide if they are logically equivalent for all variable assignments. | Medium6 | StringBrute force+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Childhood Toy BoxesCount subsets of N boxes (as bitmasks over M<=20 toy types) whose union covers all M types, modulo 1e9+7. | Medium6 | Bit manipulationDynamic programming+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Bored JungyuGiven XOR values of a lowercase/period/space plaintext with a digit key, decide for each position whether the original was a letter or a period/space. | Medium6 | Bit manipulationBrute force+1 | No attempts yet | 1s | 128 MB | Judgeable |
| XOR ShapesGiven up to 10 right isosceles triangles drawn with XOR-style color inversion, compute the total black area after all draws. | Medium6 | GeometryBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Agent Mission AssignmentGiven an N x N matrix of success percentages, assign one mission per agent to maximize the product of chosen probabilities, essentially an assignment problem with a product (log-sum) objective. | Medium6 | Dynamic programmingBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Processor DesignReconstruct lexicographically smallest initial 32-bit register values consistent with a sequence of bit-rotation and XOR-output commands, using union-find over bits with XOR relations. | Medium6 | Union-findBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Lazy TelegraphFor each dictionary word to be sent, find a same-length string minimizing total transmission time (dots=1s, dashes=2s) so that it is the unique closest dictionary word by Hamming distance, then sum the minimum times. | Medium6 | Brute forceString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Monkey in the LabyrinthFind the shortest path in a labyrinth where rooms can be locked or unlocked and up to 8 switches toggle groups of room states, using BFS over a state space that combines room and switch configuration. | Medium6 | BFSBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| KnightGiven an N×N board with M forbidden squares, find the maximum number of knights placeable so none attacks another. | Medium6 | GraphGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Justice for AllGiven a k x k 0/1 trust matrix (k up to 20), count the number of perfect matchings between knights and horses, i.e. the permanent of the matrix. | Medium6 | Dynamic programmingBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Key TaskFind the shortest path from a start cell to any exit in a grid maze where doors require previously collected matching keys. | Medium6 | BFSBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Hang or Not to HangGiven a tiny assembly program with 32 boolean registers, arbitrary initial state, and nondeterministic RANDOM instructions, find the minimum number of cycles over all possible executions until STOP, or report HANGS. | Medium6 | BFSBit manipulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Set EquationsParse a set-theory equation with union, intersection, difference, and symmetric difference, then determine per-element membership assignments for undefined variables that satisfy it, printing the canonical lexicographically smallest solution or reporting impossibility. | Medium6 | SimulationImplementation+1 | No attempts yet | 2s | 64 MB | Judgeable |
| ExpectationCompute the exact expected value (as a reduced fraction) of the XOR of two independent uniform random integers in [0, n-1), for up to 1000 values of n up to 1e9. | Medium6 | Bit manipulationMath+1 | No attempts yet | 2s | 64 MB | Judgeable |
| TichuGiven a 13-card Tichu hand, compute the minimum number of legal combinations (singles, pairs, triples, quads, full houses, straights) that partition the hand. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Computer GameGiven a diamond-shaped lattice grid with some cells blocked, count all nonempty subsets of free cells that form a single connected (4-adjacency) region. | Medium6 | Brute forceGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Binary PolynomialsGiven a Boolean function's polynomial coefficients over n variables, count vectors with exactly k ones that make the function evaluate to 1. | Medium6 | Bit manipulationCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Finding the Weakness in the EncryptionGiven nine XOR-encrypted 32-bit values where the last is a checksum of the others, recover the XOR key bit by bit using carry propagation. | Medium6 | Bit manipulationMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| God of WindDecide if a 2x2 cloud can move on a 4x4 grid, one to two cells per step in a straight line, so every village avoids rain-free streaks over 6 days while never raining on a marked village on its festival day. | Medium6 | BFSBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Hongjun's Royal GuardCount permutations of N distinct elements where every interior element is a local extremum (both neighbors larger or both smaller); N is at most 20. | Medium6 | Dynamic programmingCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The AgencyFind the minimum landing-tax cost to travel from one N-bit planet to another, where flights flip exactly one bit. | Medium6 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Pizza Delivery Minimum TimeGiven directed travel times between a pizzeria and up to 10 stops, find the shortest round trip from the pizzeria visiting every stop. | Medium6 | Shortest pathDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Game of EfilCount how many predecessor configurations on a torus could evolve into a given Game of Life state. | Medium6 | Bit manipulationBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| MosaicCount the tilings of an N x M grid with 2 x 2 squares and L-trominoes, modulo 1,000,000. | Medium6 | Dynamic programmingBit manipulation | No attempts yet | 1s | 128 MB | Judgeable |
| Powers of ThreeGiven n, list the elements of the n-th smallest subset of powers of 3 when subsets are ordered by their sums. | Medium6 | MathCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| No TippingCount the orders in which n packages can be removed from a lever on two fulcrums so the board never tips. | Medium6 | BacktrackingBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| PebblesPlace pebbles on an N by N board so no two touch even diagonally, maximizing the sum of covered cell values. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Time to GraduateGiven up to 12 courses with prerequisites, fall or spring offerings, and a per-semester course cap, find the minimum number of semesters to finish all courses. | Medium6 | GraphDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Double VisionGiven n pixel grids of symbols, decide for each whether one or two pixels uniquely identify it, and mark the chosen pixels. | Medium6 | Brute forceImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Not One Bit MoreCount integers in [LO, HI] whose repeated popcount chain reaches 1 at exactly step X, with LO up to 1e18 and X up to 10. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| WordStackOrder the given words and pad each with leading spaces to maximize the total number of columns where a letter matches the letter directly above it. | Medium6 | Dynamic programmingBit manipulation | No attempts yet | 1s | 128 MB | Judgeable |
| Complaint SortGiven a sequence of n values, count the strictly decreasing subsequence triples (i < j < k with a_i > a_j > a_k). | Medium6 | ArrayCombinatorics+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Chemical AnalysisGiven up to 12 element bitmasks and a target bitmask, find the fewest elements whose bitwise OR equals the target, or report that none does. | Medium6 | Bit manipulationBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Zebra HerdAssign each of z zebras one of two colors at each of t times, minimizing same-color distance costs, opposite-color bonuses, and color-change penalties. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 7s | 128 MB | Judgeable |
| Arsenic and Old LaceGiven up to 20 base products as bitmasks over s substances, find the fewest products whose union exactly equals the poison mask, or report impossible. | Medium6 | Bit manipulationBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Essay WritingGiven a sample text, two keywords, and a target length w, decide whether a word sequence of exactly w words exists where every adjacent pair appears in the sample and both keywords occur at least once. | Medium6 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Warehouse Location PlanningChoose any nonempty subset of up to 20 candidate warehouses and assign each of up to 100 stores to a chosen one so that building plus Euclidean shipping cost is minimum. | Medium6 | Brute forceBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Course LoadPick a set of classes with pairwise disjoint meeting slots and total workload at most C, maximizing total utility. | Medium6 | Dynamic programmingBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Party LampsGiven N lamps all starting ON and a press count C, list every distinct final lamp configuration reachable with exactly C presses of four fixed toggle buttons and consistent with up to two ON and two OFF constraints. | Medium6 | Brute forceBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SenbeiGiven a binary R x C grid with R at most 10, choose one subset of rows and one subset of columns to flip so the number of 1s is maximized. | Medium6 | Brute forceGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Long Night of MuseumsWith at most 20 museums, viewing times, and travel times, find the largest number of distinct museums a 420-minute tour can include. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cows in a SkyscraperGiven up to 18 cow weights and an elevator capacity, find the minimum number of trips that carry every cow without exceeding the capacity. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Trough GameGiven N troughs and M queries that each count filled troughs within a listed subset, find the filled set or report impossible or non-unique. | Medium6 | Brute forceBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Mixed Up CowsCount permutations of N serial numbers (N at most 16) where every adjacent pair differs by more than K. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Round NumbersCount integers in [Start, Finish] whose binary form has at least as many zeroes as ones. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| DividingGiven counts of marbles worth 1 to 6, decide whether the collection can be split into two sets of equal total value. | Medium6 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Pizza Anyone?Each friend accepts a pizza if it meets at least one of their requests; find the fewest-topping pizza, breaking ties by smallest topping string, or report that none exists. | Medium6 | Bit manipulationBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Fiber NetworkFor each query in a directed multigraph where every edge is labeled with a set of companies, list the companies that have a path from A to B using only their own edges. | Medium6 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Mondrian's DreamCount the number of ways to tile an h by w rectangle (up to 11 by 11) with 2 by 1 dominoes, for several test cases. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Collecting BeepersGiven Karel's start and up to 8 beepers on a grid, find the shortest Manhattan-distance round trip visiting every beeper. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| CandySplit multiset candies with counts and calorie values into two groups so the two calorie totals differ as little as possible. | Medium6 | Dynamic programmingBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| BlindfoldGiven a grid with obstacles and a fixed sequence of forward/turn moves, mark every walkable square that can be a final position for some unknown start and heading. | Medium6 | SimulationBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Word GroupingSplit N words into the fewest groups so that each group shares at least one common letter, with at most 15 distinct letters. | Medium6 | Bit manipulationDynamic programming+1 | No attempts yet | 1s | 1024 MB | Judgeable |
| Flip GameFind the minimum number of flips to turn all 16 pieces white or all black, where each move flips a chosen cell and its orthogonal neighbors. | Medium6 | Brute forceBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Pimp My RideGiven n jobs with base prices and pairwise surcharges paid when a later job follows an earlier one, find the cheapest order to finish all jobs. | Medium6 | Dynamic programmingBit manipulation | No attempts yet | 1s | 128 MB | Judgeable |
| Colored StonesRemove the fewest stones so that in the remaining row every color appears in one contiguous block. | Medium6 | Dynamic programmingBit manipulation | No attempts yet | 1s | 128 MB | Judgeable |
| Shortest Computer Reboot TourGiven up to 12 points, find the shortest closed tour that visits every point exactly once and returns to the start. | Medium6 | Dynamic programmingBit manipulation+1 | No attempts yet | 0.1s | 128 MB | Judgeable |