# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
1113556 |
2024-11-16T17:57:05 Z |
_8_8_ |
게임 (APIO22_game) |
C++17 |
|
4000 ms |
18796 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);
for(int i = k; i < n; i++) {
if(s[i] >= t[v]) {
s[i] = max(s[i], s[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 |
10 ms |
14416 KB |
Output is correct |
2 |
Correct |
10 ms |
14416 KB |
Output is correct |
3 |
Correct |
11 ms |
14416 KB |
Output is correct |
4 |
Correct |
11 ms |
14416 KB |
Output is correct |
5 |
Correct |
11 ms |
14416 KB |
Output is correct |
6 |
Correct |
11 ms |
14416 KB |
Output is correct |
7 |
Correct |
12 ms |
14476 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
14416 KB |
Output is correct |
2 |
Correct |
10 ms |
14416 KB |
Output is correct |
3 |
Correct |
11 ms |
14416 KB |
Output is correct |
4 |
Correct |
11 ms |
14416 KB |
Output is correct |
5 |
Correct |
11 ms |
14416 KB |
Output is correct |
6 |
Correct |
11 ms |
14416 KB |
Output is correct |
7 |
Correct |
12 ms |
14476 KB |
Output is correct |
8 |
Correct |
11 ms |
14416 KB |
Output is correct |
9 |
Correct |
10 ms |
14416 KB |
Output is correct |
10 |
Correct |
10 ms |
14416 KB |
Output is correct |
11 |
Correct |
10 ms |
14416 KB |
Output is correct |
12 |
Correct |
10 ms |
14584 KB |
Output is correct |
13 |
Correct |
10 ms |
14416 KB |
Output is correct |
14 |
Correct |
9 ms |
14416 KB |
Output is correct |
15 |
Correct |
10 ms |
14416 KB |
Output is correct |
16 |
Correct |
12 ms |
14428 KB |
Output is correct |
17 |
Correct |
12 ms |
14416 KB |
Output is correct |
18 |
Correct |
11 ms |
14416 KB |
Output is correct |
19 |
Correct |
10 ms |
14416 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
14416 KB |
Output is correct |
2 |
Correct |
10 ms |
14416 KB |
Output is correct |
3 |
Correct |
11 ms |
14416 KB |
Output is correct |
4 |
Correct |
11 ms |
14416 KB |
Output is correct |
5 |
Correct |
11 ms |
14416 KB |
Output is correct |
6 |
Correct |
11 ms |
14416 KB |
Output is correct |
7 |
Correct |
12 ms |
14476 KB |
Output is correct |
8 |
Correct |
11 ms |
14416 KB |
Output is correct |
9 |
Correct |
10 ms |
14416 KB |
Output is correct |
10 |
Correct |
10 ms |
14416 KB |
Output is correct |
11 |
Correct |
10 ms |
14416 KB |
Output is correct |
12 |
Correct |
10 ms |
14584 KB |
Output is correct |
13 |
Correct |
10 ms |
14416 KB |
Output is correct |
14 |
Correct |
9 ms |
14416 KB |
Output is correct |
15 |
Correct |
10 ms |
14416 KB |
Output is correct |
16 |
Correct |
12 ms |
14428 KB |
Output is correct |
17 |
Correct |
12 ms |
14416 KB |
Output is correct |
18 |
Correct |
11 ms |
14416 KB |
Output is correct |
19 |
Correct |
10 ms |
14416 KB |
Output is correct |
20 |
Correct |
12 ms |
14416 KB |
Output is correct |
21 |
Correct |
10 ms |
14416 KB |
Output is correct |
22 |
Correct |
14 ms |
14416 KB |
Output is correct |
23 |
Correct |
12 ms |
14416 KB |
Output is correct |
24 |
Correct |
14 ms |
14416 KB |
Output is correct |
25 |
Correct |
17 ms |
14564 KB |
Output is correct |
26 |
Correct |
17 ms |
14416 KB |
Output is correct |
27 |
Correct |
16 ms |
14416 KB |
Output is correct |
28 |
Correct |
12 ms |
14416 KB |
Output is correct |
29 |
Correct |
15 ms |
14416 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
14416 KB |
Output is correct |
2 |
Correct |
10 ms |
14416 KB |
Output is correct |
3 |
Correct |
11 ms |
14416 KB |
Output is correct |
4 |
Correct |
11 ms |
14416 KB |
Output is correct |
5 |
Correct |
11 ms |
14416 KB |
Output is correct |
6 |
Correct |
11 ms |
14416 KB |
Output is correct |
7 |
Correct |
12 ms |
14476 KB |
Output is correct |
8 |
Correct |
11 ms |
14416 KB |
Output is correct |
9 |
Correct |
10 ms |
14416 KB |
Output is correct |
10 |
Correct |
10 ms |
14416 KB |
Output is correct |
11 |
Correct |
10 ms |
14416 KB |
Output is correct |
12 |
Correct |
10 ms |
14584 KB |
Output is correct |
13 |
Correct |
10 ms |
14416 KB |
Output is correct |
14 |
Correct |
9 ms |
14416 KB |
Output is correct |
15 |
Correct |
10 ms |
14416 KB |
Output is correct |
16 |
Correct |
12 ms |
14428 KB |
Output is correct |
17 |
Correct |
12 ms |
14416 KB |
Output is correct |
18 |
Correct |
11 ms |
14416 KB |
Output is correct |
19 |
Correct |
10 ms |
14416 KB |
Output is correct |
20 |
Correct |
12 ms |
14416 KB |
Output is correct |
21 |
Correct |
10 ms |
14416 KB |
Output is correct |
22 |
Correct |
14 ms |
14416 KB |
Output is correct |
23 |
Correct |
12 ms |
14416 KB |
Output is correct |
24 |
Correct |
14 ms |
14416 KB |
Output is correct |
25 |
Correct |
17 ms |
14564 KB |
Output is correct |
26 |
Correct |
17 ms |
14416 KB |
Output is correct |
27 |
Correct |
16 ms |
14416 KB |
Output is correct |
28 |
Correct |
12 ms |
14416 KB |
Output is correct |
29 |
Correct |
15 ms |
14416 KB |
Output is correct |
30 |
Correct |
1116 ms |
15980 KB |
Output is correct |
31 |
Correct |
261 ms |
15064 KB |
Output is correct |
32 |
Correct |
1075 ms |
17568 KB |
Output is correct |
33 |
Correct |
1079 ms |
16720 KB |
Output is correct |
34 |
Correct |
2183 ms |
18064 KB |
Output is correct |
35 |
Correct |
2168 ms |
17152 KB |
Output is correct |
36 |
Correct |
1768 ms |
16656 KB |
Output is correct |
37 |
Correct |
1475 ms |
16740 KB |
Output is correct |
38 |
Correct |
1687 ms |
16488 KB |
Output is correct |
39 |
Correct |
1824 ms |
16464 KB |
Output is correct |
40 |
Correct |
2692 ms |
18280 KB |
Output is correct |
41 |
Correct |
2036 ms |
16948 KB |
Output is correct |
42 |
Correct |
1803 ms |
16972 KB |
Output is correct |
43 |
Correct |
2901 ms |
18248 KB |
Output is correct |
44 |
Correct |
2506 ms |
18256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
14416 KB |
Output is correct |
2 |
Correct |
10 ms |
14416 KB |
Output is correct |
3 |
Correct |
11 ms |
14416 KB |
Output is correct |
4 |
Correct |
11 ms |
14416 KB |
Output is correct |
5 |
Correct |
11 ms |
14416 KB |
Output is correct |
6 |
Correct |
11 ms |
14416 KB |
Output is correct |
7 |
Correct |
12 ms |
14476 KB |
Output is correct |
8 |
Correct |
11 ms |
14416 KB |
Output is correct |
9 |
Correct |
10 ms |
14416 KB |
Output is correct |
10 |
Correct |
10 ms |
14416 KB |
Output is correct |
11 |
Correct |
10 ms |
14416 KB |
Output is correct |
12 |
Correct |
10 ms |
14584 KB |
Output is correct |
13 |
Correct |
10 ms |
14416 KB |
Output is correct |
14 |
Correct |
9 ms |
14416 KB |
Output is correct |
15 |
Correct |
10 ms |
14416 KB |
Output is correct |
16 |
Correct |
12 ms |
14428 KB |
Output is correct |
17 |
Correct |
12 ms |
14416 KB |
Output is correct |
18 |
Correct |
11 ms |
14416 KB |
Output is correct |
19 |
Correct |
10 ms |
14416 KB |
Output is correct |
20 |
Correct |
12 ms |
14416 KB |
Output is correct |
21 |
Correct |
10 ms |
14416 KB |
Output is correct |
22 |
Correct |
14 ms |
14416 KB |
Output is correct |
23 |
Correct |
12 ms |
14416 KB |
Output is correct |
24 |
Correct |
14 ms |
14416 KB |
Output is correct |
25 |
Correct |
17 ms |
14564 KB |
Output is correct |
26 |
Correct |
17 ms |
14416 KB |
Output is correct |
27 |
Correct |
16 ms |
14416 KB |
Output is correct |
28 |
Correct |
12 ms |
14416 KB |
Output is correct |
29 |
Correct |
15 ms |
14416 KB |
Output is correct |
30 |
Correct |
1116 ms |
15980 KB |
Output is correct |
31 |
Correct |
261 ms |
15064 KB |
Output is correct |
32 |
Correct |
1075 ms |
17568 KB |
Output is correct |
33 |
Correct |
1079 ms |
16720 KB |
Output is correct |
34 |
Correct |
2183 ms |
18064 KB |
Output is correct |
35 |
Correct |
2168 ms |
17152 KB |
Output is correct |
36 |
Correct |
1768 ms |
16656 KB |
Output is correct |
37 |
Correct |
1475 ms |
16740 KB |
Output is correct |
38 |
Correct |
1687 ms |
16488 KB |
Output is correct |
39 |
Correct |
1824 ms |
16464 KB |
Output is correct |
40 |
Correct |
2692 ms |
18280 KB |
Output is correct |
41 |
Correct |
2036 ms |
16948 KB |
Output is correct |
42 |
Correct |
1803 ms |
16972 KB |
Output is correct |
43 |
Correct |
2901 ms |
18248 KB |
Output is correct |
44 |
Correct |
2506 ms |
18256 KB |
Output is correct |
45 |
Execution timed out |
4011 ms |
18796 KB |
Time limit exceeded |
46 |
Halted |
0 ms |
0 KB |
- |