제출 #1064950

#제출 시각아이디문제언어결과실행 시간메모리
1064950sammyuri게임 (APIO22_game)C++17
60 / 100
512 ms3408 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 30005; vector<int> adj[MAXN]; int smallest[MAXN]; int nn, kk; void init(int n, int k) { nn = n; kk = k; for (int i = 0; i < n; i ++) smallest[i] = k; } void dfs(int node) { for (auto a : adj[node]) { if (smallest[a] > smallest[node]) { smallest[a] = smallest[node]; dfs(a); } } } int add_teleporter(int u, int v) { adj[v].push_back(u); int cur = smallest[v]; if (v < kk) cur = v; if (smallest[u] > cur) { smallest[u] = cur; dfs(u); } for (int i = 0; i < kk; i ++) if (smallest[i] <= i) return 1; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...