#include <time.h>
#include <cstdlib>
#include <stack>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <map>
#include <set>
#include <iterator>
#include <deque>
#include <queue>
#include <sstream>
#include <array>
#include <string>
#include <tuple>
#include <chrono>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <list>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <bitset>
#include "game.h"
#define ll long long
using namespace std;
vector<int> g[200005];
bool ok = 0, f = 0;;
bool us[200005];
int N, K;
void dfs(int p, int d){
us[p] = 1;
for(int to : g[p]){
if(to == d) f = 1;
if(us[to]) continue;
dfs(to, d);
}
}
void init(int n, int k){
for(int i = 0; i < k - 1; i++)
g[i].push_back(i + 1);
N = n;
K = k;
}
int add_teleporter(int u, int v) {
g[u].push_back(v);
for(int i = 0; i < K; i++){
for(int j = 0; j <= N; j++) us[j] = 0;
f = 0;
dfs(i, i);
if(f == 1) return 1;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4952 KB |
Output is correct |
2 |
Correct |
2 ms |
4952 KB |
Output is correct |
3 |
Correct |
14 ms |
4952 KB |
Output is correct |
4 |
Correct |
2 ms |
4948 KB |
Output is correct |
5 |
Correct |
12 ms |
4952 KB |
Output is correct |
6 |
Correct |
12 ms |
4952 KB |
Output is correct |
7 |
Correct |
13 ms |
4952 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4952 KB |
Output is correct |
2 |
Correct |
2 ms |
4952 KB |
Output is correct |
3 |
Correct |
14 ms |
4952 KB |
Output is correct |
4 |
Correct |
2 ms |
4948 KB |
Output is correct |
5 |
Correct |
12 ms |
4952 KB |
Output is correct |
6 |
Correct |
12 ms |
4952 KB |
Output is correct |
7 |
Correct |
13 ms |
4952 KB |
Output is correct |
8 |
Correct |
2 ms |
4952 KB |
Output is correct |
9 |
Correct |
1 ms |
4952 KB |
Output is correct |
10 |
Correct |
1 ms |
4952 KB |
Output is correct |
11 |
Correct |
1 ms |
4952 KB |
Output is correct |
12 |
Correct |
1 ms |
4952 KB |
Output is correct |
13 |
Correct |
1 ms |
4952 KB |
Output is correct |
14 |
Correct |
2 ms |
4952 KB |
Output is correct |
15 |
Correct |
2 ms |
5208 KB |
Output is correct |
16 |
Correct |
2 ms |
4952 KB |
Output is correct |
17 |
Correct |
6 ms |
4952 KB |
Output is correct |
18 |
Correct |
3 ms |
4952 KB |
Output is correct |
19 |
Correct |
3 ms |
4952 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4952 KB |
Output is correct |
2 |
Correct |
2 ms |
4952 KB |
Output is correct |
3 |
Correct |
14 ms |
4952 KB |
Output is correct |
4 |
Correct |
2 ms |
4948 KB |
Output is correct |
5 |
Correct |
12 ms |
4952 KB |
Output is correct |
6 |
Correct |
12 ms |
4952 KB |
Output is correct |
7 |
Correct |
13 ms |
4952 KB |
Output is correct |
8 |
Correct |
2 ms |
4952 KB |
Output is correct |
9 |
Correct |
1 ms |
4952 KB |
Output is correct |
10 |
Correct |
1 ms |
4952 KB |
Output is correct |
11 |
Correct |
1 ms |
4952 KB |
Output is correct |
12 |
Correct |
1 ms |
4952 KB |
Output is correct |
13 |
Correct |
1 ms |
4952 KB |
Output is correct |
14 |
Correct |
2 ms |
4952 KB |
Output is correct |
15 |
Correct |
2 ms |
5208 KB |
Output is correct |
16 |
Correct |
2 ms |
4952 KB |
Output is correct |
17 |
Correct |
6 ms |
4952 KB |
Output is correct |
18 |
Correct |
3 ms |
4952 KB |
Output is correct |
19 |
Correct |
3 ms |
4952 KB |
Output is correct |
20 |
Correct |
2 ms |
4952 KB |
Output is correct |
21 |
Correct |
5 ms |
5152 KB |
Output is correct |
22 |
Correct |
30 ms |
4952 KB |
Output is correct |
23 |
Correct |
2 ms |
4952 KB |
Output is correct |
24 |
Correct |
966 ms |
5692 KB |
Output is correct |
25 |
Correct |
2753 ms |
5440 KB |
Output is correct |
26 |
Correct |
1823 ms |
5176 KB |
Output is correct |
27 |
Execution timed out |
4034 ms |
5432 KB |
Time limit exceeded |
28 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4952 KB |
Output is correct |
2 |
Correct |
2 ms |
4952 KB |
Output is correct |
3 |
Correct |
14 ms |
4952 KB |
Output is correct |
4 |
Correct |
2 ms |
4948 KB |
Output is correct |
5 |
Correct |
12 ms |
4952 KB |
Output is correct |
6 |
Correct |
12 ms |
4952 KB |
Output is correct |
7 |
Correct |
13 ms |
4952 KB |
Output is correct |
8 |
Correct |
2 ms |
4952 KB |
Output is correct |
9 |
Correct |
1 ms |
4952 KB |
Output is correct |
10 |
Correct |
1 ms |
4952 KB |
Output is correct |
11 |
Correct |
1 ms |
4952 KB |
Output is correct |
12 |
Correct |
1 ms |
4952 KB |
Output is correct |
13 |
Correct |
1 ms |
4952 KB |
Output is correct |
14 |
Correct |
2 ms |
4952 KB |
Output is correct |
15 |
Correct |
2 ms |
5208 KB |
Output is correct |
16 |
Correct |
2 ms |
4952 KB |
Output is correct |
17 |
Correct |
6 ms |
4952 KB |
Output is correct |
18 |
Correct |
3 ms |
4952 KB |
Output is correct |
19 |
Correct |
3 ms |
4952 KB |
Output is correct |
20 |
Correct |
2 ms |
4952 KB |
Output is correct |
21 |
Correct |
5 ms |
5152 KB |
Output is correct |
22 |
Correct |
30 ms |
4952 KB |
Output is correct |
23 |
Correct |
2 ms |
4952 KB |
Output is correct |
24 |
Correct |
966 ms |
5692 KB |
Output is correct |
25 |
Correct |
2753 ms |
5440 KB |
Output is correct |
26 |
Correct |
1823 ms |
5176 KB |
Output is correct |
27 |
Execution timed out |
4034 ms |
5432 KB |
Time limit exceeded |
28 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4952 KB |
Output is correct |
2 |
Correct |
2 ms |
4952 KB |
Output is correct |
3 |
Correct |
14 ms |
4952 KB |
Output is correct |
4 |
Correct |
2 ms |
4948 KB |
Output is correct |
5 |
Correct |
12 ms |
4952 KB |
Output is correct |
6 |
Correct |
12 ms |
4952 KB |
Output is correct |
7 |
Correct |
13 ms |
4952 KB |
Output is correct |
8 |
Correct |
2 ms |
4952 KB |
Output is correct |
9 |
Correct |
1 ms |
4952 KB |
Output is correct |
10 |
Correct |
1 ms |
4952 KB |
Output is correct |
11 |
Correct |
1 ms |
4952 KB |
Output is correct |
12 |
Correct |
1 ms |
4952 KB |
Output is correct |
13 |
Correct |
1 ms |
4952 KB |
Output is correct |
14 |
Correct |
2 ms |
4952 KB |
Output is correct |
15 |
Correct |
2 ms |
5208 KB |
Output is correct |
16 |
Correct |
2 ms |
4952 KB |
Output is correct |
17 |
Correct |
6 ms |
4952 KB |
Output is correct |
18 |
Correct |
3 ms |
4952 KB |
Output is correct |
19 |
Correct |
3 ms |
4952 KB |
Output is correct |
20 |
Correct |
2 ms |
4952 KB |
Output is correct |
21 |
Correct |
5 ms |
5152 KB |
Output is correct |
22 |
Correct |
30 ms |
4952 KB |
Output is correct |
23 |
Correct |
2 ms |
4952 KB |
Output is correct |
24 |
Correct |
966 ms |
5692 KB |
Output is correct |
25 |
Correct |
2753 ms |
5440 KB |
Output is correct |
26 |
Correct |
1823 ms |
5176 KB |
Output is correct |
27 |
Execution timed out |
4034 ms |
5432 KB |
Time limit exceeded |
28 |
Halted |
0 ms |
0 KB |
- |