# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
579810 |
2022-06-19T23:59:55 Z |
peuch |
게임 (APIO22_game) |
C++17 |
|
4000 ms |
24944 KB |
#include "game.h"
#include<bits/stdc++.h>
using namespace std;
int K;
vector<vector<int> > ar;
vector<int> pesado;
bool ans;
void dfs(int cur, int val){
if(pesado[cur] >= val) return;
pesado[cur] = val;
// printf("\tpesado[%d] = %d\n", cur, val);
if(cur < K && pesado[cur] >= cur) ans = true;
for(int i = 0; i < ar[cur].size(); i++){
int viz = ar[cur][i];
dfs(viz, val);
}
}
void init(int n, int k) {
K = k;
pesado = vector<int> (n, -1);
ar = vector<vector<int> > (n, vector<int> (0));
for(int i = 0; i < k; i++)
pesado[i] = i - 1, ar[i].push_back(i + 1);
ar[k - 1].clear();
ans = false;
}
int add_teleporter(int u, int v) {
// printf("%d -> %d\n", u, v);
if(ans) return ans;
ar[u].push_back(v);
if(u < K) dfs(v, max(u, pesado[u]));
else dfs(v, pesado[u]);
return ans;
}
Compilation message
game.cpp: In function 'void dfs(int, int)':
game.cpp:15:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
15 | for(int i = 0; i < ar[cur].size(); i++){
| ~~^~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
208 KB |
Output is correct |
8 |
Correct |
1 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Correct |
1 ms |
208 KB |
Output is correct |
12 |
Correct |
1 ms |
208 KB |
Output is correct |
13 |
Correct |
0 ms |
208 KB |
Output is correct |
14 |
Correct |
1 ms |
208 KB |
Output is correct |
15 |
Correct |
0 ms |
208 KB |
Output is correct |
16 |
Correct |
1 ms |
208 KB |
Output is correct |
17 |
Correct |
1 ms |
208 KB |
Output is correct |
18 |
Correct |
0 ms |
208 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
208 KB |
Output is correct |
8 |
Correct |
1 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Correct |
1 ms |
208 KB |
Output is correct |
12 |
Correct |
1 ms |
208 KB |
Output is correct |
13 |
Correct |
0 ms |
208 KB |
Output is correct |
14 |
Correct |
1 ms |
208 KB |
Output is correct |
15 |
Correct |
0 ms |
208 KB |
Output is correct |
16 |
Correct |
1 ms |
208 KB |
Output is correct |
17 |
Correct |
1 ms |
208 KB |
Output is correct |
18 |
Correct |
0 ms |
208 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
1 ms |
336 KB |
Output is correct |
21 |
Correct |
1 ms |
208 KB |
Output is correct |
22 |
Correct |
1 ms |
336 KB |
Output is correct |
23 |
Correct |
1 ms |
336 KB |
Output is correct |
24 |
Correct |
3 ms |
336 KB |
Output is correct |
25 |
Correct |
3 ms |
336 KB |
Output is correct |
26 |
Correct |
2 ms |
344 KB |
Output is correct |
27 |
Correct |
2 ms |
336 KB |
Output is correct |
28 |
Correct |
2 ms |
352 KB |
Output is correct |
29 |
Correct |
3 ms |
464 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
208 KB |
Output is correct |
8 |
Correct |
1 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Correct |
1 ms |
208 KB |
Output is correct |
12 |
Correct |
1 ms |
208 KB |
Output is correct |
13 |
Correct |
0 ms |
208 KB |
Output is correct |
14 |
Correct |
1 ms |
208 KB |
Output is correct |
15 |
Correct |
0 ms |
208 KB |
Output is correct |
16 |
Correct |
1 ms |
208 KB |
Output is correct |
17 |
Correct |
1 ms |
208 KB |
Output is correct |
18 |
Correct |
0 ms |
208 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
1 ms |
336 KB |
Output is correct |
21 |
Correct |
1 ms |
208 KB |
Output is correct |
22 |
Correct |
1 ms |
336 KB |
Output is correct |
23 |
Correct |
1 ms |
336 KB |
Output is correct |
24 |
Correct |
3 ms |
336 KB |
Output is correct |
25 |
Correct |
3 ms |
336 KB |
Output is correct |
26 |
Correct |
2 ms |
344 KB |
Output is correct |
27 |
Correct |
2 ms |
336 KB |
Output is correct |
28 |
Correct |
2 ms |
352 KB |
Output is correct |
29 |
Correct |
3 ms |
464 KB |
Output is correct |
30 |
Correct |
15 ms |
1660 KB |
Output is correct |
31 |
Correct |
5 ms |
1232 KB |
Output is correct |
32 |
Correct |
19 ms |
2280 KB |
Output is correct |
33 |
Correct |
16 ms |
2000 KB |
Output is correct |
34 |
Correct |
619 ms |
3404 KB |
Output is correct |
35 |
Correct |
208 ms |
2532 KB |
Output is correct |
36 |
Correct |
24 ms |
2060 KB |
Output is correct |
37 |
Correct |
28 ms |
2072 KB |
Output is correct |
38 |
Correct |
25 ms |
1808 KB |
Output is correct |
39 |
Correct |
34 ms |
1756 KB |
Output is correct |
40 |
Correct |
491 ms |
3376 KB |
Output is correct |
41 |
Correct |
101 ms |
2332 KB |
Output is correct |
42 |
Correct |
69 ms |
2124 KB |
Output is correct |
43 |
Correct |
37 ms |
3468 KB |
Output is correct |
44 |
Correct |
347 ms |
3476 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
208 KB |
Output is correct |
8 |
Correct |
1 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Correct |
1 ms |
208 KB |
Output is correct |
12 |
Correct |
1 ms |
208 KB |
Output is correct |
13 |
Correct |
0 ms |
208 KB |
Output is correct |
14 |
Correct |
1 ms |
208 KB |
Output is correct |
15 |
Correct |
0 ms |
208 KB |
Output is correct |
16 |
Correct |
1 ms |
208 KB |
Output is correct |
17 |
Correct |
1 ms |
208 KB |
Output is correct |
18 |
Correct |
0 ms |
208 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
1 ms |
336 KB |
Output is correct |
21 |
Correct |
1 ms |
208 KB |
Output is correct |
22 |
Correct |
1 ms |
336 KB |
Output is correct |
23 |
Correct |
1 ms |
336 KB |
Output is correct |
24 |
Correct |
3 ms |
336 KB |
Output is correct |
25 |
Correct |
3 ms |
336 KB |
Output is correct |
26 |
Correct |
2 ms |
344 KB |
Output is correct |
27 |
Correct |
2 ms |
336 KB |
Output is correct |
28 |
Correct |
2 ms |
352 KB |
Output is correct |
29 |
Correct |
3 ms |
464 KB |
Output is correct |
30 |
Correct |
15 ms |
1660 KB |
Output is correct |
31 |
Correct |
5 ms |
1232 KB |
Output is correct |
32 |
Correct |
19 ms |
2280 KB |
Output is correct |
33 |
Correct |
16 ms |
2000 KB |
Output is correct |
34 |
Correct |
619 ms |
3404 KB |
Output is correct |
35 |
Correct |
208 ms |
2532 KB |
Output is correct |
36 |
Correct |
24 ms |
2060 KB |
Output is correct |
37 |
Correct |
28 ms |
2072 KB |
Output is correct |
38 |
Correct |
25 ms |
1808 KB |
Output is correct |
39 |
Correct |
34 ms |
1756 KB |
Output is correct |
40 |
Correct |
491 ms |
3376 KB |
Output is correct |
41 |
Correct |
101 ms |
2332 KB |
Output is correct |
42 |
Correct |
69 ms |
2124 KB |
Output is correct |
43 |
Correct |
37 ms |
3468 KB |
Output is correct |
44 |
Correct |
347 ms |
3476 KB |
Output is correct |
45 |
Correct |
184 ms |
14220 KB |
Output is correct |
46 |
Correct |
9 ms |
8700 KB |
Output is correct |
47 |
Correct |
14 ms |
8804 KB |
Output is correct |
48 |
Correct |
279 ms |
23936 KB |
Output is correct |
49 |
Correct |
242 ms |
17800 KB |
Output is correct |
50 |
Execution timed out |
4040 ms |
24944 KB |
Time limit exceeded |
51 |
Halted |
0 ms |
0 KB |
- |