# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
952698 |
2024-03-24T15:13:51 Z |
quanlt206 |
Game (APIO22_game) |
C++17 |
|
4000 ms |
43060 KB |
#include "game.h"
#include<bits/stdc++.h>
#define X first
#define Y second
#define all(x) begin(x), end(x)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, b, a) for(int i = (b); i >= (a); i--)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define mxx max_element
#define mnn min_element
#define SQR(x) (1LL * (x) * (x))
#define MASK(i) (1LL << (i))
#define Point Vector
#define left Left
#define right Right
#define div Div
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef pair<db, db> pdb;
typedef pair<ld, ld> pld;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, pll> plll;
typedef pair<ll, int> pli;
typedef pair<ll, pii> plii;
template<class A, class B>
bool maximize(A& x, B y) {
if (x < y) return x = y, true; else return false;
}
template<class A, class B>
bool minimize(A& x, B y) {
if (x > y) return x = y, true; else return false;
}
/* END OF TEMPLATE */
const int N = 3e5 + 7;
int n, k;
vector<int> v[N], rv[N];
int res[N], res2[N];
void init(int N, int K) {
n = N;
k = K;
REP(i, 0, k - 1) {
v[i].push_back(i + 1);
rv[i + 1].push_back(i);
}
REP(i, 0, n) res[i] = -1;
}
int d[2][N];
bool getAnswer = false;
void dfs(int x, int val) {
if (!maximize(res[x], val)) return ;
if (x < k && res[x] >= x) getAnswer = true;
for (auto y : v[x]) dfs(y, val);
}
int add_teleporter(int x, int y) {
dfs(y, (x < k ? x : res[x]));
v[x].push_back(y);
rv[y].push_back(x);
// cout<<x<<" "<<y<<"\n";
// REP(i, 0, n) cout<<res[i]<<" "; cout<<"\n";
if (getAnswer) return 1;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
16984 KB |
Output is correct |
2 |
Correct |
7 ms |
16968 KB |
Output is correct |
3 |
Correct |
4 ms |
17240 KB |
Output is correct |
4 |
Correct |
4 ms |
16984 KB |
Output is correct |
5 |
Correct |
3 ms |
16984 KB |
Output is correct |
6 |
Correct |
4 ms |
16984 KB |
Output is correct |
7 |
Correct |
6 ms |
16984 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
16984 KB |
Output is correct |
2 |
Correct |
7 ms |
16968 KB |
Output is correct |
3 |
Correct |
4 ms |
17240 KB |
Output is correct |
4 |
Correct |
4 ms |
16984 KB |
Output is correct |
5 |
Correct |
3 ms |
16984 KB |
Output is correct |
6 |
Correct |
4 ms |
16984 KB |
Output is correct |
7 |
Correct |
6 ms |
16984 KB |
Output is correct |
8 |
Correct |
5 ms |
16984 KB |
Output is correct |
9 |
Correct |
5 ms |
16984 KB |
Output is correct |
10 |
Correct |
3 ms |
16984 KB |
Output is correct |
11 |
Correct |
4 ms |
16984 KB |
Output is correct |
12 |
Correct |
3 ms |
16984 KB |
Output is correct |
13 |
Correct |
4 ms |
16984 KB |
Output is correct |
14 |
Correct |
4 ms |
16984 KB |
Output is correct |
15 |
Correct |
4 ms |
16984 KB |
Output is correct |
16 |
Correct |
4 ms |
16984 KB |
Output is correct |
17 |
Correct |
4 ms |
17240 KB |
Output is correct |
18 |
Correct |
3 ms |
16984 KB |
Output is correct |
19 |
Correct |
4 ms |
16984 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
16984 KB |
Output is correct |
2 |
Correct |
7 ms |
16968 KB |
Output is correct |
3 |
Correct |
4 ms |
17240 KB |
Output is correct |
4 |
Correct |
4 ms |
16984 KB |
Output is correct |
5 |
Correct |
3 ms |
16984 KB |
Output is correct |
6 |
Correct |
4 ms |
16984 KB |
Output is correct |
7 |
Correct |
6 ms |
16984 KB |
Output is correct |
8 |
Correct |
5 ms |
16984 KB |
Output is correct |
9 |
Correct |
5 ms |
16984 KB |
Output is correct |
10 |
Correct |
3 ms |
16984 KB |
Output is correct |
11 |
Correct |
4 ms |
16984 KB |
Output is correct |
12 |
Correct |
3 ms |
16984 KB |
Output is correct |
13 |
Correct |
4 ms |
16984 KB |
Output is correct |
14 |
Correct |
4 ms |
16984 KB |
Output is correct |
15 |
Correct |
4 ms |
16984 KB |
Output is correct |
16 |
Correct |
4 ms |
16984 KB |
Output is correct |
17 |
Correct |
4 ms |
17240 KB |
Output is correct |
18 |
Correct |
3 ms |
16984 KB |
Output is correct |
19 |
Correct |
4 ms |
16984 KB |
Output is correct |
20 |
Correct |
5 ms |
16984 KB |
Output is correct |
21 |
Correct |
3 ms |
16984 KB |
Output is correct |
22 |
Correct |
4 ms |
16984 KB |
Output is correct |
23 |
Correct |
4 ms |
16824 KB |
Output is correct |
24 |
Correct |
5 ms |
17240 KB |
Output is correct |
25 |
Correct |
6 ms |
16984 KB |
Output is correct |
26 |
Correct |
5 ms |
17496 KB |
Output is correct |
27 |
Correct |
5 ms |
17240 KB |
Output is correct |
28 |
Correct |
5 ms |
17396 KB |
Output is correct |
29 |
Correct |
6 ms |
17092 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
16984 KB |
Output is correct |
2 |
Correct |
7 ms |
16968 KB |
Output is correct |
3 |
Correct |
4 ms |
17240 KB |
Output is correct |
4 |
Correct |
4 ms |
16984 KB |
Output is correct |
5 |
Correct |
3 ms |
16984 KB |
Output is correct |
6 |
Correct |
4 ms |
16984 KB |
Output is correct |
7 |
Correct |
6 ms |
16984 KB |
Output is correct |
8 |
Correct |
5 ms |
16984 KB |
Output is correct |
9 |
Correct |
5 ms |
16984 KB |
Output is correct |
10 |
Correct |
3 ms |
16984 KB |
Output is correct |
11 |
Correct |
4 ms |
16984 KB |
Output is correct |
12 |
Correct |
3 ms |
16984 KB |
Output is correct |
13 |
Correct |
4 ms |
16984 KB |
Output is correct |
14 |
Correct |
4 ms |
16984 KB |
Output is correct |
15 |
Correct |
4 ms |
16984 KB |
Output is correct |
16 |
Correct |
4 ms |
16984 KB |
Output is correct |
17 |
Correct |
4 ms |
17240 KB |
Output is correct |
18 |
Correct |
3 ms |
16984 KB |
Output is correct |
19 |
Correct |
4 ms |
16984 KB |
Output is correct |
20 |
Correct |
5 ms |
16984 KB |
Output is correct |
21 |
Correct |
3 ms |
16984 KB |
Output is correct |
22 |
Correct |
4 ms |
16984 KB |
Output is correct |
23 |
Correct |
4 ms |
16824 KB |
Output is correct |
24 |
Correct |
5 ms |
17240 KB |
Output is correct |
25 |
Correct |
6 ms |
16984 KB |
Output is correct |
26 |
Correct |
5 ms |
17496 KB |
Output is correct |
27 |
Correct |
5 ms |
17240 KB |
Output is correct |
28 |
Correct |
5 ms |
17396 KB |
Output is correct |
29 |
Correct |
6 ms |
17092 KB |
Output is correct |
30 |
Correct |
17 ms |
18500 KB |
Output is correct |
31 |
Correct |
8 ms |
17752 KB |
Output is correct |
32 |
Correct |
18 ms |
18956 KB |
Output is correct |
33 |
Correct |
18 ms |
19104 KB |
Output is correct |
34 |
Correct |
496 ms |
20468 KB |
Output is correct |
35 |
Correct |
169 ms |
19680 KB |
Output is correct |
36 |
Correct |
34 ms |
19164 KB |
Output is correct |
37 |
Correct |
29 ms |
18860 KB |
Output is correct |
38 |
Correct |
28 ms |
18840 KB |
Output is correct |
39 |
Correct |
24 ms |
19112 KB |
Output is correct |
40 |
Correct |
418 ms |
20524 KB |
Output is correct |
41 |
Correct |
95 ms |
19888 KB |
Output is correct |
42 |
Correct |
61 ms |
18784 KB |
Output is correct |
43 |
Correct |
33 ms |
20624 KB |
Output is correct |
44 |
Correct |
256 ms |
20304 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
16984 KB |
Output is correct |
2 |
Correct |
7 ms |
16968 KB |
Output is correct |
3 |
Correct |
4 ms |
17240 KB |
Output is correct |
4 |
Correct |
4 ms |
16984 KB |
Output is correct |
5 |
Correct |
3 ms |
16984 KB |
Output is correct |
6 |
Correct |
4 ms |
16984 KB |
Output is correct |
7 |
Correct |
6 ms |
16984 KB |
Output is correct |
8 |
Correct |
5 ms |
16984 KB |
Output is correct |
9 |
Correct |
5 ms |
16984 KB |
Output is correct |
10 |
Correct |
3 ms |
16984 KB |
Output is correct |
11 |
Correct |
4 ms |
16984 KB |
Output is correct |
12 |
Correct |
3 ms |
16984 KB |
Output is correct |
13 |
Correct |
4 ms |
16984 KB |
Output is correct |
14 |
Correct |
4 ms |
16984 KB |
Output is correct |
15 |
Correct |
4 ms |
16984 KB |
Output is correct |
16 |
Correct |
4 ms |
16984 KB |
Output is correct |
17 |
Correct |
4 ms |
17240 KB |
Output is correct |
18 |
Correct |
3 ms |
16984 KB |
Output is correct |
19 |
Correct |
4 ms |
16984 KB |
Output is correct |
20 |
Correct |
5 ms |
16984 KB |
Output is correct |
21 |
Correct |
3 ms |
16984 KB |
Output is correct |
22 |
Correct |
4 ms |
16984 KB |
Output is correct |
23 |
Correct |
4 ms |
16824 KB |
Output is correct |
24 |
Correct |
5 ms |
17240 KB |
Output is correct |
25 |
Correct |
6 ms |
16984 KB |
Output is correct |
26 |
Correct |
5 ms |
17496 KB |
Output is correct |
27 |
Correct |
5 ms |
17240 KB |
Output is correct |
28 |
Correct |
5 ms |
17396 KB |
Output is correct |
29 |
Correct |
6 ms |
17092 KB |
Output is correct |
30 |
Correct |
17 ms |
18500 KB |
Output is correct |
31 |
Correct |
8 ms |
17752 KB |
Output is correct |
32 |
Correct |
18 ms |
18956 KB |
Output is correct |
33 |
Correct |
18 ms |
19104 KB |
Output is correct |
34 |
Correct |
496 ms |
20468 KB |
Output is correct |
35 |
Correct |
169 ms |
19680 KB |
Output is correct |
36 |
Correct |
34 ms |
19164 KB |
Output is correct |
37 |
Correct |
29 ms |
18860 KB |
Output is correct |
38 |
Correct |
28 ms |
18840 KB |
Output is correct |
39 |
Correct |
24 ms |
19112 KB |
Output is correct |
40 |
Correct |
418 ms |
20524 KB |
Output is correct |
41 |
Correct |
95 ms |
19888 KB |
Output is correct |
42 |
Correct |
61 ms |
18784 KB |
Output is correct |
43 |
Correct |
33 ms |
20624 KB |
Output is correct |
44 |
Correct |
256 ms |
20304 KB |
Output is correct |
45 |
Correct |
179 ms |
28692 KB |
Output is correct |
46 |
Correct |
11 ms |
17940 KB |
Output is correct |
47 |
Correct |
7 ms |
17496 KB |
Output is correct |
48 |
Correct |
276 ms |
42072 KB |
Output is correct |
49 |
Correct |
192 ms |
36372 KB |
Output is correct |
50 |
Execution timed out |
4064 ms |
43060 KB |
Time limit exceeded |
51 |
Halted |
0 ms |
0 KB |
- |