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 results901 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| Array EscapeFind the cheapest right-and-down path through a square grid where stepping to a higher or equal neighbor costs the raises needed to exceed it. | Easy3 | Dynamic programmingShortest path+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Snakes and Ladders GameOn a 10x10 board with ladders and snakes, find the fewest die rolls to move from square 1 to square 100, where each roll advances 1 to 6. | Easy3 | BFSGraph+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Tower AttackGiven towers that can relay energy over short hops with 50% loss per hop, compute the maximum damage reachable towers can deal to an enemy using multi-source BFS. | Medium4 | BFSGraph+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Highway ShortcutsCompute the minimum driving distance from position 0 to D on a highway with up to 12 one-way shortcuts that skip forward sections. | Medium4 | Shortest pathGraph+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Parcel RoutingGiven a weighted graph, compute for every pair of hubs the next hub to visit on a shortest path using all-pairs shortest paths. | Medium4 | Shortest pathGraph+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Shortest PathCompute single source shortest paths from a given vertex in a directed weighted graph with up to 20,000 vertices and 300,000 edges, printing INF for unreachable vertices. | Medium4 | Shortest pathGraph+1 | No attempts yet | 1s | 256 MB | Judgeable |
| WormholesGiven roads with positive weights and wormholes with negative weights, detect whether any negative cycle exists in the resulting directed graph using Bellman-Ford. | Medium4 | Shortest pathGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Minimum Cost PathGiven a directed weighted graph of cities and bus routes, compute the minimum cost path from a start city to a destination city. | Medium4 | Shortest pathGraph+1 | No attempts yet | 0.5s | 128 MB | Judgeable |
| Exercise RouteFind the minimum weight cycle in a directed graph with up to 400 vertices, essentially detecting the shortest cycle via all-pairs shortest paths. | Medium4 | Shortest pathGraph+1 | No attempts yet | 2s | 192 MB | Judgeable |
| Building a TreeFind a spanning tree rooted at R that minimizes the sum of parent degrees over all non-root vertices, using a BFS-like greedy shortest path with degree as edge weight. | Medium4 | Shortest pathGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Galaxy MeetingGiven weighted graphs and multiple starting galaxies, find the meeting galaxy that minimizes the sum of squared shortest distances from all participants. | Medium4 | Shortest pathGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Wally WorldTwo points in a plane must meet while a single axis-parallel wall segment blocks the straight path; compute the minimum meeting time. | Medium4 | GeometryMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SubwayFind the shortest travel time from home to school using walking and subway lines, rounding the answer to the nearest minute. | Medium4 | Shortest pathGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Is the Kid in Green Zelda?Find the minimum total cost path from the top-left to the bottom-right cell of an N x N grid where each cell's value is paid when visited. | Medium4 | GraphShortest path+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Here We Go(relians) AgainFind the shortest travel time across a grid of streets with posted integer speeds, one-way rules, and closed roads. | Medium4 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ElevatorAn elevator with buttons that move up U or down D floors, staying within floors 1 to F, needs the minimum presses to go from floor S to floor G. | Medium4 | BFSGraph+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Emergency ResponseGiven a directed weighted graph, answer multiple queries: the shortest travel time from any of several start nodes to one crime intersection. | Medium4 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Quick out of the HarbourFind the shortest time from S to outside the grid, where water cells cost 1 and drawbridges cost 1+d, on a grid up to 500x500. | Medium4 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| CheeseIn a grid maze, find the total shortest walking time for a mouse to eat cheeses of hardness 1 through N in order, each raising its strength by one. | Medium4 | BFSGraph+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Heat WaveGiven an undirected weighted graph, find the minimum total cost of a route from a source town to a destination town. | Medium4 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Chivalrous CowFind the fewest knight-move jumps on an X by Y grid with obstacles to get from the start square to the hay bale. | Medium4 | BFSGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Hide and SeekIn a connected undirected graph, find the barn farthest from barn 1. Print the smallest such barn number, its distance, and how many barns tie at that distance. | Medium4 | GraphBFS+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Going to Meet SinaGiven up to 10^4 blocked cells on a bounded grid, find the shortest 4-directional path from (0,0) to (X,Y) avoiding all puddles. | Medium4 | BFSGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Clear and Present DangerGiven a danger matrix and a required sequence of islands, find the minimum total danger of a walk that visits those islands in order, allowing detours through others. | Medium4 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Bronze Cow PartyGiven a connected undirected weighted graph, find twice the largest shortest-path distance from a fixed farm X, which is the longest round trip any cow makes. | Medium4 | Shortest pathGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| RiskGiven a 20-country border graph, answer queries for the fewest countries to conquer when moving from one country to another, counting the destination. | Medium4 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Sangbeom BuildingGiven a 3D grid of blocked and open cells with a start and an exit, find the minimum number of moves (or report impossible). | Medium4 | BFSGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Knight MovesFor each pair of squares, find the minimum number of knight moves between them on a standard 8 by 8 chessboard. | Medium4 | BFSGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Gregory the GrasshopperFind the fewest knight moves from one square to another on a grid of up to 100 by 100, or report that it is impossible. | Medium4 | BFSGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Knight HopOn an 8 by 8 board, find the fewest knight moves from a start square to a target square. | Medium4 | BFSGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| The Mysterious X NetworkGiven an undirected graph of N people, find the minimum number of intermediate people on a shortest path between two given people. | Medium4 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Knight's MoveGiven an l by l board and two squares, find the minimum number of knight moves between them. | Medium4 | BFSGraph+1 | No attempts yet | 1s | 256 MB | Judgeable |
| SSSP (Shortest Path Queries)Run the given SPFA shortest-path algorithm for each query and also output a push counter that accumulates across all queries. | Medium4 | Shortest pathGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| RestaurantsEvery city connects by weighted roads and some hold restaurants; report the largest distance from any city to its closest restaurant. | Medium4 | Shortest pathGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Indiana Jones Among the ZombiesEvery turn each zombie steps toward chamber 1 along a shortest path, and you find the first turn with more than K arrivals or confirm Indiana survives. | Medium4 | BFSShortest path+1 | No attempts yet | 6s | 128 MB | Judgeable |
| Escape the Maze with a DrillDecide whether a robot can reach the target on a grid by drilling through at most k walls. | Medium4 | Shortest pathBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Hoo's Afraid of the Big Bad Wolf?Find the directed path from X to Y with the largest product of edge safety probabilities, printed rounded to six decimals. | Medium4 | Shortest pathGraph | No attempts yet | 1s | 128 MB | Judgeable |
| FenceFrom outside the grid, compute every empty cell's minimum fence breaks with 0-1 BFS, then report the largest value and how many cells attain it. | Medium4 | Shortest pathBFS+2 | No attempts yet | 2s | 64 MB | Judgeable |
| Enterprise EscapeStarting from E, move four-directionally across the grid paying each entered cell's class cost and escape through the cheapest border cell. | Medium4 | Shortest pathMatrix+1 | No attempts yet | 10s | 256 MB | Judgeable |
| Metro Manila DetourCompute the shortest driving distance between two intersections on concentric ring roads and radial roads with one ring and one spoke closed. | Medium4 | Shortest pathGraph | No attempts yet | 5s | 128 MB | Judgeable |
| Vacuum WorldTwo cleaners with different power and move costs roam a row of rooms and suck dirt, and the goal is the cheapest move-and-suck sequence that cleans every room. | Medium4 | Shortest pathBrute force+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Vacation PlanningFor each query, find the cheapest directed flight route from start to end that visits at least one hub, then report the count and total cost. | Medium4 | Shortest pathGraph | No attempts yet | 1s | 128 MB | Judgeable |
| TourismVisit the given sights in order on a grid with extra northeast diagonals and minimize the total number of road segments traveled. | Medium4 | Shortest pathMath | No attempts yet | 1s | 128 MB | Judgeable |
| GatesFind the minimum travel time for each query pair of gates using walking and directed walkways. | Medium4 | Shortest pathGraph | No attempts yet | 2s | 256 MB | Judgeable |
| HackingStarting from the hacked computer, count reachable computers through dependency edges and report the longest infection time. | Medium4 | Shortest pathGraph+1 | No attempts yet | 2s | 256 MB | Judgeable |
| HikingFind the cheapest 8-direction path from the start to the highest cell of a height grid where flat steps cost 1 and a height change of d costs (d+1) squared. | Medium4 | Shortest pathGraph+1 | No attempts yet | 3s | 256 MB | Judgeable |
| Button BashingPress add and subtract buttons from 0, clamped between 0 and 3600, to reach a target time in the fewest presses or the nearest reachable longer time. | Medium4 | BFSShortest path+1 | No attempts yet | 1s | 256 MB | Judgeable |
| The Mountain of Gold?Decide whether portal hops from mountain 0 can return to mountain 0 at a strictly earlier time. | Medium4 | Shortest pathGraph | No attempts yet | 1s | 256 MB | Judgeable |
| Human CannonballFind the fastest route from start to target by running at 5 m/s and chaining optional 50-meter cannon shots that cost 2 seconds each. | Medium4 | Shortest pathGraph | No attempts yet | 1s | 256 MB | Judgeable |
| Trapezoid WalkwayFind the cheapest chain of trapezoid stones joining two given widths, where each stone links its two edge lengths at a cost tied to its area. | Medium4 | Shortest pathGraph | No attempts yet | 2s | 256 MB | Judgeable |
| Flowery TrailsAdd twice the length of every trail that lies on some shortest route from point 0 to point P-1. | Medium4 | Shortest pathGraph | No attempts yet | 2s | 256 MB | Judgeable |
| WormholesGiven planet coordinates and directed zero-cost wormholes, report the shortest travel distance for each queried planet pair. | Medium4 | Shortest pathGraph+1 | No attempts yet | 5s | 256 MB | Judgeable |
| ElevatorsFind the shortest total ride distance from the start floor to the target floor by switching between elevators that each serve only certain floors. | Medium4 | Shortest pathGraph | No attempts yet | 2s | 256 MB | Judgeable |
| Travelling TomFind the cheapest route that starts at the first listed city, visits every city in the given order using any connecting flights, then returns to the start. | Medium4 | Shortest pathGraph | No attempts yet | 1s | 256 MB | Judgeable |
| The Party That Never EndsFor each query, decide whether the shortest travel time from hall A to hall B fits within C using all-pairs shortest paths. | Medium4 | Shortest pathGraph | No attempts yet | 2s | 256 MB | Judgeable |
| FloydFor every pair of n cities, compute the cheapest directed bus fare from up to 100,000 routes and print 0 where no route connects them. | Medium4 | Shortest pathGraph+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Baegyang Road BreakGiven a graph with one-way and two-way roads, answer many queries for the minimum number of one-way roads to reverse to reach each destination. | Medium4 | Shortest pathGraph | No attempts yet | 1s | 256 MB | Judgeable |
| Time MachineCompute the fastest times from city 1 over bus routes with possibly negative durations, or print -1 when a reachable negative cycle exists. | Medium4 | Shortest pathGraph | No attempts yet | 1s | 256 MB | Judgeable |
| gCampus (Small)For each road, decide whether it lies on a shortest path between some pair of offices and list the ones that never do. | Medium4 | Shortest pathGraph | No attempts yet | 5s | 512 MB | Judgeable |
| Taking Metro (Small)Find the fastest route between two metro stations, combining per-line boarding waits, ride times, and tunnel walks. | Medium4 | Shortest pathGraph | No attempts yet | 5s | 512 MB | Judgeable |
| Meeting Point (Small)Friends with different speeds start from given cities and must meet in one city, so minimize the worst arrival time over all cities. | Medium4 | Shortest pathGraph | No attempts yet | 5s | 512 MB | Judgeable |
| Weekly MeetingFor each member's house, add the shortest distances to two fixed nodes and sum all results, counting unreachable as -1. | Medium4 | Shortest pathGraph+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Teleport 3Find the shortest travel time on a grid where you can walk one unit per second or take any of three two-way teleports costing 10 seconds each. | Medium4 | GraphShortest path+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Nailro Rail Pass TripCompare the cheapest itinerary cost with and without a rail pass that discounts some fares, and decide if the pass is worth it. | Medium4 | Shortest pathGraph | No attempts yet | 1s | 512 MB | Judgeable |
| Secret MeetingGiven a weighted undirected graph and K friends' rooms, pick the room minimizing the sum of shortest-path distances from all friends; break ties by smallest room. | Medium4 | Shortest pathGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| The nearest convenience storeGiven an undirected weighted graph with some vertices marked as homes and others as stores, pick the home whose shortest-path distance to the nearest store is smallest, breaking ties by vertex number. | Medium4 | GraphShortest path+2 | No attempts yet | 2s | 512 MB | Judgeable |
| When Geudae Becomes GeumeoGiven N characters and M replacement pairs, find the minimum number of substitutions needed to convert character a into character b. | Medium4 | GraphBFS+1 | No attempts yet | 2s | 512 MB | Judgeable |
| The fastest road to BanikoaraGiven towns joined by undirected weighted roads, find the shortest travel distance between a named departure town and destination town. | Medium4 | GraphShortest path+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Chonggang ChonggangRun a single-source shortest path from Jinseo's house, find the nearest type A and type B house, and report the closer type (A wins ties). | Medium4 | Shortest pathGraph+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Sogang GroundGiven a weighted undirected graph, find a region whose total item count within distance m is largest. | Medium4 | GraphShortest path+1 | No attempts yet | 1s | 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 |
| Death KnightFind the minimum number of moves for a knight-like piece with six fixed moves to travel between two squares on an N by N board, or -1 if unreachable. | Medium4 | BFSGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Why the Williamson's Sapsucker Came Up to Information IslandOn a grid with walls, find which of three food cells is nearest to the start cell 2, and print TAK with that distance, or NIE if none is reachable. | Medium4 | BFSGraph+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Small World NetworkGiven a graph of N people and K friendships, check whether every pair of people is connected within 6 steps, printing Small World! or Big World! accordingly. | Medium4 | GraphBFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Finding Cities at a Specific DistanceGiven a directed unweighted graph, print every city whose shortest distance from a start city equals K, in increasing order, or -1 if none exist. | Medium4 | GraphBFS+1 | No attempts yet | 2s | 256 MB | Judgeable |
| RUNGiven a directed weighted graph of N cells, one exit cell E, and a time limit T, count how many cells have a path to E within T time units. | Medium4 | GraphShortest path+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Metro 2345Given three metro lines meeting at three transfer stations with per-line edge times and a transfer cost, find the shortest travel time between two given stations. | Medium4 | Shortest pathGraph+2 | No attempts yet | 1s | 512 MB | Judgeable |
| PartyGiven a directed weighted graph, compute for each village the round-trip shortest time to a fixed village X and return the maximum over all villages. | Medium5 | Shortest pathGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Wall-Breaking MazeFind the minimum number of walls to break on a grid path from the top-left to the bottom-right room, moving through 4 directions. | Medium5 | BFSShortest path+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Hopping FrogFind the minimum number of jumps for a frog moving between numbered stones, where each stone's value dictates allowed jump distances as multiples. | Medium5 | BFSGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Sunday Morning DateFind a grid path from S to F that first minimizes the number of trash cells stepped on, then minimizes clean cells adjacent to trash along that path. | Medium5 | Shortest pathBFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Shortest Path Through Required VerticesGiven a weighted undirected graph, find the shortest path from vertex 1 to vertex N that must pass through two specified vertices. | Medium5 | Shortest pathGraph+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Dog DaysGiven bunkers on a plane and a speed and survival-time limit, find the minimum number of intermediate bunkers a chicken must visit to reach a target bunker, or report it cannot escape. | Medium5 | GraphBFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Maal GatheringGiven a grid with K-Maal pieces that jump up to K knight moves per turn, find the minimum total moves to gather all pieces on one square. | Medium5 | BFSShortest path+2 | No attempts yet | 2s | 128 MB | Judgeable |
| HighwayGiven a directed graph with edge lengths and tolls, find the minimum length path from city 1 to city N whose total toll does not exceed a budget K. | Medium5 | Dynamic programmingGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Mountain BikeFind the minimum travel time from top-left to bottom-right of a grid where each move's duration depends on cumulative speed changes from height differences, solvable via Dijkstra with speed encoded as exponent sums. | Medium5 | Shortest pathGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Move by Breaking One WallFind the shortest path in a grid from top-left to bottom-right where you may break at most one wall along the way. | Medium5 | BFSGraph+1 | No attempts yet | 2s | 192 MB | Judgeable |
| Circuit RoutingFind the minimum-cost grid path between two given cells where empty cells cost 1 and cells already occupied by given rectilinear circuits cost k, then output the path in compressed turn-point form. | Medium5 | Shortest pathBFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Making a MazeFind the minimum number of black cells to convert to white so a path exists from top-left to bottom-right of an n x n grid, using 0-1 BFS or Dijkstra. | Medium5 | BFSShortest path+1 | No attempts yet | 1s | 128 MB | Judgeable |
| TramFind the minimum number of switch changes needed to travel from intersection A to B in a directed graph where each node's first listed edge is free and others cost 1, using shortest-path with 0/1 edge weights. | Medium5 | Shortest pathGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |