This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "game.h"
using namespace std;
int n,k;
vector<vector<int>> al;
void init(int N, int K) {
n=N; k=K;
al.assign(n,vector<int>());
for (int i=0; i<k-1; i++) al[i].push_back(i+1);
}
vector<int> vis(n,0);
bool dfs(int u) {
vis[u]=1;
for (int v: al[u]) {
if (v<k&&vis[v]) return true;
if (vis[v]) continue;
if (dfs(v)) return true;
}
return false;
}
int add_teleporter(int u, int v) {
al[u].push_back(v);
vis.assign(n,0);
if (dfs(0)) 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... |