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 results151 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| 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 |
| Building Completion TimesGiven N buildings with construction times and prerequisite dependencies, compute for each building the earliest possible completion time assuming unlimited parallel construction. | Medium4 | Topological sortDynamic programming+1 | No attempts yet | 2s | 128 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 Time to Complete TasksGiven tasks with durations and prerequisites forming a DAG (prerequisites always have smaller index), compute the minimum total time to finish all tasks using longest path via DP. | Medium4 | Dynamic programmingTopological sort+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Student LineupGiven precedence constraints between N students, output any ordering consistent with all constraints, i.e. a topological sort. | Medium4 | Topological sortGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Music ProgramMerge several partial orderings of singers into one total order using topological sort, or report impossibility if a cycle exists. | Medium4 | Topological sortGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Indiana Jones and the Lost Soccer CupGiven precedence constraints between levers, decide whether the order is unique; print the unique order, or report no order or multiple orders. | Medium4 | Topological sortGraph+2 | No attempts yet | 1s | 256 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 |
| 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 |
| 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 |
| Evaluation Order of Assignments (Small)Given assignment statements where each expression is a function call, decide whether some order evaluates every variable, which fails exactly when a dependency cycle exists. | Medium4 | GraphTopological sort+2 | No attempts yet | 5s | 1024 MB | Judgeable |
| EvaluationGiven assignment statements where each value depends on argument variables, decide whether some evaluation order resolves every dependency. | Medium4 | GraphTopological sort+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Prerequisite CoursesGiven prerequisite pairs between courses, find the earliest semester each course can be completed when unlimited courses may be taken per semester. | Medium4 | GraphTopological sort+2 | No attempts yet | 5s | 256 MB | Judgeable |
| Coolest Ski RouteGiven a DAG of slopes with condition values, find the maximum total condition along any downhill path. | Medium4 | GraphDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Checking CausalityGiven send/receive events across computers with local clocks, detect whether the induced ordering constraints form a cycle indicating a causality violation. | Medium5 | GraphTopological sort+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Dueling PhilosophersGiven m precedence edges among n essays, decide whether the es-says have zero, exactly one, or more than one valid topological ordering. | Medium5 | GraphTopological sort+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Milk SchedulingGiven task durations and precedence constraints that form a DAG, find the minimum makespan when unlimited workers milk cows in parallel. | Medium5 | GraphTopological sort+2 | No attempts yet | 1s | 128 MB | Judgeable |
| 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 |
| Moving DayGiven n people each moving from one address to another on a single street, find the lexicographically smallest order of moves so every destination is vacant in time. | Medium5 | GraphTopological sort+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SpreadsheetEvaluate each spreadsheet cell, treating formula cells as sums of other cells, and mark any cell involved in a dependency cycle as undefined. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SubsetsGiven inequalities where a set name contains either an element or another set name, find each named set's minimal required elements. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Ancient Dictionary OrderDecide whether some alphabet order makes each given word list sorted lexicographically. | Medium5 | Topological sortGraph+1 | No attempts yet | 8s | 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 |
| Diamond Inheritance (Large)Decide whether any pair of classes in each inheritance DAG has two different inheritance paths between them. | Medium5 | GraphTopological sort+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Technology PlanningFind every goal technology plus its prerequisites and print the smallest valid research order, breaking ties lexicographically. | Medium5 | Topological sortGraph | No attempts yet | 5s | 512 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 |
| DwarvesGiven strict size comparisons between named dwarves, decide whether the statements are mutually consistent. | Medium5 | GraphTopological sort+2 | No attempts yet | 2s | 512 MB | Judgeable |
| University CourseSimulate course selection each semester: from courses whose prerequisites are done, take up to M with highest priority, and report the schedule. | Medium5 | Topological sortGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Project SchedulingGiven each task's duration and its prerequisite tasks, find the minimum total time to finish the whole project. | Medium5 | Topological sortDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Milking OrderGiven a partial order between some cows and fixed positions for others, find the earliest position cow 1 can occupy. | Medium5 | Topological sortGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Search EngineGiven directed links between websites, compute one website's trust score by summing scores of linking sites only when no cycle would result. | Medium6 | GraphDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Making Roads One-WayDecide if every two-way road between N cities can be made one-way so that no directed cycle remains in the whole road network. | Medium6 | GraphDFS+1 | 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 |
| Critical PathOn a DAG, find the longest path length from source to target, then count edges that lie on at least one such longest path. | Medium6 | Dynamic programmingTopological sort+1 | No attempts yet | 2s | 512 MB | Judgeable |
| New Language Alphabet OrderGiven a sorted list of words in an unknown alphabet, reconstruct the unique letter order or report impossibility or ambiguity. | Medium6 | Topological sortGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Detective HongzGiven a DAG of causal relations and a set of known events, determine every additional event forced to have occurred by forward implication and the backward rule that a caused event needs at least one occurring predecessor. | Medium6 | Topological sortGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Counting Bicycle Race RoutesCount directed paths from village 1 to village 2 in a graph, printing the last 9 digits or 'inf' if a reachable cycle makes the count infinite. | Medium6 | Topological sortDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Soccer TacticsGiven a directed graph, find every vertex from which all other vertices are reachable, or report that none exists. | Medium6 | GraphDFS+2 | No attempts yet | 1s | 256 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 |
| Time to GraduateGiven up to 12 courses with prerequisites, fall or spring offerings, and a per-semester course cap, find the minimum number of semesters to finish all courses. | Medium6 | GraphDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Worst ReporterGiven some match results of a round-robin where higher-ranked teams always win, find the lexicographically smallest ranking and say whether it is unique. | Medium6 | GraphTopological sort+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ICPC Strikes AgainGiven a DAG of task dependencies, basic significances, and which employees perform which tasks, compute each employee's salary as the sum of significances of tasks they perform that no other task they perform depends on. | Medium6 | GraphDFS+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 |
| Ranking the CowsGiven partial comparison results between N cows with distinct milk rates, find the minimum number of additional pairwise comparisons needed to determine the full ranking. | Medium6 | GraphTopological sort+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cow TrafficIn a DAG where every edge goes from a lower to a higher numbered node, count how many source-to-barn paths cross each edge and output the maximum. | Medium6 | GraphDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Synchronous DesignGiven a circuit of synchronous and asynchronous nodes with delays, report whether it has an asynchronous cycle, exceeds the clock period between synchronous nodes, or is a valid synchronous design. | Medium6 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SpreadsheetEach cell holds an integer or a sum formula referring to other cells; evaluate all formulas and print the resulting grid, with no reference cycles. | Medium6 | GraphTopological sort+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Fire drillOrder N buildings to minimize how many times a building is evacuated before one of its listed predecessors. Output the permutation. | Medium6 | Topological sortGraph+1 | No attempts yet | 1s | 1024 MB | Judgeable |
| Sorting It All OutGiven up to n letter ordering constraints added one at a time, report the first point where a unique sorted order emerges or where the constraints contradict each other. | Medium6 | GraphTopological sort+2 | No attempts yet | 1s | 128 MB | Judgeable |
| CaveGiven a transitive reachability matrix of a DAG, find the minimum number of downward paths needed to cover every node. | Medium6 | GraphGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| GenomesFind the length of the longest common subsequence of up to 20 permutations of size up to 500. | Medium6 | GraphTopological sort+1 | No attempts yet | 1s | 128 MB | Judgeable |
| BridgesAssign each pair a distinct height so the number of vertical-horizontal crossings is minimal and output the bridges from lowest to highest. | Medium6 | IntervalsTopological sort+1 | No attempts yet | 2s | 128 MB | Judgeable |
| People like peopleFrom each voter list of up to three liked students, find the largest group where everyone voted, likes only members, and is liked by a member. | Medium6 | GraphQueue+1 | No attempts yet | 1s | 128 MB | Judgeable |
| InfluenceFrom the candidate set X, pick the person who reaches the most people through transitive influence, breaking ties by smallest id. | Medium6 | Topological sortGraph+1 | No attempts yet | 3s | 128 MB | Judgeable |
| PaintingRecover the lexicographically smallest order in which whole rows or columns were painted to produce each board. | Medium6 | Topological sortGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Friendship GraphDecide up to 200000 reachability queries on a directed graph with 2000 vertices, printing 1 when Y is reachable from X. | Medium6 | GraphDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Scout OutingScouts split along every DAG trail and regroup at each station; report the last arrival time, the total waiting spread, and the stations with departure slack. | Medium6 | Topological sortDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Ancient Cave ExpeditionFrom cave 1, choose a route that only moves deeper to maximize treasure values minus tunnel costs, breaking profit ties by lexicographic order. | Medium6 | Dynamic programmingTopological sort+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Digi Comp IIBalls fall through a DAG of toggle switches that flip after each visit, and the task is to report the final state of every switch. | Medium6 | Topological sortDynamic programming | No attempts yet | 7s | 256 MB | Judgeable |
| Web Service DependenciesCount the launch orders that place each container after all of its dependencies for each configuration. | Medium6 | Dynamic programmingTopological sort+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Everlasting ZeroDecide if every special command can be learned by raising skills that never decrease while respecting each upper and lower bound. | Medium6 | Topological sortGraph | No attempts yet | 5s | 128 MB | Judgeable |
| Chess TournamentGiven reported chess results, decide whether some assignment of skill levels makes all results true, where equal skills draw and higher skill always wins. | Medium6 | Union-findGraph+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Recover the Alphabet OrderGiven words claimed to be lexicographically sorted, decide whether the letter order is unique, impossible, or ambiguous. | Medium6 | Topological sortGraph+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Halting MachineParse N goto statements, build a directed graph, and print the longest path length from line 0 to line N, or infinity if a cycle is reachable on some path to N. | Medium6 | GraphDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Dueling PhilosophersGiven directed edges meaning essay d must precede essay u, decide whether the ordering is impossible, unique, or has multiple solutions. | Medium6 | GraphTopological sort+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Finding the RankGiven a set of pairwise comparisons among N students, find the best and worst possible rank of student X over all total orders consistent with the comparisons. | Medium6 | GraphDFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Improve SPAMGiven nested mailing lists, count how many messages reach client emails before deduplication and how many distinct emails are reached, both modulo 1e9+7. | Medium6 | GraphDFS+2 | No attempts yet | 0.3s | 512 MB | Judgeable |
| BiomagnificationGiven a DAG of predator-prey species where each consumer picks prey via an unbounded knapsack to meet its calorie need while minimizing heavy metal, determine if the human species survives and find its minimum accumulated metal. | Medium7 | Dynamic programmingGraph+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Candy Stair ClimbFind the maximum candies collectible by jumping between horizontal stair segments within distance K, never decreasing height, starting from the ground. | Medium7 | Topological sortGraph+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Racing ResultsCount how many full car rankings are consistent with given pairwise 'beat' results, essentially counting linear extensions of a partial order mod 1,000,003. | Medium7 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Line UpGiven N students and M precedence constraints, compute the minimum and maximum possible position each student can occupy in any valid linear order, or report impossibility if a cycle exists. | Medium7 | Topological sortGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| ConservationGiven a DAG of tasks each labeled with one of two labs, find a topological order minimizing the number of switches between labs. | Medium7 | Topological sortGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| GunfightGiven listener based constraints on when gunshot sounds arrive, determine the unique firing order of shooters, or report impossibility or ambiguity. | Medium7 | GraphTopological sort+1 | No attempts yet | 1s | 128 MB | Judgeable |
| ClassifiedGiven a partial order with listed A -> B rules and guaranteed pairwise greatest lower bounds, simulate read and write actions that lower a user or document level to the glb of two current levels, printing each result. | Medium7 | GraphTopological sort+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Crazy CircuitsGiven a directed acyclic circuit with current demands on edges, find the minimum supply current at the + terminal so every component gets its required current, or report impossible. | Medium7 | GraphDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Sub-dictionaryGiven a dictionary where each word's definition uses only other words, find the smallest self-contained subset of words to teach first so all words become learnable. | Medium7 | GraphGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Frame StackingGiven a picture of several stacked lettered frames on a grid, recover the bottom-to-top stacking order, printing all valid orders alphabetically. | Medium7 | GraphTopological sort+2 | No attempts yet | 1s | 128 MB | Judgeable |
| All Discs ConsideredGiven a DAG of package dependencies split across exactly two DVDs, find the minimum number of disc changes to install all packages with a single drive. | Medium7 | GraphTopological sort+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Task ExecutionGiven a DAG of N unit-time tasks, find the minimum completion time with unlimited processors, then the fewest processors that still achieve it. | Medium7 | GraphTopological sort+2 | No attempts yet | 1s | 128 MB | Judgeable |
| CompanyKeep the fewest boss relations from a DAG so that reachability between all pairs of employees is unchanged, and output them sorted. | Medium7 | GraphTopological sort+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Tetris AlphabetGiven the final well of a Tetris game with lettered pieces, find the lexicographically smallest order in which the pieces could have landed. | Medium7 | GraphTopological sort+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Professor SzuCount walks in a directed multigraph from each cottage to the main building, cap at 36500, and report which cottages have the most routes (or are unbounded). | Medium7 | GraphDynamic programming+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Group ExcursionDecide whether each tourist's two visit wishes can be satisfied together and output the lexicographically smallest visit list. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| DivisibilityDecide whether a directed graph matches the divisibility relation of some set of distinct natural numbers. | Medium7 | GraphTopological sort | No attempts yet | 1s | 128 MB | Judgeable |
| The GameTwo tokens sit on two directed acyclic boards and players alternate moving one token along an edge, and each query asks whether the first player wins. | Medium7 | Game theoryTopological sort+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Self-AssemblyDecide whether unlimited rotatable square tiles with signed edge labels can form an arbitrarily large compatible assembly. | Medium7 | GraphTopological sort | No attempts yet | 3s | 128 MB | Judgeable |
| MinesTrigger the fewest mines so chain reactions through overlapping blast squares detonate all N mines. | Medium7 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Dreaded Alternating GamePick the side, even or odd, that wins a token-moving game on a directed board when both players play perfectly. | Medium7 | Game theoryGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Seven KingdomsDecide whether the cities split into three cliques holding city 1, city 2, and the rest, and print the lexicographically smallest assignment or impossible. | Medium7 | GraphDFS+2 | No attempts yet | 9s | 128 MB | Judgeable |
| Jeju Island TourPick two vertex-disjoint directed paths in a DAG so the total number of vertices on both paths is as large as possible. | Medium7 | Dynamic programmingGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Catch the BombGiven forbidden left and upper neighbor pairs over 26 letters, find the largest fillable square grid, capped at 20. | Medium7 | GraphTopological sort+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Possible First TilesGiven a top view of 5x5 letter tiles on a grid, print NO when the view is impossible and otherwise list the tiles that could have been laid first. | Medium7 | Topological sortBrute force+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Beam me out!Decide whether a random walk from room 1 reaches room n with certainty and whether every possible walk ends within a bounded number of steps. | Medium7 | GraphDFS+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Spy NetworkValues spread along directed edges by repeated gcd updates until stable, and you count how many employees end at L. | Medium7 | GraphTopological sort+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Grass CownoisseurStarting from field 1 and returning to it, visit the most distinct fields while traveling at most one directed path backwards. | Medium7 | GraphTopological sort+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Coin type identificationDetermine each coin fixed type from the pairwise weighing results, printing ? when it is not unique. | Medium7 | Union-findTopological sort+2 | No attempts yet | 2s | 512 MB | Judgeable |
| InterceptFind every station that lies on all shortest routes from s to t in a directed weighted graph. | Medium7 | Shortest pathGraph+1 | No attempts yet | 1s | 256 MB | Judgeable |
| ARTUROrder the sticks so each one slides straight down off the table without touching the sticks still on it, choosing the lexicographically smallest such order. | Medium7 | Topological sortGeometry+1 | No attempts yet | 1s | 64 MB | Judgeable |
| PromotionsGiven precedence rules and promotion counts A and B, count employees in every valid promotion set of each size and those in none of size B. | Medium7 | Topological sortGraph | No attempts yet | 2s | 256 MB | Judgeable |
| Critical SubprojectsFind every vertex in a DAG that is comparable to all other vertices under reachability. | Medium7 | GraphTopological sort+1 | No attempts yet | 0.6s | 32 MB | Judgeable |