CSES - Course Schedule II

Author: Benjamin Qi

This problem is equivalent to Minimal Labels from CodeForces. Treat the "label" of a vertex in "Minimal Labels" as the completion time of a course in "Course Schedule II." So it suffices to solve the CF problem (editorial) and then output the inverse permutation.

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using db = double;
using str = string; // yay python!
using pi = pair<int,int>;
using pl = pair<ll,ll>;

Join the USACO Forum!

Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!