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 results3,014 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| A graph that times out coloring backtrackingPrint one fixed graph: a 55-vertex clique joined by a path, chosen to make a backtracking coloring solver time out. | Easy1 | GraphImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Friend countsCount the friends of each of N students from M mutual friendship pairs and print the N totals in order. | Easy1 | GraphImplementation | No attempts yet | 1s | 256 MB | Judgeable |
| Hands are faster than computersPrint a fixed 4-vertex, 5-edge graph and a fixed proper 4-coloring, with no input to read. | Easy1 | ImplementationGraph | No attempts yet | 2s | 512 MB | Judgeable |
| Is Dinic quartic?Print a fixed 4-vertex, 5-edge flow network with the exact edges and capacities given in the statement. | Easy1 | GraphImplementation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Find the VerticesAn interactive-style task where a hidden edge between two vertices must be identified by querying the grader; input is fixed by the grader, not read. | Easy1 | GraphImplementation | No attempts yet | 2s | 512 MB | Judgeable |
| VirusCount how many computers other than computer 1 lie in computer 1's connected component of a small undirected graph. | Easy2 | GraphBFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| K-Graph OddityCompute the maximum vertex degree in a graph and output the smallest odd integer greater than or equal to it. | Easy2 | GraphImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Making test data 8Print a specific fixed graph: 98 vertices, 1501 edges forming a complete bipartite graph, using the exact listed edge order. | Easy2 | GraphImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Friend of My Enemy Is My EnemyPrint the direct friends of suspect s in increasing order for each network. | Easy2 | GraphSorting | No attempts yet | 1s | 128 MB | Judgeable |
| Sanggeun's travelsGiven a connected graph of N countries and M flights, find the fewest flights that visit every country. | Easy2 | Graph | No attempts yet | 1s | 256 MB | Judgeable |
| Toroidal gridPrint the given snake sweep of columns 0 to n-2 plus the climb up column n-1 to list a Hamiltonian cycle of the m by n toroidal grid. | Easy2 | ImplementationGraph | No attempts yet | 1s | 256 MB | Judgeable |
| Counting FriendsCount the friends of each of N students from M mutual friendship pairs and print the N totals. | Easy2 | GraphArray | No attempts yet | 1s | 256 MB | Judgeable |
| ITAI VirusCount the initially infected cities plus every city directly joined to one by a single road. | Easy2 | GraphImplementation | No attempts yet | 1s | 256 MB | Judgeable |
| Graph Maximum MatchingGiven a small graph, decide whether some edges can be kept so every vertex has degree exactly 1. | Easy2 | GraphBacktracking+1 | No attempts yet | 2s | 512 MB | Judgeable |
| László BabaiFor each of up to 100 test cases, decide whether two simple graphs on 3 vertices given by their edge lists are isomorphic. | Easy2 | GraphBrute force+1 | No attempts yet | 1s | 256 MB | Judgeable |
| LiesUsing union-find on party attendees, determine which parties can be exaggerated without conflicting with people who must always hear the truth. | Easy3 | Union-findGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| FriendsGiven an N x N friendship matrix (N ≤ 50), find the maximum count of people reachable within two friendship links from any single person. | Easy3 | GraphMatrix+1 | No attempts yet | 2s | 128 MB | Judgeable |
| DFS and BFSGiven an undirected graph, output the vertex visit order for DFS then BFS starting from a given vertex, always preferring the smallest-numbered neighbor. | Easy3 | DFSBFS+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Six Degrees of Kevin BaconGiven an unweighted friendship graph, find the vertex whose sum of shortest distances to all others is minimal, breaking ties by smallest index. | Easy3 | BFSGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Hide and SeekCompute the minimum number of moves to reach position K from N on the number line using BFS with steps +1, -1, or doubling. | Easy3 | BFSGraph | No attempts yet | 2s | 128 MB | Judgeable |
| Travel PlanGiven an adjacency matrix of cities, decide if consecutive cities in a given visit order all lie in the same connected component. | Easy3 | Union-findGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Maze SearchFind the minimum number of cells traversed on a grid path from top-left to bottom-right using BFS shortest path. | Easy3 | BFSGraph+1 | No attempts yet | 1s | 192 MB | Judgeable |
| Kinship DistanceGiven a family forest of parent-child edges, find the shortest kinship distance between two given people or output -1 if unconnected. | Easy3 | GraphBFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Chairperson CandidatesGiven a friendship graph, compute each member's eccentricity via shortest paths and report the minimum eccentricity value with all members achieving it. | Easy3 | GraphBFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Housing Complex NumberingGiven a binary grid, count connected groups of adjacent 1-cells and print the number of groups plus each group's size in ascending order. | Easy3 | BFSGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Keypad PasswordsCount length-N digit sequences on a phone keypad where consecutive digits must be adjacent keys, modulo 1,234,567, for up to N=1000. | Easy3 | Dynamic programmingGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| RadioGiven a start and target frequency plus up to 5 preset shortcut buttons, find the minimum presses using +1, -1, or jump to a preset to reach the target. | Easy3 | GraphShortest path+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Unreachable FunctionsGiven a control flow graph built from three instruction types with fall-through or jump edges, count how many functions are unreachable from the first one. | Easy3 | GraphBFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| GatesGiven an acyclic NAND-gate circuit whose inputs are all tied to one variable x, decide whether the overall output depends on x (answer 1) or is constant (answer 0). | Easy3 | SimulationGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| NetworkingGiven points and weighted candidate cable routes, compute the minimum total cable length needed to connect all points (minimum spanning tree). | Easy3 | Minimum spanning treeGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Modulo SolitaireGiven a modulus m, up to 10 affine maps, and a start s0, find the fewest moves to reach 0. | Easy3 | BFSGraph | No attempts yet | 1s | 128 MB | Judgeable |
| Choose Your Own AdventureEach page is a node with two outgoing choices or a terminal ending; print the unique path from page 1 to the single HAPPY ending. | Easy3 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Great SaharaOn a fixed 54-triangle hex board, decide whether player one can move one pyramid to trap an opponent's pyramid immediately. | Easy3 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Number of IslandsGiven a grid of land and sea cells with 8-directional adjacency, count the connected land components. | Easy3 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Red and BlackCount how many black tiles are reachable from a start tile in a small grid by moving up, down, left, and right. | Easy3 | DFSGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Car TroubleGiven a directed graph of street ids with ring road 0, report streets that cannot reach 0 and streets that 0 cannot reach, preserving input order. | Easy3 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Connected or Not ConnectedGiven a graph with n sites and k edges, decide whether every site can reach every other. | Easy3 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Mining MapsParse each graph block, count distinct node names, and count distinct undirected tunnels including self-loops. | Easy3 | Hash mapGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Asteroid FieldFind the minimum number of moves from the top-left cell to the bottom-right cell in a grid, avoiding asteroid cells. | Easy3 | BFSGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Breed AssignmentCount the breed assignments for N cows under same/different constraints, or report 0 if they conflict. | Easy3 | GraphBacktracking+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Daisy Chains in the FieldGiven an undirected graph of cows joined by ropes, list in ascending order every cow that cannot reach cow 1, or print 0 if all cows are connected to it. | Easy3 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Parcel DeliveryGiven a weighted undirected graph, find the minimum total edge weight along a path from barn 1 to barn N. | Easy3 | Shortest pathGraph | No attempts yet | 1s | 128 MB | Judgeable |
| 3D Space ExplorationCount connected groups of '*' blocks in an N x N x N grid, where blocks connect only across shared faces. | Easy3 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Invasion of the MilkweedSpread milkweed from a start cell to all eight neighbors each week and report the week it covers the last non-boulder cell. | Easy3 | BFSGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Feeding TimeGiven a W by H grid of grass and rock, find the size of the largest connected grass region using 8-directional adjacency. | Easy3 | DFSBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Wheel RotationGiven N-1 belts that chain N pulleys from pulley 1, with each belt either straight (same direction) or crossed (reversed), find the rotation direction of pulley N. | Easy3 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Bad GrassCount connected components of nonzero cells in a grid, where two cells connect if they touch horizontally, vertically, or diagonally. | Easy3 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Best GrassCount clumps of # cells in a grid, where each clump is one cell or two orthogonally adjacent cells and different clumps never touch. | Easy3 | ArraySimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Shipping RoutesGiven warehouses and bidirectional shipping legs, answer each request with the cheapest cost, which is shipment size times the minimum number of legs times 100, or report no route. | Easy3 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SurfingParse links out of HTML pages, print each link, then answer reachability queries between pages. | Easy3 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Making shortest-path test dataPrint the prescribed shortest-path test graph: a chain with a computed number of self-loops at vertex 0, plus Q queries from V-1 to 0. | Easy3 | ImplementationGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Graph that exceeds Dijkstra's counterPrint the exact constructed directed weighted graph that makes Floyd-Warshall finish while the lazy-deletion Dijkstra times out on one query. | Easy3 | GraphShortest path+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Attendance CheckGiven a permutation forming one cycle, find the student who responds last when the calling chain starts at student k. | Easy3 | ImplementationSimulation+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Social Networking ApplicationGiven a friendship graph, answer queries asking whether two users lie in the same connected component. | Easy3 | Union-findGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Subdivision of KingdomSplit n towns (n even, n <= 26) into two halves of equal size so that the number of roads crossing between the halves is minimized. | Easy3 | Brute forceBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| The DanceFind the largest number of boy-girl pairs that can dance at once when each boy may only invite a girl he knows. | Easy3 | GraphDFS | No attempts yet | 1s | 128 MB | Judgeable |
| The HareFind the fewest knight jumps from the start cell to the burrow on a grid with blocked cells, or output NIE when unreachable. | Easy3 | BFSGraph+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Hauling materialCompute the cheapest directed route from the start to the destination for each road network. | Easy3 | Shortest pathGraph | No attempts yet | 1s | 128 MB | Judgeable |
| The Prague LinkCompute the largest shortest-path distance over all pairs of posts, or report that the network is disconnected. | Easy3 | Shortest pathGraph | No attempts yet | 1s | 128 MB | Judgeable |
| CrankCount the boundary rooftops that can reach the boss by moving only to equal or lower adjacent buildings. | Easy3 | BFSGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Strahler orderGiven a river DAG, compute its Strahler order at node M by processing nodes in topological order. | Easy3 | Topological sortGraph | No attempts yet | 1s | 128 MB | Judgeable |
| Who you knowFind the cheapest chain of introductions from politician 0 to politician M-1 in an undirected graph with edge weights 1 to 4, printing -1 when unreachable. | Easy3 | Shortest pathGraph | No attempts yet | 1s | 128 MB | Judgeable |
| Rainforest CanopyCount the groups of 1s connected through all eight neighbours in each square binary image. | Easy3 | DFSGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Bi-coloringCount the two-colorings where every edge joins different colors, or report -1 when the graph is not bipartite. | Easy3 | BFSGraph | No attempts yet | 1s | 128 MB | Judgeable |
| Mystery Graph ColoringColor vertices 0 to V-1 with the smallest color unused by colored neighbors, then print the color count, the colors, and the loop counter. | Easy3 | GraphGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Balance ScaleGiven pairwise heavier-than results, count for each object how many others have no implied comparison. | Easy3 | GraphDFS | No attempts yet | 1s | 256 MB | Judgeable |
| Neighborhoods in GraphsCount the distinct vertices at distance 1 or 2 from a query vertex in an undirected graph, excluding the vertex itself. | Easy3 | BFSGraph | No attempts yet | 1s | 256 MB | Judgeable |
| Algorist ClubThe program gives each unfamiliar pair in input order the lowest free of max-degree-plus-one slots and prints zeros when a pair fits nowhere. | Easy3 | SimulationGraph | No attempts yet | 1s | 256 MB | Judgeable |
| Permutation CyclesCount the disjoint directed cycles in the permutation given in each test case. | Easy3 | GraphDFS | No attempts yet | 1s | 256 MB | Judgeable |
| DOM TV ChannelsPensioners switch the TV from each hated channel to the youngest hater's favorite, and you count switches until the channel stabilizes or repeats. | Easy3 | GraphSimulation | No attempts yet | 1s | 256 MB | Judgeable |
| Cable CleanupFor each test case, keep N minus 1 of the M cables that join N computers into one network and print how many cables go. | Easy3 | GraphMath | No attempts yet | 1s | 256 MB | Judgeable |
| Legacy CodeCount methods unreachable from any PROGRAM method given each method and its direct callers. | Easy3 | GraphBFS | No attempts yet | 1s | 256 MB | Judgeable |
| Your lifeFind the fewest directed moves from node 1 to node N in a graph where every edge goes forward, or report -1 when the goal is unreachable. | Easy3 | BFSShortest path+1 | No attempts yet | 1s | 256 MB | Judgeable |
| One sheep... two sheep...Count the groups of # cells connected up, down, left, or right in each test grid. | Easy3 | DFSGraph+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Pub-lic GoodColor each site pub or house with the specified ordered depth-first search so every site neighbors an opposite color, or print Impossible. | Easy3 | DFSGraph+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Spawn of UngoliantSpiders spread to every tree connected by four-directional adjacency to an infested tree, and isolated trees and open floor stay unchanged. | Easy3 | BFSGraph+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Path FindingDecide for every ordered pair of vertices in a directed graph with up to 100 vertices whether a path of at least one edge connects them. | Easy3 | GraphDynamic programming | No attempts yet | 1s | 256 MB | Judgeable |
| Manhattan Power FailureCount the blocks linked by intact lines into regions and report how many regions hold no generator. | Easy3 | Union-findGraph | No attempts yet | 1s | 256 MB | Judgeable |
| The Game of DeathStarting from player 1, follow the pointed-to players and report the first step that reaches player N, or 0 when it never does. | Easy3 | GraphSimulation | No attempts yet | 1s | 256 MB | Judgeable |
| Relief SuppliesDecide whether any walk starting at intersection 1 in a directed graph can revisit an intersection. | Easy3 | DFSGraph | No attempts yet | 2s | 256 MB | Judgeable |
| Number of connected componentsCount the connected components of an undirected graph given its vertices and edges. | Easy3 | GraphDFS | No attempts yet | 3s | 512 MB | Judgeable |
| Squawk VirusStarting from user s, propagate squawk counts along links for t minutes and report how many squawks are sent at time t. | Easy3 | Dynamic programmingGraph | No attempts yet | 1s | 256 MB | Judgeable |
| Dynamic Grid (Small)Count the edge-connected groups of 1s in a binary grid after each point update by flood fill. | Easy3 | BFSGraph+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Bad Horse (Small 1)Decide for each test case whether members joined by troublesome pairs split into two groups with no pair in one group. | Easy3 | GraphBFS | No attempts yet | 5s | 512 MB | Judgeable |
| Bad Horse (Small2)Decide whether members linked by troublesome pairs split into two groups with no pair inside one group. | Easy3 | GraphBFS | No attempts yet | 5s | 512 MB | Judgeable |
| Sort a scrambled itinerary (Small)Rebuild each shuffled set of flight tickets into the single chain where each arrival matches the next departure. | Easy3 | Hash mapGraph | No attempts yet | 5s | 512 MB | Judgeable |
| Twibet (Small)Starting from each monk in turn, count how many monks hear a whisper that spreads from a monk to all direct and indirect followers. | Easy3 | GraphDFS | No attempts yet | 5s | 512 MB | Judgeable |
| Router 1Print either a star-shaped router with one internal hub or a fully connected bipartite router, depending on whether N*N exceeds P_lim. | Easy3 | GraphImplementation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Router 3Build a router with g groups per layer by printing 2Ng directed edges from inputs to internal nodes and from internal nodes to outputs. | Easy3 | GraphImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Two-color coloringGiven an undirected multigraph, decide whether it is bipartite so its vertices can be colored with two colors. | Easy3 | GraphBFS+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Misimplemented DinicPrint a fixed 4-vertex, 5-edge flow network; there is no input and the output is a single constant graph. | Easy3 | GraphBrute force+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Election of EvilGiven directed persuasion edges and a set of already-controlled representatives, list the reachable members of target set V in alphabetical order. | Easy3 | GraphBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Prison BreakGiven a grid of '+' and '*' huts where movement is allowed only between huts of the same symbol, decide whether the entry hut can reach the exit hut. | Easy3 | GraphBFS+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Vera and Trail BuildingGiven K, follow a fixed greedy decomposition into complete blocks and print the resulting connected trail network with exactly K two-edge-disjoint paths. | Easy3 | GreedyGraph+2 | No attempts yet | 1s | 512 MB | Judgeable |
| BannerCount connected groups of 1s in an M by N grid where cells touching in any of the eight directions belong to the same group. | Easy3 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Tracking Fake NewsModel a story spreading through a social network where each person reposts only if a weighted sum of the story's categories equals their target. | Easy3 | GraphBFS+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Easy Shortest DistanceGiven a grid with one target cell and blocked cells, find the shortest distance from each open cell to the target using 4-directional moves. | Easy3 | BFSGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Paint bucketFlood fill a grid from one pixel, repainting all side-connected pixels sharing the clicked color with a new color, then print the grid. | Easy3 | GraphBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Knight minimum movesGiven two squares on an 8x8 chessboard, output the fewest knight moves needed to get from the first to the second. | Easy3 | BFSGraph+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Xayahh-Rakann at Moloco (Easy)Given n jars and inseparable pairs, decide if exactly k jars can be kept so that no inseparable pair is split across the two groups. | Easy3 | Brute forceGraph+1 | No attempts yet | 2s | 512 MB | Judgeable |