#include "game.h"
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <map>
using namespace std;
map<int,map<int,vector<int>>> G;
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].emplace_back(v);
if(!P[i][u]){
continue;
}
deque<int> q;
q.push_back(u);
while(!q.empty()){
int pos = q.front();
q.pop_front();
for(int x:G[i][pos]){
if(P[i][x]){
if(x <= i) return 1;
continue;
}
P[i][x] = true;
q.push_back(x);
}
G[i][pos].clear();
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3920 KB |
Output is correct |
2 |
Correct |
2 ms |
3920 KB |
Output is correct |
3 |
Correct |
8 ms |
4944 KB |
Output is correct |
4 |
Correct |
3 ms |
4176 KB |
Output is correct |
5 |
Correct |
7 ms |
4944 KB |
Output is correct |
6 |
Correct |
7 ms |
4944 KB |
Output is correct |
7 |
Correct |
7 ms |
4944 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3920 KB |
Output is correct |
2 |
Correct |
2 ms |
3920 KB |
Output is correct |
3 |
Correct |
8 ms |
4944 KB |
Output is correct |
4 |
Correct |
3 ms |
4176 KB |
Output is correct |
5 |
Correct |
7 ms |
4944 KB |
Output is correct |
6 |
Correct |
7 ms |
4944 KB |
Output is correct |
7 |
Correct |
7 ms |
4944 KB |
Output is correct |
8 |
Correct |
2 ms |
3920 KB |
Output is correct |
9 |
Correct |
2 ms |
3920 KB |
Output is correct |
10 |
Correct |
3 ms |
3920 KB |
Output is correct |
11 |
Correct |
3 ms |
4048 KB |
Output is correct |
12 |
Correct |
2 ms |
4024 KB |
Output is correct |
13 |
Correct |
3 ms |
4048 KB |
Output is correct |
14 |
Correct |
3 ms |
4432 KB |
Output is correct |
15 |
Correct |
3 ms |
4308 KB |
Output is correct |
16 |
Correct |
3 ms |
4096 KB |
Output is correct |
17 |
Correct |
5 ms |
4432 KB |
Output is correct |
18 |
Correct |
5 ms |
4320 KB |
Output is correct |
19 |
Correct |
3 ms |
4304 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3920 KB |
Output is correct |
2 |
Correct |
2 ms |
3920 KB |
Output is correct |
3 |
Correct |
8 ms |
4944 KB |
Output is correct |
4 |
Correct |
3 ms |
4176 KB |
Output is correct |
5 |
Correct |
7 ms |
4944 KB |
Output is correct |
6 |
Correct |
7 ms |
4944 KB |
Output is correct |
7 |
Correct |
7 ms |
4944 KB |
Output is correct |
8 |
Correct |
2 ms |
3920 KB |
Output is correct |
9 |
Correct |
2 ms |
3920 KB |
Output is correct |
10 |
Correct |
3 ms |
3920 KB |
Output is correct |
11 |
Correct |
3 ms |
4048 KB |
Output is correct |
12 |
Correct |
2 ms |
4024 KB |
Output is correct |
13 |
Correct |
3 ms |
4048 KB |
Output is correct |
14 |
Correct |
3 ms |
4432 KB |
Output is correct |
15 |
Correct |
3 ms |
4308 KB |
Output is correct |
16 |
Correct |
3 ms |
4096 KB |
Output is correct |
17 |
Correct |
5 ms |
4432 KB |
Output is correct |
18 |
Correct |
5 ms |
4320 KB |
Output is correct |
19 |
Correct |
3 ms |
4304 KB |
Output is correct |
20 |
Correct |
5 ms |
4708 KB |
Output is correct |
21 |
Correct |
6 ms |
5476 KB |
Output is correct |
22 |
Correct |
30 ms |
13396 KB |
Output is correct |
23 |
Correct |
5 ms |
5072 KB |
Output is correct |
24 |
Correct |
154 ms |
45472 KB |
Output is correct |
25 |
Correct |
271 ms |
34400 KB |
Output is correct |
26 |
Correct |
122 ms |
15104 KB |
Output is correct |
27 |
Correct |
543 ms |
59404 KB |
Output is correct |
28 |
Correct |
170 ms |
31212 KB |
Output is correct |
29 |
Correct |
392 ms |
57512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3920 KB |
Output is correct |
2 |
Correct |
2 ms |
3920 KB |
Output is correct |
3 |
Correct |
8 ms |
4944 KB |
Output is correct |
4 |
Correct |
3 ms |
4176 KB |
Output is correct |
5 |
Correct |
7 ms |
4944 KB |
Output is correct |
6 |
Correct |
7 ms |
4944 KB |
Output is correct |
7 |
Correct |
7 ms |
4944 KB |
Output is correct |
8 |
Correct |
2 ms |
3920 KB |
Output is correct |
9 |
Correct |
2 ms |
3920 KB |
Output is correct |
10 |
Correct |
3 ms |
3920 KB |
Output is correct |
11 |
Correct |
3 ms |
4048 KB |
Output is correct |
12 |
Correct |
2 ms |
4024 KB |
Output is correct |
13 |
Correct |
3 ms |
4048 KB |
Output is correct |
14 |
Correct |
3 ms |
4432 KB |
Output is correct |
15 |
Correct |
3 ms |
4308 KB |
Output is correct |
16 |
Correct |
3 ms |
4096 KB |
Output is correct |
17 |
Correct |
5 ms |
4432 KB |
Output is correct |
18 |
Correct |
5 ms |
4320 KB |
Output is correct |
19 |
Correct |
3 ms |
4304 KB |
Output is correct |
20 |
Correct |
5 ms |
4708 KB |
Output is correct |
21 |
Correct |
6 ms |
5476 KB |
Output is correct |
22 |
Correct |
30 ms |
13396 KB |
Output is correct |
23 |
Correct |
5 ms |
5072 KB |
Output is correct |
24 |
Correct |
154 ms |
45472 KB |
Output is correct |
25 |
Correct |
271 ms |
34400 KB |
Output is correct |
26 |
Correct |
122 ms |
15104 KB |
Output is correct |
27 |
Correct |
543 ms |
59404 KB |
Output is correct |
28 |
Correct |
170 ms |
31212 KB |
Output is correct |
29 |
Correct |
392 ms |
57512 KB |
Output is correct |
30 |
Correct |
938 ms |
209504 KB |
Output is correct |
31 |
Runtime error |
506 ms |
262144 KB |
Execution killed with signal 9 |
32 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3920 KB |
Output is correct |
2 |
Correct |
2 ms |
3920 KB |
Output is correct |
3 |
Correct |
8 ms |
4944 KB |
Output is correct |
4 |
Correct |
3 ms |
4176 KB |
Output is correct |
5 |
Correct |
7 ms |
4944 KB |
Output is correct |
6 |
Correct |
7 ms |
4944 KB |
Output is correct |
7 |
Correct |
7 ms |
4944 KB |
Output is correct |
8 |
Correct |
2 ms |
3920 KB |
Output is correct |
9 |
Correct |
2 ms |
3920 KB |
Output is correct |
10 |
Correct |
3 ms |
3920 KB |
Output is correct |
11 |
Correct |
3 ms |
4048 KB |
Output is correct |
12 |
Correct |
2 ms |
4024 KB |
Output is correct |
13 |
Correct |
3 ms |
4048 KB |
Output is correct |
14 |
Correct |
3 ms |
4432 KB |
Output is correct |
15 |
Correct |
3 ms |
4308 KB |
Output is correct |
16 |
Correct |
3 ms |
4096 KB |
Output is correct |
17 |
Correct |
5 ms |
4432 KB |
Output is correct |
18 |
Correct |
5 ms |
4320 KB |
Output is correct |
19 |
Correct |
3 ms |
4304 KB |
Output is correct |
20 |
Correct |
5 ms |
4708 KB |
Output is correct |
21 |
Correct |
6 ms |
5476 KB |
Output is correct |
22 |
Correct |
30 ms |
13396 KB |
Output is correct |
23 |
Correct |
5 ms |
5072 KB |
Output is correct |
24 |
Correct |
154 ms |
45472 KB |
Output is correct |
25 |
Correct |
271 ms |
34400 KB |
Output is correct |
26 |
Correct |
122 ms |
15104 KB |
Output is correct |
27 |
Correct |
543 ms |
59404 KB |
Output is correct |
28 |
Correct |
170 ms |
31212 KB |
Output is correct |
29 |
Correct |
392 ms |
57512 KB |
Output is correct |
30 |
Correct |
938 ms |
209504 KB |
Output is correct |
31 |
Runtime error |
506 ms |
262144 KB |
Execution killed with signal 9 |
32 |
Halted |
0 ms |
0 KB |
- |