#include "game.h"
#include <iostream>
#include <vector>
#include <set>
#include <queue>
using namespace std;
vector<vector<vector<int>>> G(1001,vector<vector<int>>(1010));
vector<vector<bool>> P(1001,vector<bool>(30010,false));
int N,K;
void init(int n, int k) {
N = n;
K = k;
for(int i=0;i<k;i++)for(int j=i;j<k;j++) P[i][j] = true;
}
int add_teleporter(int u, int v) {
for(int i=0;i<K;i++){
G[i][u].push_back(v);
if(!P[i][u]){
continue;
}
queue<int> q;
q.push(u);
while(!q.empty()){
int pos = q.front();
q.pop();
for(int x:G[i][pos]){
if(P[i][x]){
if(x <= i) return 1;
continue;
}
P[i][x] = true;
q.push(x);
}
G[i][pos].clear();
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
27728 KB |
Output is correct |
2 |
Correct |
15 ms |
27692 KB |
Output is correct |
3 |
Correct |
17 ms |
28088 KB |
Output is correct |
4 |
Correct |
18 ms |
27796 KB |
Output is correct |
5 |
Correct |
17 ms |
27984 KB |
Output is correct |
6 |
Correct |
18 ms |
27984 KB |
Output is correct |
7 |
Correct |
19 ms |
28020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
27728 KB |
Output is correct |
2 |
Correct |
15 ms |
27692 KB |
Output is correct |
3 |
Correct |
17 ms |
28088 KB |
Output is correct |
4 |
Correct |
18 ms |
27796 KB |
Output is correct |
5 |
Correct |
17 ms |
27984 KB |
Output is correct |
6 |
Correct |
18 ms |
27984 KB |
Output is correct |
7 |
Correct |
19 ms |
28020 KB |
Output is correct |
8 |
Correct |
17 ms |
27728 KB |
Output is correct |
9 |
Correct |
18 ms |
27720 KB |
Output is correct |
10 |
Correct |
19 ms |
27728 KB |
Output is correct |
11 |
Correct |
20 ms |
27728 KB |
Output is correct |
12 |
Correct |
16 ms |
27804 KB |
Output is correct |
13 |
Correct |
16 ms |
27832 KB |
Output is correct |
14 |
Correct |
16 ms |
27856 KB |
Output is correct |
15 |
Correct |
16 ms |
27856 KB |
Output is correct |
16 |
Correct |
17 ms |
27768 KB |
Output is correct |
17 |
Correct |
17 ms |
27920 KB |
Output is correct |
18 |
Correct |
17 ms |
27860 KB |
Output is correct |
19 |
Correct |
16 ms |
27948 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
27728 KB |
Output is correct |
2 |
Correct |
15 ms |
27692 KB |
Output is correct |
3 |
Correct |
17 ms |
28088 KB |
Output is correct |
4 |
Correct |
18 ms |
27796 KB |
Output is correct |
5 |
Correct |
17 ms |
27984 KB |
Output is correct |
6 |
Correct |
18 ms |
27984 KB |
Output is correct |
7 |
Correct |
19 ms |
28020 KB |
Output is correct |
8 |
Correct |
17 ms |
27728 KB |
Output is correct |
9 |
Correct |
18 ms |
27720 KB |
Output is correct |
10 |
Correct |
19 ms |
27728 KB |
Output is correct |
11 |
Correct |
20 ms |
27728 KB |
Output is correct |
12 |
Correct |
16 ms |
27804 KB |
Output is correct |
13 |
Correct |
16 ms |
27832 KB |
Output is correct |
14 |
Correct |
16 ms |
27856 KB |
Output is correct |
15 |
Correct |
16 ms |
27856 KB |
Output is correct |
16 |
Correct |
17 ms |
27768 KB |
Output is correct |
17 |
Correct |
17 ms |
27920 KB |
Output is correct |
18 |
Correct |
17 ms |
27860 KB |
Output is correct |
19 |
Correct |
16 ms |
27948 KB |
Output is correct |
20 |
Correct |
18 ms |
27912 KB |
Output is correct |
21 |
Correct |
19 ms |
28100 KB |
Output is correct |
22 |
Correct |
25 ms |
30396 KB |
Output is correct |
23 |
Correct |
22 ms |
27984 KB |
Output is correct |
24 |
Correct |
100 ms |
39848 KB |
Output is correct |
25 |
Correct |
151 ms |
37784 KB |
Output is correct |
26 |
Correct |
55 ms |
31356 KB |
Output is correct |
27 |
Correct |
328 ms |
44116 KB |
Output is correct |
28 |
Correct |
107 ms |
37324 KB |
Output is correct |
29 |
Correct |
225 ms |
44880 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
27728 KB |
Output is correct |
2 |
Correct |
15 ms |
27692 KB |
Output is correct |
3 |
Correct |
17 ms |
28088 KB |
Output is correct |
4 |
Correct |
18 ms |
27796 KB |
Output is correct |
5 |
Correct |
17 ms |
27984 KB |
Output is correct |
6 |
Correct |
18 ms |
27984 KB |
Output is correct |
7 |
Correct |
19 ms |
28020 KB |
Output is correct |
8 |
Correct |
17 ms |
27728 KB |
Output is correct |
9 |
Correct |
18 ms |
27720 KB |
Output is correct |
10 |
Correct |
19 ms |
27728 KB |
Output is correct |
11 |
Correct |
20 ms |
27728 KB |
Output is correct |
12 |
Correct |
16 ms |
27804 KB |
Output is correct |
13 |
Correct |
16 ms |
27832 KB |
Output is correct |
14 |
Correct |
16 ms |
27856 KB |
Output is correct |
15 |
Correct |
16 ms |
27856 KB |
Output is correct |
16 |
Correct |
17 ms |
27768 KB |
Output is correct |
17 |
Correct |
17 ms |
27920 KB |
Output is correct |
18 |
Correct |
17 ms |
27860 KB |
Output is correct |
19 |
Correct |
16 ms |
27948 KB |
Output is correct |
20 |
Correct |
18 ms |
27912 KB |
Output is correct |
21 |
Correct |
19 ms |
28100 KB |
Output is correct |
22 |
Correct |
25 ms |
30396 KB |
Output is correct |
23 |
Correct |
22 ms |
27984 KB |
Output is correct |
24 |
Correct |
100 ms |
39848 KB |
Output is correct |
25 |
Correct |
151 ms |
37784 KB |
Output is correct |
26 |
Correct |
55 ms |
31356 KB |
Output is correct |
27 |
Correct |
328 ms |
44116 KB |
Output is correct |
28 |
Correct |
107 ms |
37324 KB |
Output is correct |
29 |
Correct |
225 ms |
44880 KB |
Output is correct |
30 |
Runtime error |
43 ms |
56296 KB |
Execution killed with signal 11 |
31 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
27728 KB |
Output is correct |
2 |
Correct |
15 ms |
27692 KB |
Output is correct |
3 |
Correct |
17 ms |
28088 KB |
Output is correct |
4 |
Correct |
18 ms |
27796 KB |
Output is correct |
5 |
Correct |
17 ms |
27984 KB |
Output is correct |
6 |
Correct |
18 ms |
27984 KB |
Output is correct |
7 |
Correct |
19 ms |
28020 KB |
Output is correct |
8 |
Correct |
17 ms |
27728 KB |
Output is correct |
9 |
Correct |
18 ms |
27720 KB |
Output is correct |
10 |
Correct |
19 ms |
27728 KB |
Output is correct |
11 |
Correct |
20 ms |
27728 KB |
Output is correct |
12 |
Correct |
16 ms |
27804 KB |
Output is correct |
13 |
Correct |
16 ms |
27832 KB |
Output is correct |
14 |
Correct |
16 ms |
27856 KB |
Output is correct |
15 |
Correct |
16 ms |
27856 KB |
Output is correct |
16 |
Correct |
17 ms |
27768 KB |
Output is correct |
17 |
Correct |
17 ms |
27920 KB |
Output is correct |
18 |
Correct |
17 ms |
27860 KB |
Output is correct |
19 |
Correct |
16 ms |
27948 KB |
Output is correct |
20 |
Correct |
18 ms |
27912 KB |
Output is correct |
21 |
Correct |
19 ms |
28100 KB |
Output is correct |
22 |
Correct |
25 ms |
30396 KB |
Output is correct |
23 |
Correct |
22 ms |
27984 KB |
Output is correct |
24 |
Correct |
100 ms |
39848 KB |
Output is correct |
25 |
Correct |
151 ms |
37784 KB |
Output is correct |
26 |
Correct |
55 ms |
31356 KB |
Output is correct |
27 |
Correct |
328 ms |
44116 KB |
Output is correct |
28 |
Correct |
107 ms |
37324 KB |
Output is correct |
29 |
Correct |
225 ms |
44880 KB |
Output is correct |
30 |
Runtime error |
43 ms |
56296 KB |
Execution killed with signal 11 |
31 |
Halted |
0 ms |
0 KB |
- |