#include "game.h"
#include<bits/stdc++.h>
#define pb push_back
#define F first
#define S second
using namespace std;
const int M = 1e6 + 5, MOD = 1e9 + 7;
int N, K, col[M];
vector<int> g[M];
void init(int n, int k) {
N = n, K = k;
for(int i = 0; i < k - 1; ++i)
g[i].pb(i + 1);
}
bool dfs(int node){
col[node] = 1;
bool cur = 0;
for(auto k : g[node]){
if(col[k] == 0)
cur |= dfs(k);
else if(col[k] == 1){
if(k < K)
cur |= 1;
}
}
col[node] = 2;
return cur;
}
int add_teleporter(int u, int v) {
if(N == K){
if(u >= v)
return 1;
return 0;
}
if(u < K and v < K)
if(u >= v)
return 1;
for(int i = 0; i < N; ++i) col[i] = 0;
g[u].pb(v);
return dfs(0);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
23760 KB |
Output is correct |
2 |
Correct |
14 ms |
23760 KB |
Output is correct |
3 |
Correct |
13 ms |
23760 KB |
Output is correct |
4 |
Correct |
13 ms |
23760 KB |
Output is correct |
5 |
Correct |
13 ms |
23736 KB |
Output is correct |
6 |
Correct |
13 ms |
23760 KB |
Output is correct |
7 |
Correct |
12 ms |
23760 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
23760 KB |
Output is correct |
2 |
Correct |
14 ms |
23760 KB |
Output is correct |
3 |
Correct |
13 ms |
23760 KB |
Output is correct |
4 |
Correct |
13 ms |
23760 KB |
Output is correct |
5 |
Correct |
13 ms |
23736 KB |
Output is correct |
6 |
Correct |
13 ms |
23760 KB |
Output is correct |
7 |
Correct |
12 ms |
23760 KB |
Output is correct |
8 |
Correct |
12 ms |
23740 KB |
Output is correct |
9 |
Correct |
11 ms |
23760 KB |
Output is correct |
10 |
Correct |
17 ms |
23760 KB |
Output is correct |
11 |
Correct |
15 ms |
23796 KB |
Output is correct |
12 |
Correct |
17 ms |
23760 KB |
Output is correct |
13 |
Correct |
13 ms |
23760 KB |
Output is correct |
14 |
Correct |
15 ms |
23760 KB |
Output is correct |
15 |
Correct |
13 ms |
23760 KB |
Output is correct |
16 |
Correct |
14 ms |
23760 KB |
Output is correct |
17 |
Correct |
12 ms |
23768 KB |
Output is correct |
18 |
Correct |
13 ms |
23728 KB |
Output is correct |
19 |
Correct |
13 ms |
23760 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
23760 KB |
Output is correct |
2 |
Correct |
14 ms |
23760 KB |
Output is correct |
3 |
Correct |
13 ms |
23760 KB |
Output is correct |
4 |
Correct |
13 ms |
23760 KB |
Output is correct |
5 |
Correct |
13 ms |
23736 KB |
Output is correct |
6 |
Correct |
13 ms |
23760 KB |
Output is correct |
7 |
Correct |
12 ms |
23760 KB |
Output is correct |
8 |
Correct |
12 ms |
23740 KB |
Output is correct |
9 |
Correct |
11 ms |
23760 KB |
Output is correct |
10 |
Correct |
17 ms |
23760 KB |
Output is correct |
11 |
Correct |
15 ms |
23796 KB |
Output is correct |
12 |
Correct |
17 ms |
23760 KB |
Output is correct |
13 |
Correct |
13 ms |
23760 KB |
Output is correct |
14 |
Correct |
15 ms |
23760 KB |
Output is correct |
15 |
Correct |
13 ms |
23760 KB |
Output is correct |
16 |
Correct |
14 ms |
23760 KB |
Output is correct |
17 |
Correct |
12 ms |
23768 KB |
Output is correct |
18 |
Correct |
13 ms |
23728 KB |
Output is correct |
19 |
Correct |
13 ms |
23760 KB |
Output is correct |
20 |
Correct |
13 ms |
23784 KB |
Output is correct |
21 |
Correct |
12 ms |
23760 KB |
Output is correct |
22 |
Correct |
13 ms |
23760 KB |
Output is correct |
23 |
Correct |
14 ms |
23788 KB |
Output is correct |
24 |
Correct |
22 ms |
23832 KB |
Output is correct |
25 |
Correct |
53 ms |
23828 KB |
Output is correct |
26 |
Correct |
66 ms |
23820 KB |
Output is correct |
27 |
Correct |
72 ms |
23760 KB |
Output is correct |
28 |
Correct |
28 ms |
23880 KB |
Output is correct |
29 |
Correct |
52 ms |
23836 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
23760 KB |
Output is correct |
2 |
Correct |
14 ms |
23760 KB |
Output is correct |
3 |
Correct |
13 ms |
23760 KB |
Output is correct |
4 |
Correct |
13 ms |
23760 KB |
Output is correct |
5 |
Correct |
13 ms |
23736 KB |
Output is correct |
6 |
Correct |
13 ms |
23760 KB |
Output is correct |
7 |
Correct |
12 ms |
23760 KB |
Output is correct |
8 |
Correct |
12 ms |
23740 KB |
Output is correct |
9 |
Correct |
11 ms |
23760 KB |
Output is correct |
10 |
Correct |
17 ms |
23760 KB |
Output is correct |
11 |
Correct |
15 ms |
23796 KB |
Output is correct |
12 |
Correct |
17 ms |
23760 KB |
Output is correct |
13 |
Correct |
13 ms |
23760 KB |
Output is correct |
14 |
Correct |
15 ms |
23760 KB |
Output is correct |
15 |
Correct |
13 ms |
23760 KB |
Output is correct |
16 |
Correct |
14 ms |
23760 KB |
Output is correct |
17 |
Correct |
12 ms |
23768 KB |
Output is correct |
18 |
Correct |
13 ms |
23728 KB |
Output is correct |
19 |
Correct |
13 ms |
23760 KB |
Output is correct |
20 |
Correct |
13 ms |
23784 KB |
Output is correct |
21 |
Correct |
12 ms |
23760 KB |
Output is correct |
22 |
Correct |
13 ms |
23760 KB |
Output is correct |
23 |
Correct |
14 ms |
23788 KB |
Output is correct |
24 |
Correct |
22 ms |
23832 KB |
Output is correct |
25 |
Correct |
53 ms |
23828 KB |
Output is correct |
26 |
Correct |
66 ms |
23820 KB |
Output is correct |
27 |
Correct |
72 ms |
23760 KB |
Output is correct |
28 |
Correct |
28 ms |
23880 KB |
Output is correct |
29 |
Correct |
52 ms |
23836 KB |
Output is correct |
30 |
Correct |
242 ms |
24452 KB |
Output is correct |
31 |
Correct |
127 ms |
24176 KB |
Output is correct |
32 |
Correct |
163 ms |
25692 KB |
Output is correct |
33 |
Correct |
114 ms |
24720 KB |
Output is correct |
34 |
Correct |
1395 ms |
26904 KB |
Output is correct |
35 |
Execution timed out |
4043 ms |
25080 KB |
Time limit exceeded |
36 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
23760 KB |
Output is correct |
2 |
Correct |
14 ms |
23760 KB |
Output is correct |
3 |
Correct |
13 ms |
23760 KB |
Output is correct |
4 |
Correct |
13 ms |
23760 KB |
Output is correct |
5 |
Correct |
13 ms |
23736 KB |
Output is correct |
6 |
Correct |
13 ms |
23760 KB |
Output is correct |
7 |
Correct |
12 ms |
23760 KB |
Output is correct |
8 |
Correct |
12 ms |
23740 KB |
Output is correct |
9 |
Correct |
11 ms |
23760 KB |
Output is correct |
10 |
Correct |
17 ms |
23760 KB |
Output is correct |
11 |
Correct |
15 ms |
23796 KB |
Output is correct |
12 |
Correct |
17 ms |
23760 KB |
Output is correct |
13 |
Correct |
13 ms |
23760 KB |
Output is correct |
14 |
Correct |
15 ms |
23760 KB |
Output is correct |
15 |
Correct |
13 ms |
23760 KB |
Output is correct |
16 |
Correct |
14 ms |
23760 KB |
Output is correct |
17 |
Correct |
12 ms |
23768 KB |
Output is correct |
18 |
Correct |
13 ms |
23728 KB |
Output is correct |
19 |
Correct |
13 ms |
23760 KB |
Output is correct |
20 |
Correct |
13 ms |
23784 KB |
Output is correct |
21 |
Correct |
12 ms |
23760 KB |
Output is correct |
22 |
Correct |
13 ms |
23760 KB |
Output is correct |
23 |
Correct |
14 ms |
23788 KB |
Output is correct |
24 |
Correct |
22 ms |
23832 KB |
Output is correct |
25 |
Correct |
53 ms |
23828 KB |
Output is correct |
26 |
Correct |
66 ms |
23820 KB |
Output is correct |
27 |
Correct |
72 ms |
23760 KB |
Output is correct |
28 |
Correct |
28 ms |
23880 KB |
Output is correct |
29 |
Correct |
52 ms |
23836 KB |
Output is correct |
30 |
Correct |
242 ms |
24452 KB |
Output is correct |
31 |
Correct |
127 ms |
24176 KB |
Output is correct |
32 |
Correct |
163 ms |
25692 KB |
Output is correct |
33 |
Correct |
114 ms |
24720 KB |
Output is correct |
34 |
Correct |
1395 ms |
26904 KB |
Output is correct |
35 |
Execution timed out |
4043 ms |
25080 KB |
Time limit exceeded |
36 |
Halted |
0 ms |
0 KB |
- |