이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |