# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
1113555 |
2024-11-16T17:52:51 Z |
_8_8_ |
게임 (APIO22_game) |
C++17 |
|
4000 ms |
19096 KB |
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 12;
int n, k, s[N], t[N];
vector<int> g[N], gr[N];
void init(int nn, int kk) {
n = nn;
k = kk;
for(int i = k; i < n; i++) {
s[i] = -1, t[i] = k;
}
for(int i = 0; i < k; ++i) {
s[i] = t[i] = i;
}
}
int vis[N], timer;
void dfs(int v, int val) {
vis[v] = timer;
s[v] = max(s[v], val);
for(int to:g[v]) if(vis[to] != timer && s[to] < val) {
dfs(to, val);
}
}
void dfs1(int v, int val) {
t[v] = min(t[v], val);
for(int to:gr[v]) if(vis[to] != timer && t[to] > val) {
dfs1(to, val);
}
}
bool cyc = 0;
int add_teleporter(int u, int v) {
if(max(u, v) < k) {
if(u >= v) cyc = 1;
}
if(cyc) return 1;
g[u].push_back(v);
gr[v].push_back(u);
timer++;
dfs(v, s[u]);
timer++;
dfs1(u, t[v]);
vis[v] = timer;
for(int i = k; i < n; i++) {
if(s[i] >= t[i]) {
cyc = 1;
return 1;
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
14416 KB |
Output is correct |
2 |
Correct |
11 ms |
14416 KB |
Output is correct |
3 |
Correct |
11 ms |
14396 KB |
Output is correct |
4 |
Correct |
10 ms |
14416 KB |
Output is correct |
5 |
Correct |
11 ms |
14344 KB |
Output is correct |
6 |
Correct |
11 ms |
14416 KB |
Output is correct |
7 |
Correct |
11 ms |
14416 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
14416 KB |
Output is correct |
2 |
Correct |
11 ms |
14416 KB |
Output is correct |
3 |
Correct |
11 ms |
14396 KB |
Output is correct |
4 |
Correct |
10 ms |
14416 KB |
Output is correct |
5 |
Correct |
11 ms |
14344 KB |
Output is correct |
6 |
Correct |
11 ms |
14416 KB |
Output is correct |
7 |
Correct |
11 ms |
14416 KB |
Output is correct |
8 |
Correct |
11 ms |
14416 KB |
Output is correct |
9 |
Correct |
11 ms |
14416 KB |
Output is correct |
10 |
Correct |
12 ms |
14416 KB |
Output is correct |
11 |
Correct |
14 ms |
14364 KB |
Output is correct |
12 |
Correct |
10 ms |
14416 KB |
Output is correct |
13 |
Correct |
10 ms |
14416 KB |
Output is correct |
14 |
Correct |
11 ms |
14492 KB |
Output is correct |
15 |
Correct |
12 ms |
14416 KB |
Output is correct |
16 |
Correct |
12 ms |
14416 KB |
Output is correct |
17 |
Correct |
11 ms |
14416 KB |
Output is correct |
18 |
Correct |
10 ms |
14416 KB |
Output is correct |
19 |
Correct |
11 ms |
14416 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
14416 KB |
Output is correct |
2 |
Correct |
11 ms |
14416 KB |
Output is correct |
3 |
Correct |
11 ms |
14396 KB |
Output is correct |
4 |
Correct |
10 ms |
14416 KB |
Output is correct |
5 |
Correct |
11 ms |
14344 KB |
Output is correct |
6 |
Correct |
11 ms |
14416 KB |
Output is correct |
7 |
Correct |
11 ms |
14416 KB |
Output is correct |
8 |
Correct |
11 ms |
14416 KB |
Output is correct |
9 |
Correct |
11 ms |
14416 KB |
Output is correct |
10 |
Correct |
12 ms |
14416 KB |
Output is correct |
11 |
Correct |
14 ms |
14364 KB |
Output is correct |
12 |
Correct |
10 ms |
14416 KB |
Output is correct |
13 |
Correct |
10 ms |
14416 KB |
Output is correct |
14 |
Correct |
11 ms |
14492 KB |
Output is correct |
15 |
Correct |
12 ms |
14416 KB |
Output is correct |
16 |
Correct |
12 ms |
14416 KB |
Output is correct |
17 |
Correct |
11 ms |
14416 KB |
Output is correct |
18 |
Correct |
10 ms |
14416 KB |
Output is correct |
19 |
Correct |
11 ms |
14416 KB |
Output is correct |
20 |
Correct |
13 ms |
14416 KB |
Output is correct |
21 |
Correct |
11 ms |
14416 KB |
Output is correct |
22 |
Correct |
13 ms |
14484 KB |
Output is correct |
23 |
Correct |
13 ms |
14416 KB |
Output is correct |
24 |
Correct |
15 ms |
14416 KB |
Output is correct |
25 |
Correct |
15 ms |
14416 KB |
Output is correct |
26 |
Correct |
16 ms |
14416 KB |
Output is correct |
27 |
Correct |
20 ms |
14416 KB |
Output is correct |
28 |
Correct |
14 ms |
14416 KB |
Output is correct |
29 |
Correct |
16 ms |
14416 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
14416 KB |
Output is correct |
2 |
Correct |
11 ms |
14416 KB |
Output is correct |
3 |
Correct |
11 ms |
14396 KB |
Output is correct |
4 |
Correct |
10 ms |
14416 KB |
Output is correct |
5 |
Correct |
11 ms |
14344 KB |
Output is correct |
6 |
Correct |
11 ms |
14416 KB |
Output is correct |
7 |
Correct |
11 ms |
14416 KB |
Output is correct |
8 |
Correct |
11 ms |
14416 KB |
Output is correct |
9 |
Correct |
11 ms |
14416 KB |
Output is correct |
10 |
Correct |
12 ms |
14416 KB |
Output is correct |
11 |
Correct |
14 ms |
14364 KB |
Output is correct |
12 |
Correct |
10 ms |
14416 KB |
Output is correct |
13 |
Correct |
10 ms |
14416 KB |
Output is correct |
14 |
Correct |
11 ms |
14492 KB |
Output is correct |
15 |
Correct |
12 ms |
14416 KB |
Output is correct |
16 |
Correct |
12 ms |
14416 KB |
Output is correct |
17 |
Correct |
11 ms |
14416 KB |
Output is correct |
18 |
Correct |
10 ms |
14416 KB |
Output is correct |
19 |
Correct |
11 ms |
14416 KB |
Output is correct |
20 |
Correct |
13 ms |
14416 KB |
Output is correct |
21 |
Correct |
11 ms |
14416 KB |
Output is correct |
22 |
Correct |
13 ms |
14484 KB |
Output is correct |
23 |
Correct |
13 ms |
14416 KB |
Output is correct |
24 |
Correct |
15 ms |
14416 KB |
Output is correct |
25 |
Correct |
15 ms |
14416 KB |
Output is correct |
26 |
Correct |
16 ms |
14416 KB |
Output is correct |
27 |
Correct |
20 ms |
14416 KB |
Output is correct |
28 |
Correct |
14 ms |
14416 KB |
Output is correct |
29 |
Correct |
16 ms |
14416 KB |
Output is correct |
30 |
Correct |
646 ms |
16024 KB |
Output is correct |
31 |
Correct |
163 ms |
15176 KB |
Output is correct |
32 |
Correct |
763 ms |
17296 KB |
Output is correct |
33 |
Correct |
741 ms |
16612 KB |
Output is correct |
34 |
Correct |
1761 ms |
18072 KB |
Output is correct |
35 |
Correct |
1384 ms |
17268 KB |
Output is correct |
36 |
Correct |
1158 ms |
16552 KB |
Output is correct |
37 |
Correct |
916 ms |
16712 KB |
Output is correct |
38 |
Correct |
955 ms |
16456 KB |
Output is correct |
39 |
Correct |
977 ms |
16456 KB |
Output is correct |
40 |
Correct |
2005 ms |
18404 KB |
Output is correct |
41 |
Correct |
1175 ms |
16968 KB |
Output is correct |
42 |
Correct |
1114 ms |
16864 KB |
Output is correct |
43 |
Correct |
1149 ms |
18068 KB |
Output is correct |
44 |
Correct |
1923 ms |
18256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
14416 KB |
Output is correct |
2 |
Correct |
11 ms |
14416 KB |
Output is correct |
3 |
Correct |
11 ms |
14396 KB |
Output is correct |
4 |
Correct |
10 ms |
14416 KB |
Output is correct |
5 |
Correct |
11 ms |
14344 KB |
Output is correct |
6 |
Correct |
11 ms |
14416 KB |
Output is correct |
7 |
Correct |
11 ms |
14416 KB |
Output is correct |
8 |
Correct |
11 ms |
14416 KB |
Output is correct |
9 |
Correct |
11 ms |
14416 KB |
Output is correct |
10 |
Correct |
12 ms |
14416 KB |
Output is correct |
11 |
Correct |
14 ms |
14364 KB |
Output is correct |
12 |
Correct |
10 ms |
14416 KB |
Output is correct |
13 |
Correct |
10 ms |
14416 KB |
Output is correct |
14 |
Correct |
11 ms |
14492 KB |
Output is correct |
15 |
Correct |
12 ms |
14416 KB |
Output is correct |
16 |
Correct |
12 ms |
14416 KB |
Output is correct |
17 |
Correct |
11 ms |
14416 KB |
Output is correct |
18 |
Correct |
10 ms |
14416 KB |
Output is correct |
19 |
Correct |
11 ms |
14416 KB |
Output is correct |
20 |
Correct |
13 ms |
14416 KB |
Output is correct |
21 |
Correct |
11 ms |
14416 KB |
Output is correct |
22 |
Correct |
13 ms |
14484 KB |
Output is correct |
23 |
Correct |
13 ms |
14416 KB |
Output is correct |
24 |
Correct |
15 ms |
14416 KB |
Output is correct |
25 |
Correct |
15 ms |
14416 KB |
Output is correct |
26 |
Correct |
16 ms |
14416 KB |
Output is correct |
27 |
Correct |
20 ms |
14416 KB |
Output is correct |
28 |
Correct |
14 ms |
14416 KB |
Output is correct |
29 |
Correct |
16 ms |
14416 KB |
Output is correct |
30 |
Correct |
646 ms |
16024 KB |
Output is correct |
31 |
Correct |
163 ms |
15176 KB |
Output is correct |
32 |
Correct |
763 ms |
17296 KB |
Output is correct |
33 |
Correct |
741 ms |
16612 KB |
Output is correct |
34 |
Correct |
1761 ms |
18072 KB |
Output is correct |
35 |
Correct |
1384 ms |
17268 KB |
Output is correct |
36 |
Correct |
1158 ms |
16552 KB |
Output is correct |
37 |
Correct |
916 ms |
16712 KB |
Output is correct |
38 |
Correct |
955 ms |
16456 KB |
Output is correct |
39 |
Correct |
977 ms |
16456 KB |
Output is correct |
40 |
Correct |
2005 ms |
18404 KB |
Output is correct |
41 |
Correct |
1175 ms |
16968 KB |
Output is correct |
42 |
Correct |
1114 ms |
16864 KB |
Output is correct |
43 |
Correct |
1149 ms |
18068 KB |
Output is correct |
44 |
Correct |
1923 ms |
18256 KB |
Output is correct |
45 |
Execution timed out |
4098 ms |
19096 KB |
Time limit exceeded |
46 |
Halted |
0 ms |
0 KB |
- |