#include "game.h"
#include <iostream>
#include <vector>
#include <set>
#include <queue>
using namespace std;
vector<vector<vector<int>>> G(101,vector<vector<int>>(30010));
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 |
75280 KB |
Output is correct |
2 |
Correct |
40 ms |
75168 KB |
Output is correct |
3 |
Correct |
52 ms |
75656 KB |
Output is correct |
4 |
Correct |
48 ms |
75272 KB |
Output is correct |
5 |
Correct |
43 ms |
75492 KB |
Output is correct |
6 |
Correct |
43 ms |
75460 KB |
Output is correct |
7 |
Correct |
43 ms |
75464 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
40 ms |
75280 KB |
Output is correct |
2 |
Correct |
40 ms |
75168 KB |
Output is correct |
3 |
Correct |
52 ms |
75656 KB |
Output is correct |
4 |
Correct |
48 ms |
75272 KB |
Output is correct |
5 |
Correct |
43 ms |
75492 KB |
Output is correct |
6 |
Correct |
43 ms |
75460 KB |
Output is correct |
7 |
Correct |
43 ms |
75464 KB |
Output is correct |
8 |
Correct |
41 ms |
75144 KB |
Output is correct |
9 |
Correct |
40 ms |
75212 KB |
Output is correct |
10 |
Correct |
43 ms |
75176 KB |
Output is correct |
11 |
Correct |
44 ms |
75288 KB |
Output is correct |
12 |
Correct |
45 ms |
75172 KB |
Output is correct |
13 |
Correct |
47 ms |
75220 KB |
Output is correct |
14 |
Correct |
48 ms |
75256 KB |
Output is correct |
15 |
Correct |
43 ms |
75276 KB |
Output is correct |
16 |
Correct |
43 ms |
75280 KB |
Output is correct |
17 |
Correct |
44 ms |
75400 KB |
Output is correct |
18 |
Correct |
48 ms |
75328 KB |
Output is correct |
19 |
Correct |
50 ms |
75332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
40 ms |
75280 KB |
Output is correct |
2 |
Correct |
40 ms |
75168 KB |
Output is correct |
3 |
Correct |
52 ms |
75656 KB |
Output is correct |
4 |
Correct |
48 ms |
75272 KB |
Output is correct |
5 |
Correct |
43 ms |
75492 KB |
Output is correct |
6 |
Correct |
43 ms |
75460 KB |
Output is correct |
7 |
Correct |
43 ms |
75464 KB |
Output is correct |
8 |
Correct |
41 ms |
75144 KB |
Output is correct |
9 |
Correct |
40 ms |
75212 KB |
Output is correct |
10 |
Correct |
43 ms |
75176 KB |
Output is correct |
11 |
Correct |
44 ms |
75288 KB |
Output is correct |
12 |
Correct |
45 ms |
75172 KB |
Output is correct |
13 |
Correct |
47 ms |
75220 KB |
Output is correct |
14 |
Correct |
48 ms |
75256 KB |
Output is correct |
15 |
Correct |
43 ms |
75276 KB |
Output is correct |
16 |
Correct |
43 ms |
75280 KB |
Output is correct |
17 |
Correct |
44 ms |
75400 KB |
Output is correct |
18 |
Correct |
48 ms |
75328 KB |
Output is correct |
19 |
Correct |
50 ms |
75332 KB |
Output is correct |
20 |
Correct |
44 ms |
75448 KB |
Output is correct |
21 |
Correct |
45 ms |
75652 KB |
Output is correct |
22 |
Correct |
64 ms |
77896 KB |
Output is correct |
23 |
Correct |
44 ms |
75560 KB |
Output is correct |
24 |
Runtime error |
96 ms |
152436 KB |
Execution killed with signal 11 |
25 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
40 ms |
75280 KB |
Output is correct |
2 |
Correct |
40 ms |
75168 KB |
Output is correct |
3 |
Correct |
52 ms |
75656 KB |
Output is correct |
4 |
Correct |
48 ms |
75272 KB |
Output is correct |
5 |
Correct |
43 ms |
75492 KB |
Output is correct |
6 |
Correct |
43 ms |
75460 KB |
Output is correct |
7 |
Correct |
43 ms |
75464 KB |
Output is correct |
8 |
Correct |
41 ms |
75144 KB |
Output is correct |
9 |
Correct |
40 ms |
75212 KB |
Output is correct |
10 |
Correct |
43 ms |
75176 KB |
Output is correct |
11 |
Correct |
44 ms |
75288 KB |
Output is correct |
12 |
Correct |
45 ms |
75172 KB |
Output is correct |
13 |
Correct |
47 ms |
75220 KB |
Output is correct |
14 |
Correct |
48 ms |
75256 KB |
Output is correct |
15 |
Correct |
43 ms |
75276 KB |
Output is correct |
16 |
Correct |
43 ms |
75280 KB |
Output is correct |
17 |
Correct |
44 ms |
75400 KB |
Output is correct |
18 |
Correct |
48 ms |
75328 KB |
Output is correct |
19 |
Correct |
50 ms |
75332 KB |
Output is correct |
20 |
Correct |
44 ms |
75448 KB |
Output is correct |
21 |
Correct |
45 ms |
75652 KB |
Output is correct |
22 |
Correct |
64 ms |
77896 KB |
Output is correct |
23 |
Correct |
44 ms |
75560 KB |
Output is correct |
24 |
Runtime error |
96 ms |
152436 KB |
Execution killed with signal 11 |
25 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
40 ms |
75280 KB |
Output is correct |
2 |
Correct |
40 ms |
75168 KB |
Output is correct |
3 |
Correct |
52 ms |
75656 KB |
Output is correct |
4 |
Correct |
48 ms |
75272 KB |
Output is correct |
5 |
Correct |
43 ms |
75492 KB |
Output is correct |
6 |
Correct |
43 ms |
75460 KB |
Output is correct |
7 |
Correct |
43 ms |
75464 KB |
Output is correct |
8 |
Correct |
41 ms |
75144 KB |
Output is correct |
9 |
Correct |
40 ms |
75212 KB |
Output is correct |
10 |
Correct |
43 ms |
75176 KB |
Output is correct |
11 |
Correct |
44 ms |
75288 KB |
Output is correct |
12 |
Correct |
45 ms |
75172 KB |
Output is correct |
13 |
Correct |
47 ms |
75220 KB |
Output is correct |
14 |
Correct |
48 ms |
75256 KB |
Output is correct |
15 |
Correct |
43 ms |
75276 KB |
Output is correct |
16 |
Correct |
43 ms |
75280 KB |
Output is correct |
17 |
Correct |
44 ms |
75400 KB |
Output is correct |
18 |
Correct |
48 ms |
75328 KB |
Output is correct |
19 |
Correct |
50 ms |
75332 KB |
Output is correct |
20 |
Correct |
44 ms |
75448 KB |
Output is correct |
21 |
Correct |
45 ms |
75652 KB |
Output is correct |
22 |
Correct |
64 ms |
77896 KB |
Output is correct |
23 |
Correct |
44 ms |
75560 KB |
Output is correct |
24 |
Runtime error |
96 ms |
152436 KB |
Execution killed with signal 11 |
25 |
Halted |
0 ms |
0 KB |
- |