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 |
|---|---|---|---|---|---|---|
| TruckingFor each graph case, find the largest cargo height allowing a route, then the shortest route length among routes that allow it. | Medium5 | GraphShortest path+2 | No attempts yet | 3s | 128 MB | Judgeable |
| EinbahnstrasseFor each case, sum the shortest round-trip garage-to-car distances over all cars in a directed weighted city graph. | Medium5 | Shortest pathGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Horror ListEach movie gets a level: 0 if on the horror list, else one plus the best level among similar movies; output the movie with the highest finite level, breaking ties by smallest ID. | Medium5 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Seymour the SealCount herring squares reachable from S when at most 3 goo squares may be crossed between visits to a cleaner. | Medium5 | GraphBFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Battleground PreservationGiven past battle results with costs, find the cheapest chain of victories between two fighters and decide the winner, or output FIGHT! if neither dominates. | Medium5 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Pirates' PathFind the path from s to e in an undirected graph that uses the fewest guarded edges, where each edge has cost 0 or 1. | Medium5 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Olympic AvenuesGiven an undirected weighted graph with N up to 50, find the shortest path from S to F and, among ties, print the lexicographically smallest site sequence. | Medium5 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Milk RoutingPick a single path from node 1 to node N minimizing latency plus X divided by the path's bottleneck capacity, and floor the result. | Medium5 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Corn MazeGiven a grid with walkable cells, zero-cost paired teleporter slides, and one exit, find the minimum time from the start to the exit. | Medium5 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Chocolate GivingFor each of B queries on a weighted undirected graph, output the shortest distance from pasture P to pasture Q that passes through the barn at pasture 1. | Medium5 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Best SpotGiven a weighted undirected graph and a set of favorite vertices, find the vertex whose average shortest-path distance to all favorites is smallest, breaking ties by smallest index. | Medium5 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Obstacle CourseOn an N by N grid with blocked tiles, find a walk from A to B that minimizes the number of 90-degree turns; start and end directions are free. | Medium5 | BFSGraph+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 |
| MunchingFind the length of a shortest grid path from the cow to the barn through grass, then report the number of grass squares munched along it. | Medium5 | BFSGraph+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Cows on SkatesFind a shortest orthogonal path from (1,1) to (R,C) through open grid cells, breaking ties by the lexicographically smallest sequence of cells. | Medium5 | BFSGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Stockbroker GrapevineFor each directed weighted graph, find the vertex whose shortest paths reach every other vertex, minimizing the maximum distance; print it and that time, or disjoint. | Medium5 | Shortest pathGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| 106 Miles to ChicagoGiven a graph where each edge has a percent probability of staying uncaught, find the path from node 1 to node n that maximizes the product of these probabilities. | Medium5 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Journey of a KnightGiven an n by m board, find the minimum number of knight moves from cell (1,1) to cell (i,j), or report that it is unreachable. | Medium5 | BFSGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Making test data 5Print a fixed chain graph with self-loops and queries so that ModifiedDijkstra stays under the counter limit while OptimizedBellmanFord exceeds it. | Medium5 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Playground HideoutGiven a directed graph with weighted edges and direct ground costs per node, find the index of the node with the largest shortest-path distance from ground, breaking ties by smallest index. | Medium5 | Shortest pathGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Traffic EngineeringGiven a directed network of named hosts where nodes cost 0 or 1 depending on ownership, report the cheapest route cost between each source-destination pair. | Medium5 | GraphShortest path+2 | No attempts yet | 1s | 256 MB | Judgeable |
| BitocjaThe program accepts each proposed road in order only when it strictly shortens the shortest travel time from city 1 to city n. | Medium5 | Shortest pathGraph | No attempts yet | 1s | 512 MB | Judgeable |
| Traffic LanesFind the fewest lane changes needed to drive across an n by m grid of blocked and free cells, starting and ending in any lane. | Medium5 | Shortest pathBFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| BubuFind Bubu's fastest route to clearing 1 that reaches every clearing before any ranger does, or report -1. | Medium5 | Shortest pathGraph | No attempts yet | 1s | 128 MB | Judgeable |
| Servicing ClientsChoose clients whose distance-times-demand costs fit the budget to maximize total priority. | Medium5 | Dynamic programmingShortest path | No attempts yet | 1s | 128 MB | Judgeable |
| Janggi HorseCompute the fewest Janggi horse moves from start to target on an infinite board where standing pieces block the orthogonal step of some moves. | Medium5 | BFSShortest path+1 | No attempts yet | 1s | 128 MB | Judgeable |
| EscapeFind the fewest steps from the start cell to any border cell in a grid while turning at each tile unless both sides are blocked. | Medium5 | BFSShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| No Left TurnsFind the shortest path from start to finish in a maze where each step goes straight ahead or turns right. | Medium5 | BFSShortest path+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Public TransitWalk once from the start, then take timed one-way buses with waiting to arrive earliest, breaking ties by fewer stops then smaller stop numbers. | Medium5 | Shortest pathGraph | No attempts yet | 1s | 128 MB | Judgeable |
| Unidentified DestinationList the candidate destinations whose shortest route from s passes through the road between g and h. | Medium5 | Shortest pathGraph | No attempts yet | 3s | 256 MB | Judgeable |
| Outpost NavigationFind the lowest-encounter safe route to a supply outpost, optionally collecting ammo at the one cache without overspending. | Medium5 | Shortest pathGraph | No attempts yet | 2s | 128 MB | Judgeable |
| Bones's BatteryFind the smallest battery range so every pair of schools connects with at most K charges over roads within range. | Medium5 | Binary searchGraph+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Shopping MallsFind the least-walking path between queried places in a mall graph with asymmetric costs and break cost ties by lexicographic order. | Medium5 | Shortest pathGraph | No attempts yet | 1s | 128 MB | Judgeable |
| SailingFind the quickest sailing route on a grid with six moves, tacking costs, and blocked waypoints. | Medium5 | Shortest pathGraph | No attempts yet | 2s | 512 MB | Judgeable |
| Super PhyllisFind every direct reporting edge that has an alternate route through at least one other person and print those edges in sorted order. | Medium5 | GraphShortest path+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Electronic Road Pricing (ERP)Find the cheapest route on a grid of roads where going straight is free, left turns cost 1, right turns cost 5, and dead-end U-turns cost 10. | Medium5 | Shortest pathGraph+1 | No attempts yet | 2s | 1024 MB | Judgeable |
| Shortest Sailing TimeFind the cheapest route from the top-left to the bottom-right of a cost grid where each turn adds 3. | Medium5 | Shortest pathGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Erratic AntsGiven a recorded walk on a grid, find the fewest steps from start to end using only walked edges or their reverses. | Medium5 | BFSGraph+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Texas SummersFind the route from the dormitory to class through shady spots that minimizes the sum of squared leg lengths, with ties broken by lexicographic index order. | Medium5 | Shortest pathGraph+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Piggy BackBessie from field 1 and Elsie from field 2 must both reach the barn at field N, walking alone or meeting in one field to share the rest of the trip. | Medium5 | Shortest pathBFS | No attempts yet | 1s | 256 MB | Judgeable |
| Cow RoutingFind the cheapest itinerary from city A to city B using ordered routes that charge full price per boarding, breaking ties by fewest flights. | Medium5 | Shortest pathGraph | No attempts yet | 1s | 256 MB | Judgeable |
| EmpireFind the fastest route from A to B whose total hull damage stays strictly below K. | Medium5 | Shortest pathDynamic programming | No attempts yet | 1s | 256 MB | Judgeable |
| Change of SceneryDecide whether a second shortest route from junction 1 to N exists that differs from the given one by at least one street. | Medium5 | Shortest pathGraph | No attempts yet | 3s | 256 MB | Judgeable |
| MatrixCompute each agent's earliest arrival time, then find Neo's shortest safe route to a telephone that beats every agent there. | Medium5 | Shortest pathGraph | No attempts yet | 2s | 256 MB | Judgeable |
| Minimum Cost RouteFind the cheapest bus fare from city A to city B and print the fare, the city count, and the path, preferring fewer cities and then lexicographic order on ties. | Medium5 | Shortest pathHeap | No attempts yet | 1s | 256 MB | Judgeable |
| All Pairs Shortest RoutesFind the cheapest fare between every pair of cities and print each cheapest route, breaking ties by lexicographic order. | Medium5 | Shortest pathGraph | No attempts yet | 1s | 256 MB | Judgeable |
| ZombiesFind the cheapest route from city 1 to city N, where cities within S roads of a zombie city cost q per night and all other cities cost p. | Medium5 | Shortest pathBFS+1 | No attempts yet | 2s | 512 MB | Judgeable |
| gCampus (Large)Find every road that never appears on a shortest travel-time path between any pair of offices. | Medium5 | Shortest pathGraph | No attempts yet | 5s | 512 MB | Judgeable |
| Taking the Metro (Large)Find the fastest route between two metro stations where each boarding adds a line waiting time and transfers use walking tunnels. | Medium5 | Shortest pathGraph | No attempts yet | 5s | 512 MB | Judgeable |
| Dragon Maze (Small)Find the fewest-step walk from the entrance to the exit of a cell grid and report the most power gathered on such a route. | Medium5 | BFSShortest path+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Spaceship Defence (Small)Soldiers cross rooms with free jumps between same-color rooms and timed one-way turbolifts, and each query asks for the fastest trip time. | Medium5 | Shortest pathGraph | No attempts yet | 5s | 512 MB | Judgeable |
| Choosing a meeting place (Large)Each friend moves at their own speed, so run Dijkstra once per friend and pick the city with the smallest worst arrival time. | Medium5 | Shortest pathGraph | No attempts yet | 5s | 512 MB | Judgeable |
| Crossing the Road (Small)On a tiny grid whose intersections have periodic pedestrian lights, find the minimum time to walk from the southwest corner of the grid to the northeast corner. | Medium5 | Shortest pathGraph+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Branch AssignmentPartition b branches into s nonempty groups to minimize total round-trip courier distance, where a message from branch i to j costs dist(i,hq)+dist(hq,j). | Medium5 | GraphShortest path+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Magic PotionGiven a complete graph with edge weights and K potions that halve one trip's time, find the shortest time from city 0 to city 1. | Medium5 | Shortest pathGraph+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Train Line ConstructionOn an N by N grid with resident counts and blocked cells, find a 4-direction path between two stations minimizing the sum of cell weights along it. | Medium5 | GraphShortest path+2 | No attempts yet | 1s | 64 MB | Judgeable |
| Hide and Seek 3Given start N and target K, find the minimum number of one-step moves when moving X to X-1 or X+1 costs one second and moving X to 2X costs nothing. | Medium5 | BFSGraph+1 | No attempts yet | 2s | 512 MB | Judgeable |
| TaxFind the shortest path from S to D in a weighted undirected graph, then report it again after each tax rise adds p to every edge. | Medium5 | Shortest pathGraph+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Connectivity PotentialGiven a directed graph as an adjacency matrix, compute the number of hops in the longest shortest path times the number of ordered pairs attaining it. | Medium5 | GraphShortest path+2 | No attempts yet | 2s | 512 MB | Judgeable |
| The Other WayCount the number of distinct shortest paths between two towns in a weighted undirected multigraph, modulo 10^9+9. | Medium5 | GraphShortest path+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Pony Express (Small)Cities lie on a line with a horse in each; find the minimum time from city 1 to city N, switching horses at intermediate cities, subject to each horse's endurance limit. | Medium5 | Dynamic programmingShortest path+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Amsterdam DistanceIn a half-disc street grid with M radial streets and N circular canals of radius R*y/N, find the shortest path length between two corners using only those streets and canals. | Medium5 | GeometryGraph+1 | No attempts yet | 2s | 512 MB | Judgeable |
| A Great WayFind the cheapest path from node 1 to node N, where an edge costs c + d*max(0,e-10), breaking ties by fewer waypoints. | Medium5 | GraphShortest path+1 | No attempts yet | 1s | 128 MB | Judgeable |
| American TourFind the shortest walk from node 1 to node N that passes through node 2, where no road may be repeated but nodes may be revisited. | Medium5 | GraphShortest path+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Fine DiningFor each pasture, decide whether a cow can detour through one haybale on its way to the barn with extra time at most the hay's yumminess. | Medium5 | Shortest pathGraph+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Bucket BrigadeOn a fixed 10x10 grid with one barn, one lake, and one blocked rock, find the fewest empty squares to occupy so a chain of cows links the lake to the barn. | Medium5 | BFSGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Being a Celebrity Is HardGiven a weighted undirected graph and two starting nodes, pick a meeting node minimizing the sum of both shortest distances and breaking ties by Jiheon's distance then index. | Medium5 | Shortest pathGraph+1 | No attempts yet | 1s | 256 MB | Judgeable |
| BackdoorFind the shortest travel time from junction 0 to junction N-1 in an undirected weighted graph, where every intermediate junction marked visible is blocked and only the Nexus may be entered. | Medium5 | Shortest pathGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Save the Princess!Given an N by M grid with walls and one sword cell, find the minimum steps from (1,1) to (N,M) within T, where the sword lets the hero pass through walls afterward. | Medium5 | BFSGraph+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Minjun, Masan, and GunwooGiven an undirected weighted graph, check whether vertex P lies on some shortest path from vertex 1 to vertex V. | Medium5 | GraphShortest path+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Teleport StationGiven N points in a line, edges between x-1 and x+1, plus M teleport connections, find the shortest time from S to E. | Medium5 | GraphBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Wise KnightGiven a knight's start square on an N by N board, find the minimum knight moves to reach each of M target squares. | Medium5 | BFSGraph+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Iguana InstructionsGiven an n by n grid with blocked cells, find the minimum number of straight-line moves (direction plus distance) to walk from the top-left to the bottom-right. | Medium5 | BFSGraph+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Road PavingFind the minimum travel time from city 1 to city N when up to K roads can be paved to cost zero, using layered shortest-path search over (node, paves used). | Medium6 | Shortest pathGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| DeliveryFind the minimum moves in a grid from a start cell to visit two target cells, forbidding two consecutive moves in the same direction. | Medium6 | BFSShortest path+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Installing Power Plant CablesFind the minimum total length of new cables needed to connect plant 1 to plant N, using free existing cables and new links capped at length M, via shortest path. | Medium6 | Shortest pathGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Minho's CuriosityGiven an all-pairs shortest-time matrix for N cities, reconstruct the minimum-edge road network with the same shortest times and output the total edge weight, or -1 if impossible. | Medium6 | Shortest pathGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Monkey Who Wants to Move Like a HorseFind the minimum number of moves for a monkey to reach the bottom-right cell of a grid using normal steps and at most K knight-like jumps over obstacles. | Medium6 | BFSShortest path+2 | No attempts yet | 2s | 256 MB | Judgeable |
| 1 && 3 GraphAnswer many shortest-path queries on a special connected graph where fewer than 3 vertices have degree at least 3, exploiting its path/cycle-like structure for efficiency. | Medium6 | GraphShortest path+1 | No attempts yet | 4s | 1024 MB | Judgeable |
| Choosing Weight MassesAssign integer masses to N weights satisfying M difference inequality constraints, detecting infeasibility, using shortest-path style constraint graph construction. | Medium6 | Shortest pathGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Mirror InstallationFind the minimum number of 45-degree mirrors needed on a grid so light travels from one door to the other, treating direction changes as costs in a shortest-path search. | Medium6 | BFSShortest path+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Reasonable PathsGiven a weighted undirected graph, count paths from vertex 1 to vertex 2 where each step moves to a vertex strictly closer to vertex 2 by shortest-path distance. | Medium6 | Shortest pathGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Network RecoveryGiven a weighted graph, find a minimum edge subset that preserves all shortest-path distances from node 1 while keeping the graph connected. | Medium6 | Shortest pathGraph+1 | No attempts yet | 2s | 192 MB | Judgeable |
| Security System InstallationBuild a minimum spanning tree from the given network, then find the vertex minimizing the sum of shortest distances to all other vertices within that tree. | Medium6 | Minimum spanning treeGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Camelot GatheringCompute BFS knight-move distances from every piece to every square, and find the meeting square and rendezvous strategy minimizing total moves to gather king and knights, where the king can ride a knight after meeting it. | Medium6 | BFSShortest path+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Graph ReconstructionGiven all pairwise shortest distances of a connected weighted graph, reconstruct a graph with exactly M edges that reproduces those distances or report impossibility. | Medium6 | GraphShortest path+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Roadblock InspectionGiven a weighted graph, find the maximum increase in shortest path from node 1 to node N caused by removing a single edge, outputting -1 if removal can disconnect them. | Medium6 | Shortest pathGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Ant-Elephant WarGiven a weighted graph, find which single edge to delete so that the resulting shortest path from vertex 1 to vertex N is as long as possible. | Medium6 | Shortest pathGraph | No attempts yet | 2s | 256 MB | Judgeable |
| Turn On the LightGiven an N by M grid of diagonal tiles ('/' or '\'), find the minimum number of tile rotations needed to create a diagonal path from top-left to bottom-right corner, using shortest path on a corner graph with 0/1 edge weights. | Medium6 | Shortest pathGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Chain Store LocationGiven a graph, compute shortest distances from every node to three fixed nodes and answer queries about whether a node is Pareto-dominated by another node on those three distances. | Medium6 | Shortest pathGraph+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Bus TransfersGiven a grid and k horizontal or vertical bus segments, find the minimum number of bus transfers to get from a start point to a destination point. | Medium6 | GraphBFS+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Roads of ManchesterGiven a directed graph with edge capacities, compute the ratio of max flow from A to B to the maximum bottleneck-capacity path from A to B. | Medium6 | GraphShortest path+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Amusement ParkOn a grid where entering a cell costs 1/C and each minute-long interval allows a cumulative cost of at most 1, find the minimum number of minutes to travel from start to destination. | Medium6 | BFSGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Nikola's JumpsFind the minimum-cost path to square N where forward jumps grow by 1 each time and backward jumps match the last forward jump length. | Medium6 | Dynamic programmingGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Speed LimitsFind the fastest path in a directed road network where roads without a posted speed limit inherit the previously used speed limit, requiring state-dependent shortest path search. | Medium6 | Shortest pathGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Invitation CardsGiven a directed weighted graph with up to a million nodes and edges, compute the sum of shortest paths from the CCS to all stops plus shortest paths from all stops back to the CCS. | Medium6 | Shortest pathGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| WormholesGiven start, destination, and wormholes with entry-time constraints and time shifts, compute the earliest arrival time using a shortest-path style relaxation over travel distances and wormhole jumps. | Medium6 | Shortest pathGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Halloween GraveyardFind the fastest time to travel from entrance to exit on a grid with walls and time-warping portals, detecting negative cycles and unreachability. | Medium6 | Shortest pathGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Enjoyable CommunicationFind the k-th shortest simple path (by length then lexicographic node order) between two nodes in a directed graph with up to 50 nodes and k up to 200. | Medium6 | Shortest pathGraph+1 | No attempts yet | 3s | 128 MB | Judgeable |
| The AgencyFind the minimum landing-tax cost to travel from one N-bit planet to another, where flights flip exactly one bit. | Medium6 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |