#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define fastio ios::sync_with_stdio(false), cin.tie(0)
#define pb push_back
#define eb emplace_back
#define f first
#define s second
#include "game.h"
const int maxn = 3e5 + 5;
vector<int> adj[maxn];
int mx[maxn];
int n, k;
void init(int _n, int _k) {
n = _n, k = _k;
for(int i = 0; i < n; i++){
if(i < k) mx[i] = i - 1;
else mx[i] = -1;
}
for(int i = 0; i < k - 1; i++) adj[i].pb(i + 1);
}
int add_teleporter(int u, int v) {
adj[u].pb(v);
queue<int> q;
q.push(u);
while(!q.empty()){
int pos = q.front(); q.pop();
int c = (u < k ? u : mx[u]);
for(auto x : adj[pos]){
if(c > mx[x]){
mx[x] = c;
if(x < k && c >= x) return 1;
q.push(x);
}
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
8280 KB |
Output is correct |
2 |
Correct |
2 ms |
8280 KB |
Output is correct |
3 |
Correct |
3 ms |
8280 KB |
Output is correct |
4 |
Correct |
2 ms |
8280 KB |
Output is correct |
5 |
Correct |
3 ms |
8280 KB |
Output is correct |
6 |
Correct |
2 ms |
8280 KB |
Output is correct |
7 |
Correct |
2 ms |
8280 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
8280 KB |
Output is correct |
2 |
Correct |
2 ms |
8280 KB |
Output is correct |
3 |
Correct |
3 ms |
8280 KB |
Output is correct |
4 |
Correct |
2 ms |
8280 KB |
Output is correct |
5 |
Correct |
3 ms |
8280 KB |
Output is correct |
6 |
Correct |
2 ms |
8280 KB |
Output is correct |
7 |
Correct |
2 ms |
8280 KB |
Output is correct |
8 |
Correct |
2 ms |
8280 KB |
Output is correct |
9 |
Correct |
2 ms |
8280 KB |
Output is correct |
10 |
Correct |
2 ms |
8280 KB |
Output is correct |
11 |
Correct |
2 ms |
8280 KB |
Output is correct |
12 |
Correct |
2 ms |
8280 KB |
Output is correct |
13 |
Correct |
2 ms |
8280 KB |
Output is correct |
14 |
Correct |
3 ms |
8280 KB |
Output is correct |
15 |
Correct |
2 ms |
8280 KB |
Output is correct |
16 |
Correct |
2 ms |
8280 KB |
Output is correct |
17 |
Correct |
3 ms |
8280 KB |
Output is correct |
18 |
Correct |
3 ms |
8280 KB |
Output is correct |
19 |
Correct |
2 ms |
8280 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
8280 KB |
Output is correct |
2 |
Correct |
2 ms |
8280 KB |
Output is correct |
3 |
Correct |
3 ms |
8280 KB |
Output is correct |
4 |
Correct |
2 ms |
8280 KB |
Output is correct |
5 |
Correct |
3 ms |
8280 KB |
Output is correct |
6 |
Correct |
2 ms |
8280 KB |
Output is correct |
7 |
Correct |
2 ms |
8280 KB |
Output is correct |
8 |
Correct |
2 ms |
8280 KB |
Output is correct |
9 |
Correct |
2 ms |
8280 KB |
Output is correct |
10 |
Correct |
2 ms |
8280 KB |
Output is correct |
11 |
Correct |
2 ms |
8280 KB |
Output is correct |
12 |
Correct |
2 ms |
8280 KB |
Output is correct |
13 |
Correct |
2 ms |
8280 KB |
Output is correct |
14 |
Correct |
3 ms |
8280 KB |
Output is correct |
15 |
Correct |
2 ms |
8280 KB |
Output is correct |
16 |
Correct |
2 ms |
8280 KB |
Output is correct |
17 |
Correct |
3 ms |
8280 KB |
Output is correct |
18 |
Correct |
3 ms |
8280 KB |
Output is correct |
19 |
Correct |
2 ms |
8280 KB |
Output is correct |
20 |
Correct |
2 ms |
8280 KB |
Output is correct |
21 |
Correct |
3 ms |
8280 KB |
Output is correct |
22 |
Correct |
2 ms |
8280 KB |
Output is correct |
23 |
Correct |
3 ms |
8280 KB |
Output is correct |
24 |
Correct |
4 ms |
8536 KB |
Output is correct |
25 |
Correct |
4 ms |
8280 KB |
Output is correct |
26 |
Correct |
4 ms |
8536 KB |
Output is correct |
27 |
Correct |
4 ms |
8536 KB |
Output is correct |
28 |
Correct |
3 ms |
8280 KB |
Output is correct |
29 |
Correct |
4 ms |
8280 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
8280 KB |
Output is correct |
2 |
Correct |
2 ms |
8280 KB |
Output is correct |
3 |
Correct |
3 ms |
8280 KB |
Output is correct |
4 |
Correct |
2 ms |
8280 KB |
Output is correct |
5 |
Correct |
3 ms |
8280 KB |
Output is correct |
6 |
Correct |
2 ms |
8280 KB |
Output is correct |
7 |
Correct |
2 ms |
8280 KB |
Output is correct |
8 |
Correct |
2 ms |
8280 KB |
Output is correct |
9 |
Correct |
2 ms |
8280 KB |
Output is correct |
10 |
Correct |
2 ms |
8280 KB |
Output is correct |
11 |
Correct |
2 ms |
8280 KB |
Output is correct |
12 |
Correct |
2 ms |
8280 KB |
Output is correct |
13 |
Correct |
2 ms |
8280 KB |
Output is correct |
14 |
Correct |
3 ms |
8280 KB |
Output is correct |
15 |
Correct |
2 ms |
8280 KB |
Output is correct |
16 |
Correct |
2 ms |
8280 KB |
Output is correct |
17 |
Correct |
3 ms |
8280 KB |
Output is correct |
18 |
Correct |
3 ms |
8280 KB |
Output is correct |
19 |
Correct |
2 ms |
8280 KB |
Output is correct |
20 |
Correct |
2 ms |
8280 KB |
Output is correct |
21 |
Correct |
3 ms |
8280 KB |
Output is correct |
22 |
Correct |
2 ms |
8280 KB |
Output is correct |
23 |
Correct |
3 ms |
8280 KB |
Output is correct |
24 |
Correct |
4 ms |
8536 KB |
Output is correct |
25 |
Correct |
4 ms |
8280 KB |
Output is correct |
26 |
Correct |
4 ms |
8536 KB |
Output is correct |
27 |
Correct |
4 ms |
8536 KB |
Output is correct |
28 |
Correct |
3 ms |
8280 KB |
Output is correct |
29 |
Correct |
4 ms |
8280 KB |
Output is correct |
30 |
Correct |
14 ms |
9388 KB |
Output is correct |
31 |
Correct |
4 ms |
9044 KB |
Output is correct |
32 |
Correct |
15 ms |
9652 KB |
Output is correct |
33 |
Correct |
14 ms |
9972 KB |
Output is correct |
34 |
Correct |
418 ms |
9816 KB |
Output is correct |
35 |
Correct |
156 ms |
10584 KB |
Output is correct |
36 |
Correct |
20 ms |
9756 KB |
Output is correct |
37 |
Correct |
19 ms |
10004 KB |
Output is correct |
38 |
Correct |
25 ms |
9960 KB |
Output is correct |
39 |
Correct |
23 ms |
10168 KB |
Output is correct |
40 |
Correct |
337 ms |
9920 KB |
Output is correct |
41 |
Correct |
74 ms |
9916 KB |
Output is correct |
42 |
Correct |
54 ms |
9560 KB |
Output is correct |
43 |
Correct |
30 ms |
10072 KB |
Output is correct |
44 |
Correct |
137 ms |
10008 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
8280 KB |
Output is correct |
2 |
Correct |
2 ms |
8280 KB |
Output is correct |
3 |
Correct |
3 ms |
8280 KB |
Output is correct |
4 |
Correct |
2 ms |
8280 KB |
Output is correct |
5 |
Correct |
3 ms |
8280 KB |
Output is correct |
6 |
Correct |
2 ms |
8280 KB |
Output is correct |
7 |
Correct |
2 ms |
8280 KB |
Output is correct |
8 |
Correct |
2 ms |
8280 KB |
Output is correct |
9 |
Correct |
2 ms |
8280 KB |
Output is correct |
10 |
Correct |
2 ms |
8280 KB |
Output is correct |
11 |
Correct |
2 ms |
8280 KB |
Output is correct |
12 |
Correct |
2 ms |
8280 KB |
Output is correct |
13 |
Correct |
2 ms |
8280 KB |
Output is correct |
14 |
Correct |
3 ms |
8280 KB |
Output is correct |
15 |
Correct |
2 ms |
8280 KB |
Output is correct |
16 |
Correct |
2 ms |
8280 KB |
Output is correct |
17 |
Correct |
3 ms |
8280 KB |
Output is correct |
18 |
Correct |
3 ms |
8280 KB |
Output is correct |
19 |
Correct |
2 ms |
8280 KB |
Output is correct |
20 |
Correct |
2 ms |
8280 KB |
Output is correct |
21 |
Correct |
3 ms |
8280 KB |
Output is correct |
22 |
Correct |
2 ms |
8280 KB |
Output is correct |
23 |
Correct |
3 ms |
8280 KB |
Output is correct |
24 |
Correct |
4 ms |
8536 KB |
Output is correct |
25 |
Correct |
4 ms |
8280 KB |
Output is correct |
26 |
Correct |
4 ms |
8536 KB |
Output is correct |
27 |
Correct |
4 ms |
8536 KB |
Output is correct |
28 |
Correct |
3 ms |
8280 KB |
Output is correct |
29 |
Correct |
4 ms |
8280 KB |
Output is correct |
30 |
Correct |
14 ms |
9388 KB |
Output is correct |
31 |
Correct |
4 ms |
9044 KB |
Output is correct |
32 |
Correct |
15 ms |
9652 KB |
Output is correct |
33 |
Correct |
14 ms |
9972 KB |
Output is correct |
34 |
Correct |
418 ms |
9816 KB |
Output is correct |
35 |
Correct |
156 ms |
10584 KB |
Output is correct |
36 |
Correct |
20 ms |
9756 KB |
Output is correct |
37 |
Correct |
19 ms |
10004 KB |
Output is correct |
38 |
Correct |
25 ms |
9960 KB |
Output is correct |
39 |
Correct |
23 ms |
10168 KB |
Output is correct |
40 |
Correct |
337 ms |
9920 KB |
Output is correct |
41 |
Correct |
74 ms |
9916 KB |
Output is correct |
42 |
Correct |
54 ms |
9560 KB |
Output is correct |
43 |
Correct |
30 ms |
10072 KB |
Output is correct |
44 |
Correct |
137 ms |
10008 KB |
Output is correct |
45 |
Correct |
111 ms |
14912 KB |
Output is correct |
46 |
Correct |
5 ms |
8792 KB |
Output is correct |
47 |
Correct |
6 ms |
9048 KB |
Output is correct |
48 |
Correct |
159 ms |
18032 KB |
Output is correct |
49 |
Correct |
140 ms |
18528 KB |
Output is correct |
50 |
Execution timed out |
4081 ms |
19124 KB |
Time limit exceeded |
51 |
Halted |
0 ms |
0 KB |
- |