#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
const int MOD=1e9+7;
int n,k;
vector<int> adj[300001];
bool work;
bool vis[1001];
void init(int N,int K){
n=N;
k=K;
work=false;
for (int i=0;i<k-1;i++){
adj[i].pb(i+1);
}
}
void dfs(int x,int ori){
if (x==ori) work=true;
if (work) return;
if (vis[x]) return;
vis[x]=true;
for (auto i:adj[x]){
dfs(i,ori);
}
}
int add_teleporter(int u,int v){
adj[u].pb(v);
memset(vis,false,sizeof(vis));
for (int i=k-1;i>=0;i--){
for (auto j:adj[i]){
dfs(j,i);
if (work) return 1;
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
7332 KB |
Output is correct |
2 |
Correct |
4 ms |
7248 KB |
Output is correct |
3 |
Correct |
6 ms |
7248 KB |
Output is correct |
4 |
Correct |
4 ms |
7352 KB |
Output is correct |
5 |
Correct |
4 ms |
7248 KB |
Output is correct |
6 |
Correct |
5 ms |
7328 KB |
Output is correct |
7 |
Correct |
4 ms |
7248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
7332 KB |
Output is correct |
2 |
Correct |
4 ms |
7248 KB |
Output is correct |
3 |
Correct |
6 ms |
7248 KB |
Output is correct |
4 |
Correct |
4 ms |
7352 KB |
Output is correct |
5 |
Correct |
4 ms |
7248 KB |
Output is correct |
6 |
Correct |
5 ms |
7328 KB |
Output is correct |
7 |
Correct |
4 ms |
7248 KB |
Output is correct |
8 |
Correct |
6 ms |
7248 KB |
Output is correct |
9 |
Correct |
4 ms |
7248 KB |
Output is correct |
10 |
Correct |
5 ms |
7248 KB |
Output is correct |
11 |
Correct |
6 ms |
7336 KB |
Output is correct |
12 |
Correct |
4 ms |
7244 KB |
Output is correct |
13 |
Correct |
4 ms |
7248 KB |
Output is correct |
14 |
Correct |
5 ms |
7248 KB |
Output is correct |
15 |
Correct |
4 ms |
7248 KB |
Output is correct |
16 |
Correct |
4 ms |
7248 KB |
Output is correct |
17 |
Correct |
4 ms |
7248 KB |
Output is correct |
18 |
Correct |
4 ms |
7248 KB |
Output is correct |
19 |
Correct |
4 ms |
7248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
7332 KB |
Output is correct |
2 |
Correct |
4 ms |
7248 KB |
Output is correct |
3 |
Correct |
6 ms |
7248 KB |
Output is correct |
4 |
Correct |
4 ms |
7352 KB |
Output is correct |
5 |
Correct |
4 ms |
7248 KB |
Output is correct |
6 |
Correct |
5 ms |
7328 KB |
Output is correct |
7 |
Correct |
4 ms |
7248 KB |
Output is correct |
8 |
Correct |
6 ms |
7248 KB |
Output is correct |
9 |
Correct |
4 ms |
7248 KB |
Output is correct |
10 |
Correct |
5 ms |
7248 KB |
Output is correct |
11 |
Correct |
6 ms |
7336 KB |
Output is correct |
12 |
Correct |
4 ms |
7244 KB |
Output is correct |
13 |
Correct |
4 ms |
7248 KB |
Output is correct |
14 |
Correct |
5 ms |
7248 KB |
Output is correct |
15 |
Correct |
4 ms |
7248 KB |
Output is correct |
16 |
Correct |
4 ms |
7248 KB |
Output is correct |
17 |
Correct |
4 ms |
7248 KB |
Output is correct |
18 |
Correct |
4 ms |
7248 KB |
Output is correct |
19 |
Correct |
4 ms |
7248 KB |
Output is correct |
20 |
Correct |
5 ms |
7244 KB |
Output is correct |
21 |
Correct |
4 ms |
7248 KB |
Output is correct |
22 |
Correct |
5 ms |
7324 KB |
Output is correct |
23 |
Correct |
4 ms |
7248 KB |
Output is correct |
24 |
Correct |
10 ms |
7376 KB |
Output is correct |
25 |
Correct |
52 ms |
7368 KB |
Output is correct |
26 |
Correct |
62 ms |
7376 KB |
Output is correct |
27 |
Correct |
89 ms |
7376 KB |
Output is correct |
28 |
Correct |
27 ms |
7364 KB |
Output is correct |
29 |
Correct |
66 ms |
7448 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
7332 KB |
Output is correct |
2 |
Correct |
4 ms |
7248 KB |
Output is correct |
3 |
Correct |
6 ms |
7248 KB |
Output is correct |
4 |
Correct |
4 ms |
7352 KB |
Output is correct |
5 |
Correct |
4 ms |
7248 KB |
Output is correct |
6 |
Correct |
5 ms |
7328 KB |
Output is correct |
7 |
Correct |
4 ms |
7248 KB |
Output is correct |
8 |
Correct |
6 ms |
7248 KB |
Output is correct |
9 |
Correct |
4 ms |
7248 KB |
Output is correct |
10 |
Correct |
5 ms |
7248 KB |
Output is correct |
11 |
Correct |
6 ms |
7336 KB |
Output is correct |
12 |
Correct |
4 ms |
7244 KB |
Output is correct |
13 |
Correct |
4 ms |
7248 KB |
Output is correct |
14 |
Correct |
5 ms |
7248 KB |
Output is correct |
15 |
Correct |
4 ms |
7248 KB |
Output is correct |
16 |
Correct |
4 ms |
7248 KB |
Output is correct |
17 |
Correct |
4 ms |
7248 KB |
Output is correct |
18 |
Correct |
4 ms |
7248 KB |
Output is correct |
19 |
Correct |
4 ms |
7248 KB |
Output is correct |
20 |
Correct |
5 ms |
7244 KB |
Output is correct |
21 |
Correct |
4 ms |
7248 KB |
Output is correct |
22 |
Correct |
5 ms |
7324 KB |
Output is correct |
23 |
Correct |
4 ms |
7248 KB |
Output is correct |
24 |
Correct |
10 ms |
7376 KB |
Output is correct |
25 |
Correct |
52 ms |
7368 KB |
Output is correct |
26 |
Correct |
62 ms |
7376 KB |
Output is correct |
27 |
Correct |
89 ms |
7376 KB |
Output is correct |
28 |
Correct |
27 ms |
7364 KB |
Output is correct |
29 |
Correct |
66 ms |
7448 KB |
Output is correct |
30 |
Runtime error |
17 ms |
14928 KB |
Execution killed with signal 11 |
31 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
7332 KB |
Output is correct |
2 |
Correct |
4 ms |
7248 KB |
Output is correct |
3 |
Correct |
6 ms |
7248 KB |
Output is correct |
4 |
Correct |
4 ms |
7352 KB |
Output is correct |
5 |
Correct |
4 ms |
7248 KB |
Output is correct |
6 |
Correct |
5 ms |
7328 KB |
Output is correct |
7 |
Correct |
4 ms |
7248 KB |
Output is correct |
8 |
Correct |
6 ms |
7248 KB |
Output is correct |
9 |
Correct |
4 ms |
7248 KB |
Output is correct |
10 |
Correct |
5 ms |
7248 KB |
Output is correct |
11 |
Correct |
6 ms |
7336 KB |
Output is correct |
12 |
Correct |
4 ms |
7244 KB |
Output is correct |
13 |
Correct |
4 ms |
7248 KB |
Output is correct |
14 |
Correct |
5 ms |
7248 KB |
Output is correct |
15 |
Correct |
4 ms |
7248 KB |
Output is correct |
16 |
Correct |
4 ms |
7248 KB |
Output is correct |
17 |
Correct |
4 ms |
7248 KB |
Output is correct |
18 |
Correct |
4 ms |
7248 KB |
Output is correct |
19 |
Correct |
4 ms |
7248 KB |
Output is correct |
20 |
Correct |
5 ms |
7244 KB |
Output is correct |
21 |
Correct |
4 ms |
7248 KB |
Output is correct |
22 |
Correct |
5 ms |
7324 KB |
Output is correct |
23 |
Correct |
4 ms |
7248 KB |
Output is correct |
24 |
Correct |
10 ms |
7376 KB |
Output is correct |
25 |
Correct |
52 ms |
7368 KB |
Output is correct |
26 |
Correct |
62 ms |
7376 KB |
Output is correct |
27 |
Correct |
89 ms |
7376 KB |
Output is correct |
28 |
Correct |
27 ms |
7364 KB |
Output is correct |
29 |
Correct |
66 ms |
7448 KB |
Output is correct |
30 |
Runtime error |
17 ms |
14928 KB |
Execution killed with signal 11 |
31 |
Halted |
0 ms |
0 KB |
- |