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 |
|---|---|---|---|---|---|---|
| The Maze MakersValidate hex-encoded grid mazes by checking that the two openings connect, every cell is reachable, and no cycles create multiple paths. | Medium4 | GraphDFS | No attempts yet | 1s | 256 MB | Judgeable |
| QuentoFind a no-revisit path using exactly M digits on the fixed 3x3 board whose left-to-right value equals N and print the lexicographically smallest one. | Medium4 | BacktrackingDFS | No attempts yet | 1s | 256 MB | Judgeable |
| Book ClubDecide whether each of N members can receive a distinct liked book, given M like declarations. | Medium4 | GraphBFS+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Binary Mobile WidthCompute the horizontal width of a balanced binary mobile from rod lengths and bead weights using torque balance. | Medium4 | TreeDFS | No attempts yet | 1s | 256 MB | Judgeable |
| NetworkAdd the fewest edges to a tree so it stays connected after any single edge breaks, pairing leaves in the prescribed DFS order. | Medium4 | TreeDFS+1 | No attempts yet | 1s | 256 MB | Judgeable |
| C.S.I.: P15Count ground-connected 8-connected flower components and isolated /\/\ bird patterns in each ASCII picture. | Medium4 | DFSString matching | No attempts yet | 1s | 256 MB | Judgeable |
| Articulation pointsFind and list in increasing order every vertex whose removal increases the number of connected components in an undirected graph. | Medium4 | DFSGraph | No attempts yet | 1s | 256 MB | Judgeable |
| SV FiltersCompute the max flow between nodes 0 and 1, then remove the size-P edges reachable from node 0 and compute the max flow again. | Medium4 | GraphBFS+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Job AssignmentAssign each of N employees at most one job they can do so the number of finished jobs is as large as possible. | Medium4 | GraphDFS | No attempts yet | 2s | 256 MB | Judgeable |
| Job Assignment 2Assign each of M jobs to one of N employees who can do it with at most two jobs per employee to handle as many jobs as possible. | Medium4 | GraphBFS+1 | No attempts yet | 4s | 256 MB | Judgeable |
| Graph bridgesFind every bridge in a connected undirected graph and print them sorted by endpoint. | Medium4 | DFSGraph | No attempts yet | 1s | 256 MB | Judgeable |
| Candy BombersAssign each pilot to at most one plane they can fly to maximize the number of planes sent. | Medium4 | GraphDFS | No attempts yet | 1s | 256 MB | Judgeable |
| Lowest Common AncestorGiven a rooted tree, answer each query with the number of the deepest vertex that is an ancestor of both given vertices. | Medium4 | TreeDFS | No attempts yet | 3s | 256 MB | Judgeable |
| Lowest Common Ancestor 2Given a rooted tree with up to 100,000 nodes, answer up to 100,000 lowest common ancestor queries. | Medium4 | TreeDFS | No attempts yet | 1.5s | 256 MB | Judgeable |
| Cube IV (Small)Given a square grid holding 1 to S squared, find the smallest start of the longest chain that steps to an orthogonal neighbor one higher and report its length. | Medium4 | DFSDynamic programming+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Minimum Clicks in MinesweeperFind the fewest clicks that reveal every safe cell, since one click opens each zero region and each remaining safe cell costs one click. | Medium4 | DFSGraph+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Diamond Inheritance (Small)Decide whether any pair of classes in each inheritance diagram has two distinct inheritance paths between them. | Medium4 | GraphDFS | No attempts yet | 5s | 512 MB | Judgeable |
| Twibet (Large)In a graph where each monk follows exactly one other, count for every starter how many monks hear the whisper passed down through followers. | Medium4 | GraphDFS | No attempts yet | 5s | 512 MB | Judgeable |
| Watersheds (Small)Given a height grid, follow each cell's outflow to its sink and label cells by shared sink, choosing basin letters to make the row-wise string smallest. | Medium4 | GraphDFS+2 | No attempts yet | 5s | 512 MB | Judgeable |
| The Enemy of My EnemyDecide whether the N people can be split into two camps so that every given hostile pair lands on opposite sides, which is exactly bipartiteness. | Medium4 | GraphBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Scrooge MinhoGiven a tree, place one fire station at the vertex minimizing the maximum distance to any other vertex, and output that distance. | Medium4 | TreeGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| TreeGiven up to 10 graphs, decide for each whether it is a tree, allowing self-loops and duplicate edges. | Medium4 | GraphUnion-find+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Far Far AwayGiven a directed tree rooted at city 1 with weighted edges, find the maximum root-to-node path weight, or -1 if it stays below M. | Medium4 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| A Series of TubesGiven a connected undirected graph, decide whether its edges can be oriented so that the result stays strongly connected. | Medium4 | GraphDFS | No attempts yet | 1s | 512 MB | Judgeable |
| DragsterGiven pairwise win probabilities and a binary elimination bracket, compute the probability that driver 1 wins the tournament. | Medium4 | ProbabilityTree+1 | No attempts yet | 2s | 512 MB | Judgeable |
| CoordinatesGiven differences in x and y between pairs of bases, reconstruct each base's coordinate, fixing base 1 at (0,0). | Medium4 | GraphBFS+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Wheat HarvestFind each connected block of 1s, order blocks by area, and label every cell with its block's rank. | Medium4 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| MoocastEach cow has a point and a broadcast radius; find the starting cow whose one-way reachable set is largest. | Medium4 | GraphDFS+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Company culture 1Given each employee's manager and a list of praises, propagate every praise value down the whole subtree and print the total each employee receives. | Medium4 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Evaluation Order of Assignments (Small)Given assignment statements where each expression is a function call, decide whether some order evaluates every variable, which fails exactly when a dependency cycle exists. | Medium4 | GraphTopological sort+2 | No attempts yet | 5s | 1024 MB | Judgeable |
| EvaluationGiven assignment statements where each value depends on argument variables, decide whether some evaluation order resolves every dependency. | Medium4 | GraphTopological sort+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Prerequisite CoursesGiven prerequisite pairs between courses, find the earliest semester each course can be completed when unlimited courses may be taken per semester. | Medium4 | GraphTopological sort+2 | No attempts yet | 5s | 256 MB | Judgeable |
| Secret Chamber at Mount RushmoreGiven directed letter translations, decide for each pair of words whether every letter of the first can reach the matching letter of the second. | Medium4 | GraphDFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Cut Vertices and BridgesGiven a tree with N vertices and queries, report for each query whether a specified vertex is a cut vertex or a specified edge is a bridge. | Medium4 | TreeDFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Sheba's AmoebasCount the number of disjoint closed loops formed by black pixels on a grid, where each black pixel has exactly two black neighbors among its eight surrounding cells. | Medium4 | GraphDFS | No attempts yet | 2s | 512 MB | Judgeable |
| Police StationIn a directed graph, list every vertex from which all other vertices are reachable by following arrows forward. | Medium4 | GraphDFS+1 | No attempts yet | 2s | 1024 MB | Judgeable |
| League of Overwatch at Moloco (Hard)Given n employees and m conflict pairs, decide whether the employees can be split into two non-empty groups so that no pair shares a group. | Medium4 | GraphDFS+1 | No attempts yet | 2s | 512 MB | Judgeable |
| N-Step SyllogismEach premise says all a are b; for each conclusion x is y, decide whether following the implication chain from x reaches y. | Medium4 | GraphDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Choose your own pathGiven a directed graph of story pages starting at page 1, check whether every page is reachable, then report the shortest distance to any ending page. | Medium4 | GraphBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Coolest Ski RouteGiven a DAG of slopes with condition values, find the maximum total condition along any downhill path. | Medium4 | GraphDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Mooyo MooyoRepeatedly find connected groups of at least K equal nonzero cells on a 10-wide grid, erase them all at once, apply gravity, and print the final board. | Medium4 | DFSSimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Grass PlantingGiven a tree with N fields, plant grass so that no two fields at distance one or two share a type, and output the minimum number of types needed. | Medium4 | TreeGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Milk FactoryGiven a directed tree on N nodes, find the smallest node reachable from every other node, or output -1 if none exists. | Medium4 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Road ConstructionGiven a tree with n countries and weighted edges, sum over all edges of weight times the absolute difference in size of the two components the edge splits the tree into. | Medium4 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| I Will Be Your Bridge!A tree lost one edge, splitting it into two components. Print any pair of islands, one from each component, that reconnects the tree. | Medium4 | GraphDFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Baba is RabbitGiven commands of the form p is q, find all objects reachable from Baba by applying one or more commands, printed in lexicographic order. | Medium4 | GraphDFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Gugu the RaccoonGiven a weighted tree rooted at node 1, find the maximum distance from node 1 to any other node. | Medium4 | TreeDFS+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| EmacsCount the non-overlapping, non-touching rectangles of '*' characters in an N by M grid. | Medium4 | ImplementationArray+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Toy AlliancesGiven N toys and M dislike pairs, decide whether the toys can be split into two alliances so no dislike pair shares a side, which is checking bipartiteness of the graph. | Medium4 | GraphBFS+2 | No attempts yet | 1.5s | 256 MB | Judgeable |
| CocktailGiven a tree of N ingredients linked by N-1 known mass ratios, compute the smallest positive integer masses that satisfy every ratio. | Medium5 | TreeDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Tree DiameterGiven a weighted tree with up to 100,000 vertices, compute the diameter as the maximum distance between any two vertices. | Medium5 | TreeDFS+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Survivable Diagnostic RulesGiven up to 200,000 two-literal rules over 20,000 boolean symptoms, decide via 2-SAT whether an assignment exists that avoids triggering any rule. | Medium5 | GraphDFS+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Farm ManagementCount 8-directionally connected groups of equal-height cells in a grid where every outside neighbor is strictly lower. | Medium5 | BFSDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Finding Notebook OwnersGiven student-laptop candidate pairs, compute the maximum bipartite matching to maximize the number of students who get a laptop they listed. | Medium5 | GraphDFS+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Solving ProblemsGiven N interest values and a rule to move forward by 1 or 2 steps starting at problem 1, find the minimum number of problems solved before the range of solved values reaches at least V. | Medium5 | Dynamic programmingGraph+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Minsik-First SearchImplement a DFS variant that picks the middle unvisited neighbor when their count is odd and the smallest when even, then print the first-visit order from vertex 1. | Medium5 | DFSImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Broken CalculatorStarting from 1 on a calculator limited to D digits, find the largest value reachable after exactly P multiplications by digits 2-9, or report -1 if impossible. | Medium5 | BacktrackingBrute force+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Roads of the Northern CountryGiven the edges of a weighted tree of up to 10,000 cities, compute the length of the tree's diameter (the longest path between two nodes). | Medium5 | TreeGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| HistoryGiven directed precedence edges among up to 400 events, determine for each query pair whether one event's order relative to the other is fixed by transitivity. | Medium5 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| New Year PartyPick a maximum-score guest list from a company tree so no employee and their direct manager both attend, computed with and without the root. | Medium5 | Dynamic programmingTree+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Distance Between VerticesGiven a weighted tree with up to 40,000 nodes, answer up to 10,000 queries about the path distance between two vertices, requiring an LCA-based approach for efficiency. | Medium5 | TreeBinary search+2 | No attempts yet | 2s | 128 MB | Judgeable |
| The Famous Seven PrincessesCount connected 7-cell shapes on a 5x5 grid of S/Y students where at least 4 cells are S. | Medium5 | BacktrackingDFS+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Alphabet PathFind the longest path from the top-left cell of a grid moving to adjacent cells while never revisiting a letter already used, maximizing visited cells. | Medium5 | BacktrackingDFS+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Bug on a TreeGiven a tree with fruit values on vertices, find the maximum sum path (simple path) and its smallest-numbered starting endpoint. | Medium5 | TreeDynamic programming+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Checking CausalityGiven send/receive events across computers with local clocks, detect whether the induced ordering constraints form a cycle indicating a causality violation. | Medium5 | GraphTopological sort+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Tree CuttingGiven a tree with n vertices, find the minimum number of edges to cut so some resulting piece has exactly m vertices, or report impossibility. | Medium5 | TreeDynamic programming+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Height OrderGiven pairwise shorter-than relations between students, count how many students have their exact height rank fully determined by transitivity. | Medium5 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Finding the Middle MarbleGiven pairwise heavier-than relations among N odd marbles, count marbles that must be eliminated as the possible median using transitive closure of the order. | Medium5 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| RestaurantsGiven a graph with up to 100000 nodes and edges, decide if edges can be 2-colored so every vertex of degree at least 2 sees both colors among its incident edges. | Medium5 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Handong Does Not Want to Study!Given a functional graph where each node points to exactly one other node, find the starting node whose path visits the most distinct nodes before repeating, breaking ties by smallest index. | Medium5 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| GemsGiven a tree, assign positive integer prices to vertices so adjacent vertices differ, minimizing total sum, essentially a greedy coloring based on tree structure. | Medium5 | TreeGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| GodfatherGiven an undirected tree, find all vertices that minimize the largest connected component size after removal (the tree centroid(s)). | Medium5 | TreeDFS+1 | No attempts yet | 2s | 64 MB | Judgeable |
| Router Placement to Minimize Maximum TTLGiven a tree, pick the vertex that minimizes the largest distance to any other vertex, and output that minimum maximum distance (the tree's radius). | Medium5 | TreeGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| CaterpillarGiven up to 100 nodes, decide whether the graph is a connected tree whose every node lies on or adjacent to some single path. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Ancient HieroglyphsDecode a hex bitmap, count enclosed white regions (holes) inside each connected black shape, and map each shape's hole count to a hieroglyph code. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 192 MB | Judgeable |
| FrenemiesFor each dataset, sum the signed scores of all simple paths without neutral links between a given person and every other person. | Medium5 | DFSGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Sidewinder Sleeps ToniteGiven a drawn grid of segments and cell numbers, decide whether the drawing is a single closed loop matching every numbered cell. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Signal StrengthFind the maximum signal strength reaching switch N-1 from switch 0 through a switch network with gain or loss multipliers on nodes and edges. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Mobiles AlabamaParse a nested mobile description and compute, for each bar, the tie point that balances the weights hanging from its two sides. | Medium5 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TreesGiven an undirected graph, count its connected components that contain no cycle and report the count per test case. | Medium5 | GraphUnion-find+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Robots on a GridCount monotone right/down paths from the top-left to the bottom-right of an n by n grid with blocked cells, modulo 2^31-1, and report whether the goal is reachable at all, or reachable only with up and left moves allowed. | Medium5 | Dynamic programmingDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Royal SuccessionGiven parent pairs for N people, compute each claimant's inherited fraction of the founder's blood and print the claimant with the largest fraction. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Image SegmentationGiven an H by W color image, band each RGB value by dividing by S, then count 8-connected regions of equal band triples whose pixel size is at least L. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Manito ChainsGiven a permutation of N people, count the number of cycles in its functional graph. The input ends when N is 0. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Road TripGiven a weighted tree rooted at city 1, remove exactly one non-root vertex so the round trip from city 1 covering all remaining cities is shortest, and report that length. | Medium5 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Milk SchedulingGiven task durations and precedence constraints that form a DAG, find the minimum makespan when unlimited workers milk cows in parallel. | Medium5 | GraphTopological sort+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Tea TimeStarting from a graph of known meetings, two cows meet whenever they share a mutual friend, and after all rounds settle, answer queries about whether each pair has met. | Medium5 | GraphUnion-find+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Pasture WalkingGiven a weighted tree with N vertices and Q queries, find the path length between each queried pair of vertices. | Medium5 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Treasure CaveGiven a binary branching from passage 1, find the list of passages on the unique path from the entrance to passage T and its length. | Medium5 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cow ContestGiven the winners of head-to-head matches, count how many cows have a skill rank that is fully forced by the results. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Loathesome Hay BalerRollers touch when center distance equals the sum of radii; find the path from the drive roller to the take-off roller and sum the absolute speeds, truncated. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Die Is CastRead a pixel image, split non-background pixels into dice connected by shared edges, count the dot regions inside each die, and print the counts sorted. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Traffic PlanningGiven a directed graph and a start node, list the nodes not reachable from the start by a path of one or more edges; print OK if none. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Median Weight BeadGiven weighted comparisons between beads, count how many beads cannot be the median because at least (N+1)/2 beads are known heavier or lighter. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SpreadsheetEvaluate each spreadsheet cell, treating formula cells as sums of other cells, and mark any cell involved in a dependency cycle as undefined. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SubsetsGiven inequalities where a set name contains either an element or another set name, find each named set's minimal required elements. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| All Roads Lead Where?Given a tree of cities rooted at Rome and query pairs, print the unique shortest path between each pair as the first letters of the cities on the route. | Medium5 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Tree CuttingOn a tree of N nodes, print every node whose removal leaves each connected piece with at most floor(N/2) nodes, or NONE. | Medium5 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TähekabeOn an N x N letter grid, decide for each of up to 10 query words whether a simple path from the start cell spells it, without reusing a cell. | Medium5 | BacktrackingDFS+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| RailwayGiven a weighted tree, compute the total weight of the unique path between each queried pair of cities. | Medium5 | TreePrefix sum+1 | No attempts yet | 1s | 32 MB | Judgeable |