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,012 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| DecisionCount connected dark regions on a grid where each cell is a diagonal half or a full square, connecting only through shared cell edges. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Piggy BanksEach key i sits in some bank; opening a bank frees its keys. Find the minimum number of banks to smash to reach all N banks. | Medium5 | GraphDFS+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Super-Fast Circular RacesGiven a directed graph where each vertex has out-degree and in-degree at most two, count the ways to cover every vertex with vertex-disjoint simple directed cycles, modulo 10000, or report NIE if impossible. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| WarehousesMove goods along tree roads so every warehouse holds the average amount at minimum transport cost. | Medium5 | TreeGreedy+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Frozen SprinklersCut pipes with minimum total force so no water flows from the central node to any leaf sprinkler in the tree. | Medium5 | Dynamic programmingTree+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Term ProjectEach student picks exactly one partner, only directed cycles form teams, so count the students outside all cycles. | Medium5 | DFSGraph | No attempts yet | 3s | 256 MB | Judgeable |
| CSS Selector MatchingGiven a nested div document and up to five CSS selectors with descendant and child combinators, print the matching element ids in document order. | Medium5 | TreeDFS+1 | No attempts yet | 10s | 256 MB | Judgeable |
| Senior PostmenThe program replays the given stack walk on the street graph and prints each cycle it extracts in order. | Medium5 | SimulationGraph+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Jury JeopardyReconstruct the ASCII tree maze that yields each given right-hand-rule robot walk. | Medium5 | SimulationDFS+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Intrepid climberStarting from the root of a weighted tree, visit all marked nodes with free descents and costly climbs at minimum total energy. | Medium5 | TreeDFS+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Magneto MagnetsDecide whether all magnets can join into one closed chain with matching polarities at every joint. | Medium5 | GraphDFS | No attempts yet | 1s | 256 MB | Judgeable |
| Cactus or notDecide whether a connected undirected graph is a cactus where each vertex lies on at most one simple cycle. | Medium5 | DFSGraph | No attempts yet | 1s | 32 MB | Judgeable |
| PipesFind every pipe whose removal disconnects the spring network and print them sorted by endpoint numbers. | Medium5 | DFSGraph | No attempts yet | 2s | 32 MB | Judgeable |
| Cantina of BabelGiven each character's spoken and understood languages, remove as few characters as possible so every remaining pair can exchange messages through translators. | Medium5 | GraphDFS | No attempts yet | 2s | 256 MB | Judgeable |
| BoggleFind every dictionary word that can be spelled on each letter grid with adjacent cells and no cell reused, treating q as qu. | Medium5 | BacktrackingTrie+1 | No attempts yet | 1s | 256 MB | Judgeable |
| CheckersFind the Black piece that captures every White piece in one chained jump, or report Multiple or None. | Medium5 | BacktrackingDFS+1 | No attempts yet | 2s | 256 MB | Judgeable |
| CheckersCount the black kings that can capture all white kings in one chain of diagonal jumps. | Medium5 | BacktrackingDFS | No attempts yet | 2s | 256 MB | Judgeable |
| Fairland (Small)Marie keeps the largest manager-closed team containing herself whose salaries span at most D. | Medium5 | TreeDFS+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Technology PlanningPlan the smallest set of technologies covering every goal plus its dependencies, then print the lexicographically smallest valid research order. | Medium5 | Topological sortGraph+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Watersheds (Large)Each cell drains to its lowest neighbor, sinks define basins, and each basin gets the letter that makes the row-major label string smallest. | Medium5 | GraphDFS+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Cheating a Boolean Tree (Large)Given a complete binary tree of AND/OR gates with fixed leaf values, find the fewest changeable gates to flip so the root equals V, or report IMPOSSIBLE. | Medium5 | Dynamic programmingTree+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Traffic (Small)Given a tree and Q tickets, count how many tickets use each edge along the unique path, then report the edge with the largest count (smallest station pair on ties). | Medium5 | TreePrefix sum+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Bus RoutesOn a tree with N stops, every ordered pair sends a bus along the unique path; for each stop count how many of the N(N-1) buses halt there, including endpoints. | Medium5 | TreeMath+1 | No attempts yet | 3s | 1024 MB | Judgeable |
| ABCDEGiven an undirected friendship graph, decide whether it contains a simple path of five distinct vertices, that is, a path with four edges. | Medium5 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Aurora PrincessGiven each person's parents and a list of people who die or leave the country, count how many remain alive with both parents alive in Korea. | Medium5 | GraphDFS+1 | No attempts yet | 1s | 32 MB | Judgeable |
| DwarvesGiven strict size comparisons between named dwarves, decide whether the statements are mutually consistent. | Medium5 | GraphTopological sort+2 | No attempts yet | 2s | 512 MB | Judgeable |
| PercolationGiven an M by N grid of conducting (0) and blocking (1) cells, decide whether any conducting cell in the top row connects to a conducting cell in the bottom row through edge-adjacent conducting cells. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Youngest BossGiven a directed acyclic chain of command, process swaps of two employees and report the age of the youngest superior of a queried employee, or * if none exists. | Medium5 | GraphDFS+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Minimum number of islandsGiven a grid of land, water, and cloud cells, find the minimum possible number of 4-connected land islands if every cloud can be either land or water. | Medium5 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| It's Raining, ManGiven a set of distinct cards, decide whether they can be ordered in a row so that each neighbouring pair shares a rank or a suit. | Medium5 | GraphDFS | No attempts yet | 2s | 512 MB | Judgeable |
| Spreadsheet CalculatorCompute the value of every cell in a spreadsheet where cells hold either a non-negative number or a sum formula referring to other cell addresses, with no circular references. | Medium5 | GraphDFS+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Company Culture 2Given a tree of boss relations, apply subtree-wide praise additions in real time and answer point total queries. | Medium5 | TreeDFS+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Company Culture 3Employees sit in a rooted tree. A praise of w given to employee i from a subordinate adds w to i and every ancestor up to the president; type 2 queries ask an employee's running total. | Medium5 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Project SchedulingGiven each task's duration and its prerequisite tasks, find the minimum total time to finish the whole project. | Medium5 | Topological sortDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sweet, sour, bitter, saltyCut edges of a rooted binary tree so that at least X resulting components each contain at least K nodes, minimizing total cut cost. | Medium5 | TreeDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Roasting Emma is a barista tooGiven a weighted tree, compute for every vertex the sum of shortest distances to all other vertices. | Medium5 | TreeDFS+2 | No attempts yet | 1.5s | 128 MB | Judgeable |
| Family TreeGiven a set of mother-child pairs, classify the relationship between two cows as siblings, direct ancestor, aunt, cousins, or unrelated, following a fixed rule order. | Medium5 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Pants On FireGiven n true statements of the form "a are worse than b" that form a partial order, classify each of m queries as Fact, Alternative Fact, or Pants on Fire by transitive reachability. | Medium5 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Jumping King Jelly (Small)Given an N by N board with jump numbers, move only right or down from the top-left and reach the bottom-right, or report failure. | Medium5 | DFSBacktracking+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Sheba's AmoebasCount closed loops of # pixels in an m by n image, where loops may be nested but never touch or overlap. | Medium5 | DFSGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Seungbeom CorporationMaintain balances on a company mentor tree while updates add a value to one employee and every employee below them. | Medium5 | TreeDFS+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Two DotsGiven a grid of colored dots, decide whether any cycle of four or more same-colored dots exists, where consecutive dots touch by an edge. | Medium5 | DFSGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Divide by 3, Multiply by 2Given a shuffled copy B of the sequence produced by a divide-by-3, multiply-by-2 game, reconstruct the original order A. | Medium5 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Icy PerimeterFind the connected component of '#' cells with the largest area, breaking ties by smallest perimeter, where perimeter counts all edges touching non-component cells including holes. | Medium5 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Escape the MazeEach cell holds a direction to the next cell; count how many starting cells eventually leave the N by M grid. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Drug Investigation UnitGiven a directed supply graph and a set of arrested suppliers, count how many remaining suppliers still receive drugs from some origin. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Promoting a ClubGiven a forest, choose the fewest vertices so that every vertex is either chosen or adjacent to a chosen one (minimum dominating set on a forest). | Medium5 | TreeDynamic programming+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Unstable SubstancesEach substance conflicts with exactly one other; choose a subset with no conflicting pair to maximize total weight. | Medium5 | GraphDynamic programming+2 | No attempts yet | 1.2s | 256 MB | Judgeable |
| Search EngineGiven directed links between websites, compute one website's trust score by summing scores of linking sites only when no cycle would result. | Medium6 | GraphDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| News BroadcastGiven a rooted tree, each informed employee calls one subordinate at a time, each call lasting one minute; find the minimum time until every employee knows the news. | Medium6 | TreeDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Word PuzzleCount how many words from a fixed dictionary can be spelled by paths of adjacent, non-repeating cells in a 5x5 letter grid. | Medium6 | TrieBacktracking+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Euler CircuitGiven an adjacency matrix with possible multi-edges, output a valid Euler circuit or -1 if none exists. | Medium6 | GraphDFS+1 | No attempts yet | 3s | 512 MB | Judgeable |
| Sum of Tree Path WeightsGiven a weighted tree, compute the sum over all vertex pairs of the product of edge weights along their connecting path, modulo 1e9+7. | Medium6 | TreeDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Making Roads One-WayDecide if every two-way road between N cities can be made one-way so that no directed cycle remains in the whole road network. | Medium6 | GraphDFS+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Number Connection PuzzleFind a Hamiltonian path on an m by n grid (both even, up to 8) connecting two given endpoints, moving only to adjacent cells without crossing itself, or report -1. | Medium6 | BacktrackingGraph+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Garden PruningFind the minimum number of edge cuts needed to prune a tree down to exactly m vertices while keeping it connected. | Medium6 | Dynamic programmingTree+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Painting RoofsGiven a tree of houses and M paint costs, assign a color to every house minimizing total cost so that adjacent houses have different colors. | Medium6 | Dynamic programmingTree+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Finding the Maximum Score PathFind the maximum-score simple path from the top-left to bottom-right cell of an N x N grid moving only in four directions without revisiting cells. | Medium6 | BacktrackingDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Greedy PandaFind the longest strictly increasing path through adjacent cells in an n x n grid using memoized DFS. | Medium6 | DFSDynamic programming+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Finding SnakesCount connected 1-shapes in a grid that form a simple path (snake) with no possible one-cell extension at either end. | Medium6 | GraphDFS+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Cactus GraphGiven a graph described by edge-paths, verify it is a cactus and count connected spanning subgraphs that remain cactus graphs. | Medium6 | GraphDFS+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Strongly Connected ComponentsCompute all strongly connected components of a directed graph with up to 10,000 vertices and 100,000 edges, printing each component sorted, ordered by its smallest vertex. | Medium6 | GraphDFS | No attempts yet | 2s | 128 MB | Judgeable |
| Molecule DecompositionFind the minimum number of edge cuts on a tree needed to isolate a connected subtree of exactly M nodes. | Medium6 | TreeDynamic programming+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Rock Paper ScissorsGiven N students each with two literal-style predictions (turn, gesture) among only rock/scissors, decide if a gesture sequence exists satisfying at least one prediction per student, essentially 2-SAT. | Medium6 | GraphUnion-find+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Work ProcessGiven a tree of supervisors, compute the tree height and the maximum number of nodes removable while keeping tasks completable within that same height using limited workers per time slot. | Medium6 | TreeGreedy+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Apple TreeGiven a DFS 0/1 traversal string of a tree and two marked positions, find the smallest subtree (by matching visit/return indices) that contains both marked vertices. | Medium6 | TreeStack+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Adventure GameGiven a maze of rooms with gold-boosting or gold-costing conditions, decide if room n is reachable from room 1 following graph edges under gold constraints. | Medium6 | GraphBFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Unknown PolygonReconstruct the boundary cycle of a triangulated (or diagonal-split) convex N-gon from its unordered edge and diagonal list, starting at label 1 with the smaller second label chosen. | Medium6 | GraphDFS+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Mirror-Symmetric Tree GraphDecide whether a given connected graph can be formed by gluing a rooted tree to its mirrored copy at every non-root leaf. | Medium6 | GraphTree+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Salary Management at a Car FactoryGiven a company tree with salary updates that add a value to all subordinates of a node and queries for a single employee's current salary, answer efficiently using an Euler tour and a range-update point-query structure. | Medium6 | TreePrefix sum+1 | No attempts yet | 1s | 256 MB | Judgeable |
| No U-TurnsGiven a grid with roads and buildings, decide if every road cell is free of dead ends by checking whether from each road cell you can return without an immediate U-turn. | Medium6 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Debt Settlement in Wonseop CityGiven a functional graph where each citizen owes money to exactly one creditor, find the minimum total money injected so all debts can be paid via chains of repayments. | Medium6 | GraphGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Detective HongzGiven a DAG of causal relations and a set of known events, determine every additional event forced to have occurred by forward implication and the backward rule that a caused event needs at least one occurring predecessor. | Medium6 | Topological sortGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Tournament Rank RangeGiven a single-elimination bracket's match winners, determine each queried player's best possible and worst possible final ranking consistent with the known beat relations. | Medium6 | TreeDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Fair DistributionGiven a tree of farmers with equal initial money and required amounts, find the minimum number of edge transactions, in valid order, to make everyone reach their requirement. | Medium6 | TreeGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Coin StatementsGiven L positions and N clauses of the form (position i is X) OR (position j is Y), reconstruct any assignment satisfying all clauses, or report impossibility (2-SAT). | Medium6 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| ONEFind the minimum fuel a plough starting at a fixed node needs to traverse every edge of a weighted tree at least once, ending anywhere. | Medium6 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| MessengersGiven a tree with per-city messenger costs, compute for every city the minimum time to relay a message to the root via edge lengths and messenger switching costs. | Medium6 | TreeDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| TriangulationGiven a triangulated colored convex polygon, find the maximum number of triangulation diagonals that can be cut without separating same-colored triangles. | Medium6 | Union-findGraph+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Galaxy InterconnectionGiven a low-degree graph with a proper k-coloring, output -1 if any edge shares a color, otherwise count vertices that start a simple path of k vertices visiting all k colors. | Medium6 | GraphDFS+1 | No attempts yet | 3s | 256 MB | Judgeable |
| IdolGiven judges' two-literal votes as a 2-SAT instance, decide if there's a valid advance/eliminate assignment where contestant 1 advances and no judge's clause is fully violated. | Medium6 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Common Subexpression EliminationCompress a labeled binary expression tree into a minimal DAG by merging identical subexpressions and print it with backreference numbers to earlier nodes. | Medium6 | Hash mapTree+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Moving to NurembergGiven a weighted tree and visit frequencies at some nodes, find the node minimizing total weighted round-trip distance and list all optimal nodes. | Medium6 | TreeDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| System EngineerGiven jobs each with a set of eligible servers, compute the maximum bipartite matching size assigning jobs to distinct servers. | Medium6 | GraphBFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Cycles of LanesGiven a connected graph where every edge lies in at most one simple cycle, find the length of the longest simple cycle across all test cases. | Medium6 | GraphDFS+1 | 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 |
| Perfect Election!Given boolean 2-SAT style clauses over candidates being elected or not, determine if a satisfying election outcome exists. | Medium6 | GraphDFS+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Monster TrapGiven up to 100 line segments around the origin, decide whether they form a closed barrier that completely encloses the origin with no gap for the monster to escape through. | Medium6 | GeometryGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Soccer TacticsGiven a directed graph, find every vertex from which all other vertices are reachable, or report that none exists. | Medium6 | GraphDFS+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Show Me the MoneyGiven consistent exchange rates among at most 8 currencies and a requested amount, find the substitute currency giving the smallest value that is at least the request, using at most 100000 units. | Medium6 | GraphDFS+2 | No attempts yet | 3s | 128 MB | Judgeable |
| MobileGiven a mobile's arm structure and pivot distances, find the smallest integer weights, with a named weight at least w, that keep every arm balanced. | Medium6 | TreeMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Jack of All TradesGiven directed trades between items, find the minimum exchange ratio from one item to another using at most 9 trades, and count the chains achieving it. | Medium6 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Knockout TournamentGiven knockout tournament results, find the best and worst possible rank each queried player could hold under a transitive beat relation. | Medium6 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| A Walk Through the ForestCount the number of routes from intersection 1 to 2 in an undirected weighted graph where each step strictly decreases the shortest distance to intersection 2. | Medium6 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Marbles on a TreeGiven a rooted tree where each vertex has a box and the total marbles equal the number of vertices, find the minimum number of moves (along edges) so every box holds exactly one marble. | Medium6 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| BounceFind the shortest non-self-intersecting path on a hex grid from the top row to the bottom and back to the top row on the right, whose letters form a repeated pattern of given length. Example | Medium6 | DFSBacktracking+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Writers' ClubFor each writer, recommend every writer reachable through the favorites graph to readers who favor a writer that reaches this one, excluding self and existing favorites. | Medium6 | GraphDFS+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Newton's AppleParse two binary trees from post-order tokens with nil markers, then decide whether one can be turned into the other by swapping left and right children at any nodes. | Medium6 | TreeRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Off BalanceGiven a 2D grid of digit-labeled blocks, group 4-block pieces, build the support tree, and check each piece's accumulated center of mass against its bottom-column span. | Medium6 | DFSTree+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Curling 2.0On a grid with destructible blocks, find the fewest throws to slide a curling stone from start to goal, where each slide continues until it hits a block or leaves the board. | Medium6 | DFSBacktracking+2 | No attempts yet | 3s | 128 MB | Judgeable |