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 results225 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Card Bundle SortingGiven N sorted card bundle sizes, find the minimum total comparisons to merge them all into one bundle using an optimal merge strategy (classic huffman-like heap problem). | Easy3 | HeapGreedy | No attempts yet | 2s | 128 MB | Judgeable |
| Minimum HeapImplement a min-heap to support inserting natural numbers and repeatedly extracting the smallest, printing 0 when empty. | Easy3 | HeapImplementation | No attempts yet | 1s | 128 MB | Judgeable |
| Cracking Tree CodesGiven a tree and its leaf-stripping code with some entries erased, the program replays the encoding to recover the missing numbers. | Easy3 | SimulationTree+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Max HeapProcess N insert and pop-max operations on an initially empty max heap, printing the maximum or 0 when empty. | Easy3 | Heap | No attempts yet | 1s | 256 MB | Judgeable |
| Absolute Value HeapProcess insert and pop-min-by-absolute-value operations on integers with a custom heap, printing 0 on empty pops. | Easy3 | Heap | No attempts yet | 1s | 256 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 |
| Problem Solving OrderGiven N tasks and M precedence constraints, output a topological order that always picks the smallest available problem number next. | Medium4 | Topological sortHeap+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 |
| Double QueueProcess a stream of add/serve commands maintaining a dynamic set to pop and remove either the maximum or minimum priority client each query. | Medium4 | HeapSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| ManagerSimulate a priority-based queue manager that adds costs, removes min or max cost per current policy, and prints results only for specified removal request indices. | Medium4 | HeapSimulation+1 | 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 |
| Parking LotSimulate cars arriving and leaving a parking lot, assigning each to the lowest-numbered free space or a waiting queue, and sum weight times rate. | Medium4 | SimulationQueue+2 | No attempts yet | 1s | 128 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 |
| ArgusGiven queries that each fire every Period seconds starting at time Period, output the Q_num of the first K results, breaking ties by smaller Q_num. | Medium4 | HeapSimulation+1 | 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 |
| It’s tough being a teen!Given a fixed list of seven tasks with precedence rules plus up to ten extra constraints, output a valid order using the smallest available task first, or report that no order exists. | Medium4 | GraphTopological sort+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 |
| ExperimentOrient each undecided corridor so the whole maze stays acyclic, following the smallest-numbered topological order of the fixed corridors. | Medium4 | Topological sortGraph+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Hotel ReservationsFind the fewest rooms that fit all reservations when a room freed at checkout needs C more minutes of cleaning. | Medium4 | IntervalsSorting+2 | No attempts yet | 2s | 128 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 |
| Triball RankingOrder all k players to satisfy every match result and return the lexicographically smallest lineup, or 0 when no lineup fits. | Medium4 | Topological sortGraph+1 | No attempts yet | 2s | 512 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 |
| Classroom assignmentGiven N class time intervals, find the smallest number of rooms so overlapping classes never share a room. | Medium4 | GreedySorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Goods MarketProcess insertions, global rent hikes, and cheapest-shop evictions, then report how many shops remain and their total rent. | Medium4 | HeapSimulation | No attempts yet | 1s | 256 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 |
| Merging Files 3Given K file sizes, find the minimum total cost of repeatedly merging two files where each merge costs the sum of their sizes. | Medium4 | HeapGreedy | No attempts yet | 2s | 512 MB | Judgeable |
| Contest ScoreSimulate reading problems in order but solving the shortest available one first, keeping at most k in memory, and report the total submission time. | Medium4 | SimulationHeap+1 | No attempts yet | 2s | 512 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 |
| Christmas GiftsProcess visits in order: depots add gifts to Santa's collection, and each child takes the largest gift currently held. | Medium4 | HeapSimulation+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 |
| The Seven WarlordsGiven up to ten million student grades, output the seven lowest grades in increasing order, one per line. Ties on the cut line still yield exactly seven grades. | Medium4 | SortingHeap+2 | No attempts yet | 10s | 256 MB | Judgeable |
| Bathroom Stalls (Small1)Simulate K people choosing stalls by a fixed farthest-from-others rule and report the distances around the stall the last person takes. | Medium4 | SimulationImplementation+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Greedy SchedulerAssign each queued customer to the free cashier with the smallest number, track busy times, and output the cashier for every customer. | Medium4 | HeapSimulation+1 | 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 |
| Running MedianGiven integers one by one, output the running median (lower of the two middles when count is even) after each insertion. | Medium5 | HeapSorting+1 | No attempts yet | 0.1s | 128 MB | Judgeable |
| Products of PrimesFind the N-th smallest number that can be formed as a product of one or more (with repetition) of K given distinct primes, using a heap-based merge. | Medium5 | HeapMath+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Running MediansGiven a sequence read one number at a time, output the running median every time an odd number of elements have been read. | Medium5 | HeapImplementation | No attempts yet | 1s | 128 MB | Judgeable |
| Beacon NetworkSimulate beacons that light up over time and archers who shoot arrows down a fixed priority list toward unlit targets, computing each beacon's lighting time. | Medium5 | SimulationHeap+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Emergency RoomSimulate an emergency room where doctors pick the waiting patient with the highest-priority next treatment, and report each patient's release time. | Medium5 | SimulationHeap+2 | No attempts yet | 1s | 128 MB | Judgeable |
| 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 |
| 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 |
| Fence RepairSplit one board into N planks of given lengths; each cut costs the length of the piece being cut, so find the minimum total cost. | Medium5 | GreedyHeap+2 | No attempts yet | 1s | 128 MB | Judgeable |
| EntropyFor each line of text, print the fixed 8-bit ASCII bit length, the optimal prefix-free Huffman bit length, and the compression ratio rounded to one decimal. | Medium5 | GreedyHeap+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Decode the TreeGiven a Prüfer code, rebuild the labeled tree on n vertices and print it as a canonical rooted word with children sorted by number. | Medium5 | TreeHeap+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Tournament RankingGiven game results between teams, produce the lexicographically smallest topological order, or report that no valid ranking exists due to a cycle. | Medium5 | GraphTopological sort+2 | No attempts yet | 1s | 128 MB | Judgeable |
| CourierSimulate orders arriving over time: assign each to the free courier who delivers fastest, or drop it if all couriers are busy, and total each courier's earnings. | Medium5 | SimulationImplementation+2 | No attempts yet | 1s | 1024 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 |
| Dual Priority QueueProcess a sequence of insert and min/max delete operations on a dual priority queue, then report the remaining max and min. | Medium5 | HeapImplementation | No attempts yet | 6s | 256 MB | Judgeable |
| PromotionEach day, receipts are added to a box, then the largest and smallest are removed and the difference is paid out; find the total payout. | Medium5 | HeapImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| LibraryMerge n files two at a time, where each merge costs the sum of the two lengths, and minimize the total cost. | Medium5 | GreedyHeap | No attempts yet | 1s | 128 MB | Judgeable |
| Galactic Container ShipGiven M rails with height limits 1..M and N plates each worth its quality w and having height h, choose plates to maximize total quality so that each chosen plate fits some distinct rail. | Medium5 | GreedySorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Portal KombatHektor absorbs the strength of each weaker opponent he beats, and the goal is the fewest wins that let him defeat the strongest opponent. | Medium5 | GreedySorting+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Gone FishingSplit limited fishing time across roadside lakes with travel costs and declining catches to maximize total fish. | Medium5 | GreedyHeap+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Milk SchedulingSchedule at most one cow per time unit before its deadline to maximize total gallons of milk. | Medium5 | GreedyHeap+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SightseeingFrom node 1, route each destination along roads to make the weakest road on the path as strong as possible. | Medium5 | HeapMinimum spanning tree+1 | No attempts yet | 3.5s | 512 MB | Judgeable |
| Where's That Fuel?Starting with planet P's fuel, repeatedly visit affordable planets to maximize final fuel, then the number of visits. | Medium5 | GreedySorting+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Bank QueuePick at most one person per minute before each deadline to maximize the total cash collected. | Medium5 | GreedyHeap+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Entertainment BoxSchedule the most TV shows on k recorders so no recorder tapes overlapping shows. | Medium5 | GreedySorting+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Song TitlesRearrange each title into the lexicographically smallest anagram with no equal adjacent letters, or report IMPOSSIBLE when none exists. | Medium5 | GreedyHeap+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Insider's InformationFollow the given removal order, then insert each university at the front or back to satisfy at least half the betweenness triples. | Medium5 | SimulationGreedy+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Workstation assignmentSeat each arriving researcher at a freed workstation that stayed unlocked to save the most unlocks. | Medium5 | GreedyHeap+1 | No attempts yet | 10s | 256 MB | Judgeable |
| Canvas PaintingArrange the canvases in a line and repeatedly split one color group into two so every canvas ends with its own color at the smallest total repaint cost. | Medium5 | GreedyHeap | No attempts yet | 1s | 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 |
| Technology PlanningPlan the smallest set of technologies covering every goal plus its dependencies, then print the lexicographically smallest valid research order. | Medium5 | Topological sortGraph+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Morning Coffee (Large)Choose one cup per day from day 1 to K so no kind is drunk past its deadline and total satisfaction is largest. | Medium5 | GreedyHeap+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Seat AssignmentAssign seats left to right, each time giving the seat to the still-unseated request with the smallest right endpoint that covers it. | Medium5 | GreedySorting+1 | No attempts yet | 0.8s | 32 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 |
| AssignmentsGiven deadlines and scores for N assignments, pick a subset schedulable within their deadlines to maximize total score. | Medium5 | GreedySorting+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Rain (Small)Given a small grid of island heights, compute the total water trapped after rain, where water escapes to sea at height 0. | Medium5 | GraphBFS+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Cow Dance ShowFind the smallest stage size K so that the total show time, where the next cow starts as soon as a dancer leaves, stays within T_max. | Medium5 | Binary searchSimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Card merge gameEach merge replaces two chosen cards with their sum; after exactly m merges, minimize the total sum of all cards. | Medium5 | GreedyHeap+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Convention IISimulate a single-server queue where queued cows are served by strict priority instead of arrival order, and find the largest start time minus arrival time. | Medium5 | HeapSimulation+1 | No attempts yet | 2s | 512 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 |
| FishmongersAssign each fish to a fishmonger with a weight limit and per-kilogram price so total earnings are maximized. | Medium5 | GreedySorting+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Length of Bundle RopeGiven the sizes of n parcels, repeatedly join two bundles at a time and pay the sum of their sizes, finding the total cost that ties everything into one bundle for the least rope. | Medium5 | GreedyHeap+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| BNKQCustomers arrive over time and each joins the shortest counter queue; find the total time until the last customer finishes being served. | Medium5 | SimulationHeap+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Minimum Number of Conference RoomsGiven N meetings with start and end times, find the minimum number of rooms so that no two overlapping meetings share a room, where a meeting may start exactly when another ends. | Medium5 | SortingGreedy+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Building a Swimming PoolGiven an N by M grid of pillar heights 1 to 9, count the total water trapped on top after water flows off any path to the outside. | Medium6 | HeapBFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Jewel ThiefGiven N jewels with weight and value and K bags with weight limits (one jewel per bag), maximize total value stolen using a greedy plus max-heap approach. | Medium6 | GreedyHeap+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Lecture Rooms 2Assign each of N intervals a room number using the minimum number of rooms so overlapping lectures never share a room, touching endpoints allowed. | Medium6 | GreedyHeap+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Graph RelabelingGiven a directed graph as an adjacency matrix, assign each vertex a distinct label from 1 to N respecting all edge order constraints, and output the lexicographically smallest label sequence or -1 if impossible. | Medium6 | Topological sortGreedy+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Making a NumberGiven how many cards exist for each digit 0-9, build the largest possible number using some or all cards so that no two adjacent digits match and no leading zero appears. | Medium6 | GreedyString+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Cup RamenGiven N jobs each taking one time unit with a deadline and a reward, choose which jobs to schedule to maximize total reward earned by finishing before deadlines. | Medium6 | GreedyHeap+1 | No attempts yet | 2s | 256 MB | Judgeable |
| RefuelingFind the minimum number of gas station stops a truck must make, given starting fuel and station positions with fuel amounts, to reach a village on a line. | Medium6 | GreedyHeap+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Nth Largest NumberGiven an N x N matrix where each column is sorted top to bottom, find the Nth largest value among all N^2 entries efficiently. | Medium6 | Binary searchMatrix+1 | No attempts yet | 1s | 12 MB | Judgeable |
| Water FillingGiven a grid of terrain heights, compute the maximum water volume trapped inside using a boundary-based priority-queue flood fill (trapping rain water 2D). | Medium6 | HeapMatrix+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Representative PlayersGiven N classes each with M distinct scores, pick one student per class to minimize the range between the highest and lowest chosen scores. | Medium6 | HeapGreedy+1 | No attempts yet | 2s | 256 MB | Judgeable |
| A Dragon LivesGiven a day-by-day rain forecast on lakes and dry days when the dragon may empty one full lake, decide if overflow can always be avoided. | Medium6 | GreedyHeap+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Pick up sticksGiven a set of on-top-of relations between sticks, output the lexicographically smallest removal order, or IMPOSSIBLE if a cycle exists. | Medium6 | Topological sortGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Dizzy CowsDirect each two-way edge using the lexicographically smallest topological order of the given acyclic one-way edges, or report -1 if a cycle exists. | Medium6 | GraphTopological sort+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Work SchedulingGiven jobs each taking one unit of time with a deadline and a profit, choose a subset to schedule so total profit is maximized. | Medium6 | GreedyHeap+2 | No attempts yet | 1s | 128 MB | Judgeable |
| RoadblocksFind the length of the second-shortest walk from vertex 1 to vertex N in an undirected weighted graph, where walks may repeat edges. | Medium6 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Hungary GamesGiven a directed weighted graph, find the second smallest distinct total length among all walks from node 1 to node N, or -1 if fewer than two exist. | Medium6 | Shortest pathGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Shop and ShipGiven an undirected weighted graph, city-specific pencil prices, and a destination D, find the cheapest price plus shipping cost to get a pencil to D. | Medium6 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Mountain PassageFind the minimum count of steps that touch an elevation above the start height, moving on an n by n grid with height changes limited to 2 per step. | Medium6 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Swimming PoolGiven an m by n grid of tower heights, find the total volume of water trapped among the towers when the grid is flooded from the outside. | Medium6 | HeapBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Keep the Customer SatisfiedGiven orders with processing times and due dates on a single machine, choose the largest subset that can all finish on time. | Medium6 | GreedySorting+2 | No attempts yet | 1s | 1024 MB | Judgeable |