#include <bits/stdc++.h>
#define ll long long
#include "game.h"
using namespace std;
const int N=1e6+7;
vector <ll> g[N];
ll used[N], sz;
void init(int n, int k) {
for (int i=0;i<k-1;i++){
g[i].push_back(i+1);
}
sz=k;
}
int add_teleporter(int u, int v) {
if (u == v && u < sz) return 1;
else if (u == v) return 0;
g[u].push_back(v);
bool ok=0;
fill(used, used+10000, 0);
function <void(ll,ll)> dfs = [&] (ll v, ll p){
used[v]=1;
for (auto l:g[v]){
if (used[l] == 0) dfs(l, v);
else if (used[l] == 1 && l != p){
ok=1;
return ;
}
}
used[v]=2;
};
dfs(0, 0);
if (ok) return 1;
else return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
23760 KB |
Output is correct |
2 |
Correct |
11 ms |
23824 KB |
Output is correct |
3 |
Correct |
12 ms |
23796 KB |
Output is correct |
4 |
Correct |
12 ms |
23800 KB |
Output is correct |
5 |
Correct |
14 ms |
23864 KB |
Output is correct |
6 |
Correct |
14 ms |
23760 KB |
Output is correct |
7 |
Correct |
17 ms |
23888 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
23760 KB |
Output is correct |
2 |
Correct |
11 ms |
23824 KB |
Output is correct |
3 |
Correct |
12 ms |
23796 KB |
Output is correct |
4 |
Correct |
12 ms |
23800 KB |
Output is correct |
5 |
Correct |
14 ms |
23864 KB |
Output is correct |
6 |
Correct |
14 ms |
23760 KB |
Output is correct |
7 |
Correct |
17 ms |
23888 KB |
Output is correct |
8 |
Correct |
11 ms |
23760 KB |
Output is correct |
9 |
Correct |
11 ms |
23760 KB |
Output is correct |
10 |
Correct |
13 ms |
23812 KB |
Output is correct |
11 |
Incorrect |
13 ms |
23760 KB |
Wrong Answer[1] |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
23760 KB |
Output is correct |
2 |
Correct |
11 ms |
23824 KB |
Output is correct |
3 |
Correct |
12 ms |
23796 KB |
Output is correct |
4 |
Correct |
12 ms |
23800 KB |
Output is correct |
5 |
Correct |
14 ms |
23864 KB |
Output is correct |
6 |
Correct |
14 ms |
23760 KB |
Output is correct |
7 |
Correct |
17 ms |
23888 KB |
Output is correct |
8 |
Correct |
11 ms |
23760 KB |
Output is correct |
9 |
Correct |
11 ms |
23760 KB |
Output is correct |
10 |
Correct |
13 ms |
23812 KB |
Output is correct |
11 |
Incorrect |
13 ms |
23760 KB |
Wrong Answer[1] |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
23760 KB |
Output is correct |
2 |
Correct |
11 ms |
23824 KB |
Output is correct |
3 |
Correct |
12 ms |
23796 KB |
Output is correct |
4 |
Correct |
12 ms |
23800 KB |
Output is correct |
5 |
Correct |
14 ms |
23864 KB |
Output is correct |
6 |
Correct |
14 ms |
23760 KB |
Output is correct |
7 |
Correct |
17 ms |
23888 KB |
Output is correct |
8 |
Correct |
11 ms |
23760 KB |
Output is correct |
9 |
Correct |
11 ms |
23760 KB |
Output is correct |
10 |
Correct |
13 ms |
23812 KB |
Output is correct |
11 |
Incorrect |
13 ms |
23760 KB |
Wrong Answer[1] |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
23760 KB |
Output is correct |
2 |
Correct |
11 ms |
23824 KB |
Output is correct |
3 |
Correct |
12 ms |
23796 KB |
Output is correct |
4 |
Correct |
12 ms |
23800 KB |
Output is correct |
5 |
Correct |
14 ms |
23864 KB |
Output is correct |
6 |
Correct |
14 ms |
23760 KB |
Output is correct |
7 |
Correct |
17 ms |
23888 KB |
Output is correct |
8 |
Correct |
11 ms |
23760 KB |
Output is correct |
9 |
Correct |
11 ms |
23760 KB |
Output is correct |
10 |
Correct |
13 ms |
23812 KB |
Output is correct |
11 |
Incorrect |
13 ms |
23760 KB |
Wrong Answer[1] |
12 |
Halted |
0 ms |
0 KB |
- |