# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
816409 |
2023-08-09T05:01:01 Z |
이동현(#10127) |
게임 (APIO22_game) |
C++17 |
|
4000 ms |
3968 KB |
#include "game.h"
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
int n, k;
int chk[30004];
vector<int> way[30004], wayb[30004];
int que[30004], f, r;
int chkn;
void init(int N, int K) {
n = N, k = K;
assert(n <= 30000 && k <= 1000);
}
int add_teleporter(int u, int v) {
way[u].push_back(v);
wayb[v].push_back(u);
int mn = (int)1e9, mx = -1;
f = r = 0;
++chkn;
que[r++] = v, chk[v] = chkn;
while(f < r){
int now = que[f++];
if(now < k) mn = min(mn, now);
for(auto&nxt:way[now]){
if(chkn != chk[nxt]){
chk[nxt] = chkn;
que[r++] = nxt;
}
}
}
++chkn;
f = r = 0;
que[r++] = u, chk[u] = chkn;
while(f < r){
int now = que[f++];
if(now < k) mx = max(mx, now);
for(auto&nxt:wayb[now]){
if(chkn != chk[nxt]){
chk[nxt] = chkn;
que[r++] = nxt;
}
}
}
return mn <= mx;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1616 KB |
Output is correct |
2 |
Correct |
1 ms |
1616 KB |
Output is correct |
3 |
Correct |
1 ms |
1616 KB |
Output is correct |
4 |
Correct |
1 ms |
1616 KB |
Output is correct |
5 |
Correct |
1 ms |
1616 KB |
Output is correct |
6 |
Correct |
2 ms |
1616 KB |
Output is correct |
7 |
Correct |
1 ms |
1616 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1616 KB |
Output is correct |
2 |
Correct |
1 ms |
1616 KB |
Output is correct |
3 |
Correct |
1 ms |
1616 KB |
Output is correct |
4 |
Correct |
1 ms |
1616 KB |
Output is correct |
5 |
Correct |
1 ms |
1616 KB |
Output is correct |
6 |
Correct |
2 ms |
1616 KB |
Output is correct |
7 |
Correct |
1 ms |
1616 KB |
Output is correct |
8 |
Correct |
1 ms |
1620 KB |
Output is correct |
9 |
Correct |
1 ms |
1616 KB |
Output is correct |
10 |
Correct |
1 ms |
1616 KB |
Output is correct |
11 |
Correct |
1 ms |
1616 KB |
Output is correct |
12 |
Correct |
2 ms |
1616 KB |
Output is correct |
13 |
Correct |
1 ms |
1616 KB |
Output is correct |
14 |
Correct |
1 ms |
1616 KB |
Output is correct |
15 |
Correct |
2 ms |
1616 KB |
Output is correct |
16 |
Correct |
1 ms |
1616 KB |
Output is correct |
17 |
Correct |
1 ms |
1616 KB |
Output is correct |
18 |
Correct |
1 ms |
1616 KB |
Output is correct |
19 |
Correct |
2 ms |
1616 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1616 KB |
Output is correct |
2 |
Correct |
1 ms |
1616 KB |
Output is correct |
3 |
Correct |
1 ms |
1616 KB |
Output is correct |
4 |
Correct |
1 ms |
1616 KB |
Output is correct |
5 |
Correct |
1 ms |
1616 KB |
Output is correct |
6 |
Correct |
2 ms |
1616 KB |
Output is correct |
7 |
Correct |
1 ms |
1616 KB |
Output is correct |
8 |
Correct |
1 ms |
1620 KB |
Output is correct |
9 |
Correct |
1 ms |
1616 KB |
Output is correct |
10 |
Correct |
1 ms |
1616 KB |
Output is correct |
11 |
Correct |
1 ms |
1616 KB |
Output is correct |
12 |
Correct |
2 ms |
1616 KB |
Output is correct |
13 |
Correct |
1 ms |
1616 KB |
Output is correct |
14 |
Correct |
1 ms |
1616 KB |
Output is correct |
15 |
Correct |
2 ms |
1616 KB |
Output is correct |
16 |
Correct |
1 ms |
1616 KB |
Output is correct |
17 |
Correct |
1 ms |
1616 KB |
Output is correct |
18 |
Correct |
1 ms |
1616 KB |
Output is correct |
19 |
Correct |
2 ms |
1616 KB |
Output is correct |
20 |
Correct |
1 ms |
1744 KB |
Output is correct |
21 |
Correct |
1 ms |
1616 KB |
Output is correct |
22 |
Correct |
1 ms |
1744 KB |
Output is correct |
23 |
Correct |
2 ms |
1744 KB |
Output is correct |
24 |
Correct |
4 ms |
1744 KB |
Output is correct |
25 |
Correct |
11 ms |
1744 KB |
Output is correct |
26 |
Correct |
29 ms |
1808 KB |
Output is correct |
27 |
Correct |
5 ms |
1744 KB |
Output is correct |
28 |
Correct |
2 ms |
1744 KB |
Output is correct |
29 |
Correct |
4 ms |
1744 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1616 KB |
Output is correct |
2 |
Correct |
1 ms |
1616 KB |
Output is correct |
3 |
Correct |
1 ms |
1616 KB |
Output is correct |
4 |
Correct |
1 ms |
1616 KB |
Output is correct |
5 |
Correct |
1 ms |
1616 KB |
Output is correct |
6 |
Correct |
2 ms |
1616 KB |
Output is correct |
7 |
Correct |
1 ms |
1616 KB |
Output is correct |
8 |
Correct |
1 ms |
1620 KB |
Output is correct |
9 |
Correct |
1 ms |
1616 KB |
Output is correct |
10 |
Correct |
1 ms |
1616 KB |
Output is correct |
11 |
Correct |
1 ms |
1616 KB |
Output is correct |
12 |
Correct |
2 ms |
1616 KB |
Output is correct |
13 |
Correct |
1 ms |
1616 KB |
Output is correct |
14 |
Correct |
1 ms |
1616 KB |
Output is correct |
15 |
Correct |
2 ms |
1616 KB |
Output is correct |
16 |
Correct |
1 ms |
1616 KB |
Output is correct |
17 |
Correct |
1 ms |
1616 KB |
Output is correct |
18 |
Correct |
1 ms |
1616 KB |
Output is correct |
19 |
Correct |
2 ms |
1616 KB |
Output is correct |
20 |
Correct |
1 ms |
1744 KB |
Output is correct |
21 |
Correct |
1 ms |
1616 KB |
Output is correct |
22 |
Correct |
1 ms |
1744 KB |
Output is correct |
23 |
Correct |
2 ms |
1744 KB |
Output is correct |
24 |
Correct |
4 ms |
1744 KB |
Output is correct |
25 |
Correct |
11 ms |
1744 KB |
Output is correct |
26 |
Correct |
29 ms |
1808 KB |
Output is correct |
27 |
Correct |
5 ms |
1744 KB |
Output is correct |
28 |
Correct |
2 ms |
1744 KB |
Output is correct |
29 |
Correct |
4 ms |
1744 KB |
Output is correct |
30 |
Correct |
15 ms |
2900 KB |
Output is correct |
31 |
Correct |
4 ms |
2200 KB |
Output is correct |
32 |
Correct |
30 ms |
3668 KB |
Output is correct |
33 |
Correct |
35 ms |
3620 KB |
Output is correct |
34 |
Correct |
932 ms |
3864 KB |
Output is correct |
35 |
Correct |
789 ms |
3888 KB |
Output is correct |
36 |
Correct |
883 ms |
3780 KB |
Output is correct |
37 |
Correct |
469 ms |
3756 KB |
Output is correct |
38 |
Correct |
409 ms |
3520 KB |
Output is correct |
39 |
Correct |
456 ms |
3532 KB |
Output is correct |
40 |
Correct |
801 ms |
3968 KB |
Output is correct |
41 |
Correct |
403 ms |
3568 KB |
Output is correct |
42 |
Correct |
226 ms |
3472 KB |
Output is correct |
43 |
Execution timed out |
4037 ms |
3904 KB |
Time limit exceeded |
44 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1616 KB |
Output is correct |
2 |
Correct |
1 ms |
1616 KB |
Output is correct |
3 |
Correct |
1 ms |
1616 KB |
Output is correct |
4 |
Correct |
1 ms |
1616 KB |
Output is correct |
5 |
Correct |
1 ms |
1616 KB |
Output is correct |
6 |
Correct |
2 ms |
1616 KB |
Output is correct |
7 |
Correct |
1 ms |
1616 KB |
Output is correct |
8 |
Correct |
1 ms |
1620 KB |
Output is correct |
9 |
Correct |
1 ms |
1616 KB |
Output is correct |
10 |
Correct |
1 ms |
1616 KB |
Output is correct |
11 |
Correct |
1 ms |
1616 KB |
Output is correct |
12 |
Correct |
2 ms |
1616 KB |
Output is correct |
13 |
Correct |
1 ms |
1616 KB |
Output is correct |
14 |
Correct |
1 ms |
1616 KB |
Output is correct |
15 |
Correct |
2 ms |
1616 KB |
Output is correct |
16 |
Correct |
1 ms |
1616 KB |
Output is correct |
17 |
Correct |
1 ms |
1616 KB |
Output is correct |
18 |
Correct |
1 ms |
1616 KB |
Output is correct |
19 |
Correct |
2 ms |
1616 KB |
Output is correct |
20 |
Correct |
1 ms |
1744 KB |
Output is correct |
21 |
Correct |
1 ms |
1616 KB |
Output is correct |
22 |
Correct |
1 ms |
1744 KB |
Output is correct |
23 |
Correct |
2 ms |
1744 KB |
Output is correct |
24 |
Correct |
4 ms |
1744 KB |
Output is correct |
25 |
Correct |
11 ms |
1744 KB |
Output is correct |
26 |
Correct |
29 ms |
1808 KB |
Output is correct |
27 |
Correct |
5 ms |
1744 KB |
Output is correct |
28 |
Correct |
2 ms |
1744 KB |
Output is correct |
29 |
Correct |
4 ms |
1744 KB |
Output is correct |
30 |
Correct |
15 ms |
2900 KB |
Output is correct |
31 |
Correct |
4 ms |
2200 KB |
Output is correct |
32 |
Correct |
30 ms |
3668 KB |
Output is correct |
33 |
Correct |
35 ms |
3620 KB |
Output is correct |
34 |
Correct |
932 ms |
3864 KB |
Output is correct |
35 |
Correct |
789 ms |
3888 KB |
Output is correct |
36 |
Correct |
883 ms |
3780 KB |
Output is correct |
37 |
Correct |
469 ms |
3756 KB |
Output is correct |
38 |
Correct |
409 ms |
3520 KB |
Output is correct |
39 |
Correct |
456 ms |
3532 KB |
Output is correct |
40 |
Correct |
801 ms |
3968 KB |
Output is correct |
41 |
Correct |
403 ms |
3568 KB |
Output is correct |
42 |
Correct |
226 ms |
3472 KB |
Output is correct |
43 |
Execution timed out |
4037 ms |
3904 KB |
Time limit exceeded |
44 |
Halted |
0 ms |
0 KB |
- |