# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
972811 |
2024-05-01T08:10:03 Z |
vjudge1 |
Game (APIO22_game) |
C++17 |
|
4000 ms |
40344 KB |
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
#define scd(t) scanf("%d", &t)
#define sclld(t) scanf("%lld", &t)
#define forr(i, j, k) for (int i = j; i < k; i++)
#define frange(i, j) forr(i, 0, j)
#define all(cont) cont.begin(), cont.end()
#define mp make_pair
#define pb push_back
#define f first
#define s second
typedef long long int lli;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<lli> vll;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mpii;
typedef set<int> seti;
typedef multiset<int> mseti;
typedef long double ld;
vvi revg, graph;
int n, k;
vi inv, outv;
void init(int N, int K) {
n = N;
k = K;
graph = revg = vvi(n);
inv = vi(n, -1);
outv = vi(n, k);
frange(i, k) inv[i] = outv[i] = i;
frange(i, k-1) {
graph[i].pb(i+1);
revg[i+1].pb(i);
}
}
void dfsi(int x, int v) {
if(inv[x] >= v) return;
inv[x] = v;
for(auto e : graph[x]) {
dfsi(e, v);
}
}
void dfso(int x, int v) {
if(outv[x] <= v) return;
outv[x] = v;
for(auto e : revg[x]) {
dfso(e, v);
}
}
int add_teleporter(int u, int v) {
if(inv[u] >= outv[v]) return 1;
dfsi(v, inv[u]);
dfso(u, outv[v]);
graph[u].pb(v);
revg[v].pb(u);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
0 ms |
344 KB |
Output is correct |
17 |
Correct |
0 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
596 KB |
Output is correct |
19 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
0 ms |
344 KB |
Output is correct |
17 |
Correct |
0 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
596 KB |
Output is correct |
19 |
Correct |
0 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
0 ms |
344 KB |
Output is correct |
22 |
Correct |
1 ms |
344 KB |
Output is correct |
23 |
Correct |
1 ms |
344 KB |
Output is correct |
24 |
Correct |
4 ms |
344 KB |
Output is correct |
25 |
Correct |
2 ms |
600 KB |
Output is correct |
26 |
Correct |
2 ms |
1112 KB |
Output is correct |
27 |
Correct |
1 ms |
344 KB |
Output is correct |
28 |
Correct |
1 ms |
344 KB |
Output is correct |
29 |
Correct |
2 ms |
856 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
0 ms |
344 KB |
Output is correct |
17 |
Correct |
0 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
596 KB |
Output is correct |
19 |
Correct |
0 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
0 ms |
344 KB |
Output is correct |
22 |
Correct |
1 ms |
344 KB |
Output is correct |
23 |
Correct |
1 ms |
344 KB |
Output is correct |
24 |
Correct |
4 ms |
344 KB |
Output is correct |
25 |
Correct |
2 ms |
600 KB |
Output is correct |
26 |
Correct |
2 ms |
1112 KB |
Output is correct |
27 |
Correct |
1 ms |
344 KB |
Output is correct |
28 |
Correct |
1 ms |
344 KB |
Output is correct |
29 |
Correct |
2 ms |
856 KB |
Output is correct |
30 |
Correct |
11 ms |
3416 KB |
Output is correct |
31 |
Correct |
5 ms |
2648 KB |
Output is correct |
32 |
Correct |
12 ms |
4184 KB |
Output is correct |
33 |
Correct |
14 ms |
4184 KB |
Output is correct |
34 |
Correct |
863 ms |
4892 KB |
Output is correct |
35 |
Correct |
319 ms |
4556 KB |
Output is correct |
36 |
Correct |
33 ms |
4448 KB |
Output is correct |
37 |
Correct |
24 ms |
4172 KB |
Output is correct |
38 |
Correct |
25 ms |
4448 KB |
Output is correct |
39 |
Correct |
27 ms |
4360 KB |
Output is correct |
40 |
Correct |
693 ms |
5204 KB |
Output is correct |
41 |
Correct |
140 ms |
4688 KB |
Output is correct |
42 |
Correct |
90 ms |
4052 KB |
Output is correct |
43 |
Correct |
33 ms |
5160 KB |
Output is correct |
44 |
Correct |
621 ms |
5132 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
0 ms |
344 KB |
Output is correct |
17 |
Correct |
0 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
596 KB |
Output is correct |
19 |
Correct |
0 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
0 ms |
344 KB |
Output is correct |
22 |
Correct |
1 ms |
344 KB |
Output is correct |
23 |
Correct |
1 ms |
344 KB |
Output is correct |
24 |
Correct |
4 ms |
344 KB |
Output is correct |
25 |
Correct |
2 ms |
600 KB |
Output is correct |
26 |
Correct |
2 ms |
1112 KB |
Output is correct |
27 |
Correct |
1 ms |
344 KB |
Output is correct |
28 |
Correct |
1 ms |
344 KB |
Output is correct |
29 |
Correct |
2 ms |
856 KB |
Output is correct |
30 |
Correct |
11 ms |
3416 KB |
Output is correct |
31 |
Correct |
5 ms |
2648 KB |
Output is correct |
32 |
Correct |
12 ms |
4184 KB |
Output is correct |
33 |
Correct |
14 ms |
4184 KB |
Output is correct |
34 |
Correct |
863 ms |
4892 KB |
Output is correct |
35 |
Correct |
319 ms |
4556 KB |
Output is correct |
36 |
Correct |
33 ms |
4448 KB |
Output is correct |
37 |
Correct |
24 ms |
4172 KB |
Output is correct |
38 |
Correct |
25 ms |
4448 KB |
Output is correct |
39 |
Correct |
27 ms |
4360 KB |
Output is correct |
40 |
Correct |
693 ms |
5204 KB |
Output is correct |
41 |
Correct |
140 ms |
4688 KB |
Output is correct |
42 |
Correct |
90 ms |
4052 KB |
Output is correct |
43 |
Correct |
33 ms |
5160 KB |
Output is correct |
44 |
Correct |
621 ms |
5132 KB |
Output is correct |
45 |
Correct |
168 ms |
28696 KB |
Output is correct |
46 |
Correct |
9 ms |
17492 KB |
Output is correct |
47 |
Correct |
11 ms |
17496 KB |
Output is correct |
48 |
Correct |
275 ms |
40232 KB |
Output is correct |
49 |
Correct |
232 ms |
36364 KB |
Output is correct |
50 |
Execution timed out |
4073 ms |
40344 KB |
Time limit exceeded |
51 |
Halted |
0 ms |
0 KB |
- |