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,013 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| DehuffGiven a sample string and its full binary encoding, reconstruct the unique prefix-code table for the alphabet, or report several possible tables. | Medium7 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Follow My LogicParse ASCII circuit diagrams made of wires, junctions, AND/OR gates, and inversions, then evaluate the output for each given input assignment. | Medium7 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Single Point of FailureFor each undirected connected graph, list every articulation point and the number of connected components its removal creates. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Peter's CalculatorParse assignment, PRINT, and RESET statements, evaluate expressions with variables, detect cycles or undefined references, and print values or UNDEF. | Medium7 | ImplementationRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Frame StackingGiven a picture of several stacked lettered frames on a grid, recover the bottom-to-top stacking order, printing all valid orders alphabetically. | Medium7 | GraphTopological sort+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Teams that can winGiven n teams and n-1 desired games, count the teams that can be champion under some valid single-elimination schedule that plays every listed game. | Medium7 | GraphTree+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Safe Unlock CodeFor each n, print the lexicographically smallest de Bruijn sequence of order n over the digits 0 to 9, whose length is 10^n + n - 1. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Sinks of a GraphIn each directed graph, list every node v such that every node reachable from v can reach v back. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Settlers of CatanGiven an undirected graph where nodes have degree at most three, find the longest path that uses no edge more than once. | Medium7 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Co-workers from HellPlace tricks in chambers so the watchman's walk, where each trick is used once to change dwell time and jump target, maximizes total time before he normally finishes chamber n. | Medium7 | Dynamic programmingGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| LHCGiven a tree, find the maximum cycle length obtainable by adding one edge, and count the vertex pairs that achieve it. | Medium7 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| MobileDecide whether two mobiles, given as rooted binary structures with negated weight labels, can be rotated to look identical. | Medium7 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Road ConstructionGiven a connected undirected graph, add the fewest edges so that deleting any single edge still leaves the graph connected. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Pyramid Message SchemeGiven a chronological list of message recipients from a sequential tree traversal, reconstruct the tree and compute the time saved by a parallel traversal. | Medium7 | TreeStack+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Strategic BombingGiven an undirected graph of at most 26 points, find every edge whose removal disconnects A from B, listing them in input order. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Coke or Chocolate MilkAssign each person one of two drinks so that desire, hatred, sameness, difference, and conditional requests all hold, printing the alphabetically earliest Coke-preferring satisfying assignment or reporting failure. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cycle DetectionGiven a graph on at most 20 vertices, for each edge that lies on a cycle, count how many distinct simple cycles contain it. | Medium7 | GraphBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Uniform SubtreesGiven a parenthesis-encoded tree, list every distinct uniform subtree (same child count at each depth) in lexicographic order. | Medium7 | TreeDFS+2 | No attempts yet | 3s | 128 MB | Judgeable |
| PointsGiven up to 10000 directional rules between n points, decide whether real coordinates satisfy all of them at once. | Medium7 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| John's TripFind an Euler circuit in a connected multigraph that uses every street exactly once and is lexicographically smallest by street sequence, starting at the smaller endpoint of the first street. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Team Them UpSplit N people into two teams where teammates must mutually know each other, minimizing the size difference, and report the two team sizes. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Queen KingdomOn an n by n board with pillars blocking queens' attacks, find the maximum number of non-attacking queens and the number of placements attaining it. | Medium7 | BacktrackingBrute force+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Tree GameOn a tree, players alternately move a token to an unchosen neighbor from Manco's start vertex; find all start vertices where Manco wins with optimal play. | Medium7 | TreeGame theory+2 | No attempts yet | 1s | 64 MB | Judgeable |
| Coloured LeavesGiven an unrooted tree whose leaves have fixed colors, choose an internal vertex as root and place the fewest labels so each leaf's color matches its last labeled vertex. | Medium7 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Roman CorridorFind a left-to-right path through the grid whose symbol string is a valid Roman numeral and has the smallest decimal value. | Medium7 | DFSGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| HospitalGiven substitution lists for special nurses, find those who can never take vacation and all pairs that can go individually but not simultaneously. | Medium7 | GraphDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Central TreeFor each weighted tree, find the vertex minimizing the sum of weighted distances to all other vertices and output that minimum sum. | Medium7 | TreeDFS+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Lightning Energy ReportGiven a tree and many path updates that each add a value to every vertex on a path, report the final total at every vertex. | Medium7 | TreePrefix sum+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Sightseeing TourDecide whether a mixed graph of one-way and two-way streets has a closed tour that uses every street exactly once starting and ending at the same junction. | Medium7 | GraphUnion-find+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SignaturesGiven vouching edges among workers, commanders have no guarantors; list clerks whose reachability from some non-spy commander depends on a single commander. | Medium7 | GraphDFS+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Gambling MachineGiven n generators, each mapping to a subset of generators, decide whether some choice of output order lets the machine halt at Gn with all sets exhausted (defeat) or must it halt elsewhere. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| AgentsGiven a directed graph of who unmasked whom and the bribe cost of some agents, find the minimum cost to bribe agents so arrests cascade to everyone, or the smallest unreachable, unbribable agent. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Mudstock BisPlace a festival at a settlement on a star of railway lines to minimize the weighted sum of distances from all members, and report the cost and location. | Medium7 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Professor SzuCount walks in a directed multigraph from each cottage to the main building, cap at 36500, and report which cottages have the most routes (or are unbounded). | Medium7 | GraphDynamic programming+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Ridges and ValleysCount connected components of equal height in an n by n grid whose every boundary neighbor is strictly lower (ridge) or strictly higher (valley). | Medium7 | GraphDFS+2 | No attempts yet | 3s | 128 MB | Judgeable |
| The FloodGiven a grid of heights where city squares must be drained, find the minimum number of pumps so that water flows downhill from each city square to a pump. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| MegalopolisCount, for each query at a given moment, the number of still-country roads on the path from village 1 to a target village as edges are removed one by one. | Medium7 | TreeDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| BlockadeFor each town, count planned visits ruined if it alone is removed, i.e. those crossing it plus visits to and from it. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| StationPick a tree vertex as the hub so that the average number of hub-to-vertex paths needed to travel between unordered pairs of vertices is minimized. | Medium7 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| GuildsSplit the towns into two sets so that each set is a dominating set and the sets are disjoint, or decide it is impossible. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| BridgesFind an Eulerian circuit from island 1 minimizing the maximum directed edge cost, or report that no such circuit exists. | Medium7 | GraphBinary search+1 | No attempts yet | 3s | 512 MB | Judgeable |
| Tour de ByteotiaBlock the fewest roads so no closed trail (no repeated road) passes through any of towns 1 to k. | Medium7 | GraphDFS+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Winter Snow PlowingOn a tree, each edge must be traversed at least d_i times by one continuous walk; find the minimum total traversal count. | Medium7 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Byton TreeGiven a tree in recursive notation, where each leaf has a time interval, find the minimum number of cuts (each cut picks every byton in the subtree at one moment) so that all intervals are covered. | Medium7 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Planning the RoadworksGiven a directed graph, find a lexicographically smallest inclusion-maximal set of edges whose simultaneous removal leaves the reachability relation unchanged. | Medium7 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| RiddleDecide whether one town can be picked from each given group so that every edge of the graph has a chosen endpoint. | Medium7 | GraphGreedy+1 | No attempts yet | 3s | 1024 MB | Judgeable |
| BarricadesOn a tree, for each size k find the minimum number of edges to cut so that some connected component has exactly k vertices and no edges leave it. | Medium7 | TreeDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| RoadsGiven a directed graph, find the minimum number of edges to add so the whole graph becomes strongly connected. | Medium7 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Critical Computers of the Byteland Information AgencyGiven a directed graph where every node is reachable from node 1, find all vertices whose removal makes some other vertex unreachable from node 1. | Medium7 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Two PostmenSplit the edges of a tree rooted at node 1 between two postmen starting at the root so the later finishing time is minimized. | Medium7 | TreeDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Rigged TournamentCount the players that can be made champion by scheduling matches against opponents they are certain to beat. | Medium7 | GraphDFS | No attempts yet | 1s | 128 MB | Judgeable |
| Group ExcursionDecide whether each tourist's two visit wishes can be satisfied together and output the lexicographically smallest visit list. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Non-Attacking KnightsPlace the most knights on a board with blocked squares so no two attack each other. | Medium7 | GraphBFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| ExpresswaysDecide whether some subset of the given roads touches every city an odd number of times. | Medium7 | GraphMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| TagA pursuer at K always steps toward an evader at J on a tree while the evader moves or waits to maximize the capture time. | Medium7 | TreeGame theory+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Cactus GraphCount the simple cycles in an undirected graph, or print NIE when two cycles share more than one vertex. | Medium7 | DFSGraph | No attempts yet | 5s | 128 MB | Judgeable |
| MinesTrigger the fewest mines so chain reactions through overlapping blast squares detonate all N mines. | Medium7 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| TravelDecide whether a simple cycle exists that uses two required roads and avoids all toll roads. | Medium7 | GraphDFS | No attempts yet | 1s | 128 MB | Judgeable |
| Seminar RoomEach group submits two candidate time intervals, and the program picks one per group so that no two chosen intervals overlap. | Medium7 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Electric NetworkGiven a connected network, compute the fewest new lines that keep every pair of facilities connected after any single line fails. | Medium7 | DFSGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Rabbits and SanggeunDecide whether deleting vertices and edges can leave a connected subgraph with exactly four degree-one vertices. | Medium7 | GraphDFS | No attempts yet | 2s | 128 MB | Judgeable |
| Seven KingdomsDecide whether the cities split into three cliques holding city 1, city 2, and the rest, and print the lexicographically smallest assignment or impossible. | Medium7 | GraphDFS+2 | No attempts yet | 9s | 128 MB | Judgeable |
| Magic GraphsPick one label from each of K pairs so that no two chosen labels are the positive and negative of the same number. | Medium7 | GraphDFS | No attempts yet | 2s | 64 MB | Judgeable |
| World Cup NominationsGiven every pairwise duel result, count the countries that can emerge last under some knockout pairing order. | Medium7 | GraphDFS | No attempts yet | 1s | 128 MB | Judgeable |
| ForensicChange at most one array entry so the pointer chain starting at index 0 visits as many distinct indices as possible before reaching -1. | Medium7 | GraphDFS | No attempts yet | 2s | 512 MB | Judgeable |
| Smallest LNR SequenceGiven n and a binary string s, find the position of s in the lexicographically smallest de Bruijn sequence of order n. | Medium7 | GraphGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Bridge RemovalStarting from any island, a crew that spends a bridge length to cross or remove it must delete every bridge of a tree in the shortest total time. | Medium7 | Dynamic programmingTree+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Beam me out!Decide whether a random walk from room 1 reaches room n with certainty and whether every possible walk ends within a bounded number of steps. | Medium7 | GraphDFS+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Jewelry ExhibitionYou choose the fewest unit-wide horizontal or vertical strips on integer lines to cover every exhibit point. | Medium7 | GraphDFS | No attempts yet | 1s | 256 MB | Judgeable |
| There is No AlternativeCount the bridges that appear in every minimum-cost set connecting all islands and report their total cost. | Medium7 | Minimum spanning treeUnion-find+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Even distributionCount how many integers occur as the greatest common divisor of candy counts along some walk in the island graph. | Medium7 | Number theoryGraph+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Palindromic PathsCount distinct palindromic strings spelled by right-down paths from the top-left to the bottom-right of an N by N letter grid. | Medium7 | DFSHash map+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Cheating 2Place the most students on an N by M grid with broken seats so no two sit side by side or diagonally adjacent. | Medium7 | GraphDFS | No attempts yet | 2s | 256 MB | Judgeable |
| Deadlock DetectionGiven an instruction string of lock acquisitions and releases, decide whether any interleaving of ten threads running it can deadlock. | Medium7 | GraphDFS | No attempts yet | 3s | 256 MB | Judgeable |
| Shelob's LairDecide if a path from the south wall to the north wall can avoid all web segments except possibly one shared cut point. | Medium7 | GraphGeometry+1 | No attempts yet | 5s | 256 MB | Judgeable |
| 2-SAT SatisfiabilityDecide whether N boolean variables admit values that satisfy all M two-literal clauses. | Medium7 | GraphDFS | No attempts yet | 1s | 256 MB | Judgeable |
| One-Way RoadsDecide whether undirected roads can be oriented into a strongly connected digraph and output the DFS-based orientation when possible. | Medium7 | DFSGraph | No attempts yet | 1s | 256 MB | Judgeable |
| AvoiderCount self-avoiding walks of each length from a to b in the first quadrant starting east from the origin and print the sum. | Medium7 | BacktrackingDFS+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Exposing corruptionBribe members to switch parties within a budget while keeping rivals in different parties, and report the largest achievable DSP and PPP sizes. | Medium7 | Dynamic programmingGraph+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Falling BlocksPlace a repeating sequence of pentomino pieces on a 3 by 10 board with Tetris drops and row clears to maximize the count, or report forever. | Medium7 | GraphDFS+2 | No attempts yet | 4s | 256 MB | Judgeable |
| Yonsei University Point GamePlayers paint tree nodes blue and queries ask for the sum of weighted distances from a node to all painted nodes. | Medium7 | Divide and conquerTree+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Paradox Sort (Large)Given every pairwise candy preference, decide whether some hand-over order leaves Vlad holding candy A and output the lexicographically smallest such order. | Medium7 | GraphDFS+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Full Binary Tree (Large)Delete as few vertices as possible from a given tree so the survivors form a full binary tree with a freely chosen root. | Medium7 | Dynamic programmingTree+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Bacteria (Small)Pick the largest set of grid rooms with no two rooms on consecutive floors sharing a cell position. | Medium7 | GraphBFS+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Bacteria (Large)Pick the most rooms so no two picked rooms share a cell position on consecutive floors. | Medium7 | GraphBFS+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Wi-Fi Tower UpgradeChoose a set of towers to upgrade, where each upgraded tower forces every tower in its range to be upgraded, to maximize the total score. | Medium7 | GraphGreedy+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Mixing Bowls (Large)Given a recipe where each mixture's ingredients are other mixtures, find the minimum number of bowls needed to prepare it. | Medium7 | TreeDFS+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Busiest railway segment (large)Given a tree and Q paths, count how many paths use each edge and report the edge with the maximum count, breaking ties by lexicographic order of endpoints. | Medium7 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Diamond InheritanceProcess class declarations in order, accepting each only if the name is fresh, all parents exist, and no diamond forms. | Medium7 | GraphDFS+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Critical SubprojectsFind every vertex in a DAG that is comparable to all other vertices under reachability. | Medium7 | GraphTopological sort+1 | No attempts yet | 0.6s | 32 MB | Judgeable |
| Tree EditCut one weighted edge of a tree and reattach it elsewhere with the same weight; find the maximum possible diameter. | Medium7 | TreeDFS+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Scrooge Minho 2Given a tree with N cities, place the fewest police stations so that every city and every road is covered, where a station covers its city, its neighbors, and all incident roads. | Medium7 | TreeDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Hongjun and the Tree 2Count the ways to cut edges of a tree so every remaining component has exactly one black vertex, modulo 1e9+7. | Medium7 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Holiday RoadsOn a tree, each of M families picks one of the other N-1 cities uniformly and independently; find the expected number of roads used by every family. | Medium7 | TreeProbability+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Deciphering CharactersDecide whether two binary images represent the same character by comparing their connected components and the containment (surrounds) relations among them. | Medium7 | GraphBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Planar DrawingCheck a proposed certificate: verify an embedding's Euler formula or validate a subgraph as a subdivision of K5 or K3,3. | Medium7 | GraphImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| CodeCoder vs TopForcesEach citizen reaches another through a chain of pairwise wins on at least one of two rating sites; count reachable citizens from each node. | Medium7 | GraphSorting+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Gangsters in Central CityOn a rooted tree, after each update marking a leaf as gangster-held, report the minimum pipes to clog and the fewest innocent houses left dry. | Medium7 | TreeGreedy+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Path MagicFind the simple path in a tree minimizing (product of node values)/(path length), and output the reduced fraction. | Medium7 | MathDFS+1 | No attempts yet | 4s | 256 MB | Judgeable |
| First black vertex on a pathFlip vertex colors and, along the root-to-v path, report the first black vertex encountered from the root. | Medium7 | TreeSegment tree+1 | No attempts yet | 2s | 512 MB | Judgeable |