#include "game.h"
#include <iostream>
#include <vector>
#include <set>
#include <queue>
using namespace std;
vector<vector<vector<int>>> G(1001,vector<vector<int>>(3010));
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 |
40 ms |
74680 KB |
Output is correct |
2 |
Correct |
46 ms |
74700 KB |
Output is correct |
3 |
Correct |
41 ms |
75100 KB |
Output is correct |
4 |
Correct |
41 ms |
74840 KB |
Output is correct |
5 |
Correct |
43 ms |
75080 KB |
Output is correct |
6 |
Correct |
42 ms |
75000 KB |
Output is correct |
7 |
Correct |
41 ms |
75052 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
40 ms |
74680 KB |
Output is correct |
2 |
Correct |
46 ms |
74700 KB |
Output is correct |
3 |
Correct |
41 ms |
75100 KB |
Output is correct |
4 |
Correct |
41 ms |
74840 KB |
Output is correct |
5 |
Correct |
43 ms |
75080 KB |
Output is correct |
6 |
Correct |
42 ms |
75000 KB |
Output is correct |
7 |
Correct |
41 ms |
75052 KB |
Output is correct |
8 |
Correct |
41 ms |
74724 KB |
Output is correct |
9 |
Correct |
39 ms |
74812 KB |
Output is correct |
10 |
Correct |
39 ms |
74760 KB |
Output is correct |
11 |
Correct |
44 ms |
74728 KB |
Output is correct |
12 |
Correct |
42 ms |
74812 KB |
Output is correct |
13 |
Correct |
41 ms |
74824 KB |
Output is correct |
14 |
Correct |
43 ms |
74880 KB |
Output is correct |
15 |
Correct |
42 ms |
74776 KB |
Output is correct |
16 |
Correct |
40 ms |
74764 KB |
Output is correct |
17 |
Correct |
41 ms |
74892 KB |
Output is correct |
18 |
Correct |
40 ms |
74844 KB |
Output is correct |
19 |
Correct |
39 ms |
74828 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
40 ms |
74680 KB |
Output is correct |
2 |
Correct |
46 ms |
74700 KB |
Output is correct |
3 |
Correct |
41 ms |
75100 KB |
Output is correct |
4 |
Correct |
41 ms |
74840 KB |
Output is correct |
5 |
Correct |
43 ms |
75080 KB |
Output is correct |
6 |
Correct |
42 ms |
75000 KB |
Output is correct |
7 |
Correct |
41 ms |
75052 KB |
Output is correct |
8 |
Correct |
41 ms |
74724 KB |
Output is correct |
9 |
Correct |
39 ms |
74812 KB |
Output is correct |
10 |
Correct |
39 ms |
74760 KB |
Output is correct |
11 |
Correct |
44 ms |
74728 KB |
Output is correct |
12 |
Correct |
42 ms |
74812 KB |
Output is correct |
13 |
Correct |
41 ms |
74824 KB |
Output is correct |
14 |
Correct |
43 ms |
74880 KB |
Output is correct |
15 |
Correct |
42 ms |
74776 KB |
Output is correct |
16 |
Correct |
40 ms |
74764 KB |
Output is correct |
17 |
Correct |
41 ms |
74892 KB |
Output is correct |
18 |
Correct |
40 ms |
74844 KB |
Output is correct |
19 |
Correct |
39 ms |
74828 KB |
Output is correct |
20 |
Correct |
43 ms |
75108 KB |
Output is correct |
21 |
Correct |
43 ms |
75188 KB |
Output is correct |
22 |
Correct |
48 ms |
77428 KB |
Output is correct |
23 |
Correct |
41 ms |
75076 KB |
Output is correct |
24 |
Correct |
102 ms |
86908 KB |
Output is correct |
25 |
Correct |
138 ms |
84748 KB |
Output is correct |
26 |
Correct |
71 ms |
78280 KB |
Output is correct |
27 |
Correct |
307 ms |
91284 KB |
Output is correct |
28 |
Correct |
138 ms |
84324 KB |
Output is correct |
29 |
Correct |
222 ms |
91860 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
40 ms |
74680 KB |
Output is correct |
2 |
Correct |
46 ms |
74700 KB |
Output is correct |
3 |
Correct |
41 ms |
75100 KB |
Output is correct |
4 |
Correct |
41 ms |
74840 KB |
Output is correct |
5 |
Correct |
43 ms |
75080 KB |
Output is correct |
6 |
Correct |
42 ms |
75000 KB |
Output is correct |
7 |
Correct |
41 ms |
75052 KB |
Output is correct |
8 |
Correct |
41 ms |
74724 KB |
Output is correct |
9 |
Correct |
39 ms |
74812 KB |
Output is correct |
10 |
Correct |
39 ms |
74760 KB |
Output is correct |
11 |
Correct |
44 ms |
74728 KB |
Output is correct |
12 |
Correct |
42 ms |
74812 KB |
Output is correct |
13 |
Correct |
41 ms |
74824 KB |
Output is correct |
14 |
Correct |
43 ms |
74880 KB |
Output is correct |
15 |
Correct |
42 ms |
74776 KB |
Output is correct |
16 |
Correct |
40 ms |
74764 KB |
Output is correct |
17 |
Correct |
41 ms |
74892 KB |
Output is correct |
18 |
Correct |
40 ms |
74844 KB |
Output is correct |
19 |
Correct |
39 ms |
74828 KB |
Output is correct |
20 |
Correct |
43 ms |
75108 KB |
Output is correct |
21 |
Correct |
43 ms |
75188 KB |
Output is correct |
22 |
Correct |
48 ms |
77428 KB |
Output is correct |
23 |
Correct |
41 ms |
75076 KB |
Output is correct |
24 |
Correct |
102 ms |
86908 KB |
Output is correct |
25 |
Correct |
138 ms |
84748 KB |
Output is correct |
26 |
Correct |
71 ms |
78280 KB |
Output is correct |
27 |
Correct |
307 ms |
91284 KB |
Output is correct |
28 |
Correct |
138 ms |
84324 KB |
Output is correct |
29 |
Correct |
222 ms |
91860 KB |
Output is correct |
30 |
Runtime error |
103 ms |
152264 KB |
Execution killed with signal 6 |
31 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
40 ms |
74680 KB |
Output is correct |
2 |
Correct |
46 ms |
74700 KB |
Output is correct |
3 |
Correct |
41 ms |
75100 KB |
Output is correct |
4 |
Correct |
41 ms |
74840 KB |
Output is correct |
5 |
Correct |
43 ms |
75080 KB |
Output is correct |
6 |
Correct |
42 ms |
75000 KB |
Output is correct |
7 |
Correct |
41 ms |
75052 KB |
Output is correct |
8 |
Correct |
41 ms |
74724 KB |
Output is correct |
9 |
Correct |
39 ms |
74812 KB |
Output is correct |
10 |
Correct |
39 ms |
74760 KB |
Output is correct |
11 |
Correct |
44 ms |
74728 KB |
Output is correct |
12 |
Correct |
42 ms |
74812 KB |
Output is correct |
13 |
Correct |
41 ms |
74824 KB |
Output is correct |
14 |
Correct |
43 ms |
74880 KB |
Output is correct |
15 |
Correct |
42 ms |
74776 KB |
Output is correct |
16 |
Correct |
40 ms |
74764 KB |
Output is correct |
17 |
Correct |
41 ms |
74892 KB |
Output is correct |
18 |
Correct |
40 ms |
74844 KB |
Output is correct |
19 |
Correct |
39 ms |
74828 KB |
Output is correct |
20 |
Correct |
43 ms |
75108 KB |
Output is correct |
21 |
Correct |
43 ms |
75188 KB |
Output is correct |
22 |
Correct |
48 ms |
77428 KB |
Output is correct |
23 |
Correct |
41 ms |
75076 KB |
Output is correct |
24 |
Correct |
102 ms |
86908 KB |
Output is correct |
25 |
Correct |
138 ms |
84748 KB |
Output is correct |
26 |
Correct |
71 ms |
78280 KB |
Output is correct |
27 |
Correct |
307 ms |
91284 KB |
Output is correct |
28 |
Correct |
138 ms |
84324 KB |
Output is correct |
29 |
Correct |
222 ms |
91860 KB |
Output is correct |
30 |
Runtime error |
103 ms |
152264 KB |
Execution killed with signal 6 |
31 |
Halted |
0 ms |
0 KB |
- |