위상정렬

    [골3] 2623 - 음악프로그램

    순서는 상관없으므로 예시 출력이랑 일치 안해도 된다. #include #include #include #include using namespace std; #define MAX 1001 vector graph; vector res; int degree[MAX]; int n, m; #define FAST_IO() \ {\ ios::sync_with_stdio(false);\ cin.tie(NULL); \ cout.tie(NULL); \ }\ void BFS() { queue q; for (int i = 1; i > n >> m; while (m--) { int cnt, cur; cin >> cnt >> cur; for (int i = 1; i > nxt; ..

    [골3] 1005 - ACM Craft

    #include #include #include #pragma region 입출력 속도향상 #define FAST_IO() \ {\ ios::sync_with_stdio(false);\ cin.tie(NULL); \ cout.tie(NULL); \ }\ #pragma endregion using namespace std; #define MAX 1002 int main() { FAST_IO(); int t; cin >> t; while (t--) { int n, k; cin >> n >> k; int time[MAX]; for (int i = 1; i > time[i]; vector adj[MAX]; queue q; int degree[MAX]{ 0 }; int res[MAX]{ 0 }; while (k-..

    [골2] 1766 - 문제집

    #include #include #include #include #pragma region 빠른 입출력 #define FAST_IO() \ {\ ios::sync_with_stdio(false);\ cin.tie(NULL); \ cout.tie(NULL); \ }\ #pragma endregion using namespace std; vector degree; vector graph; priority_queue pq; int main() { FAST_IO(); int n, m; cin >> n >> m; graph.assign(100001, vector()); degree.assign(n + 1, 0); for (int i = 0; i > a >> b; g..

    [골3] 2252 - 줄 세우기

    #include #include #include #include #pragma region 빠른 입출력 #define FAST_IO() \ {\ ios::sync_with_stdio(false);\ cin.tie(NULL); \ cout.tie(NULL); \ }\ #pragma endregion using namespace std; vector degree; vector graph; queue q; int main() { FAST_IO(); int n, m; cin >> n >> m; graph.assign(100001, vector()); degree.assign(n + 1, 0); for (int i = 0; i > a >> b; graph[a].pu..