//#include "game.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,k,pl=0;
vector<vector<ll>> cad(300005);
vector<ll> dp(300005,-1);
void dfs(ll node, ll val)
{
if(node<k&&val>=dp[node]) pl=1;
if(pl) return;
if(dp[node]<val) dp[node]=val;
else return;
for(auto i:cad[node])
dfs(i,val);
}
void init(int N, int K) {
n=N;
k=K;
for(int i=0; i<k; i++) {dp[i]=i;if(i!=k-1)cad[i].push_back(i+1);}
}
int add_teleporter(int u, int v) {
if(v<=u||v>=k) {cad[u].push_back(v);dfs(v,dp[u]);}
return pl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
9816 KB |
Output is correct |
2 |
Correct |
3 ms |
9816 KB |
Output is correct |
3 |
Correct |
3 ms |
9816 KB |
Output is correct |
4 |
Correct |
2 ms |
9816 KB |
Output is correct |
5 |
Correct |
2 ms |
9816 KB |
Output is correct |
6 |
Correct |
2 ms |
9816 KB |
Output is correct |
7 |
Correct |
2 ms |
9816 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
9816 KB |
Output is correct |
2 |
Correct |
3 ms |
9816 KB |
Output is correct |
3 |
Correct |
3 ms |
9816 KB |
Output is correct |
4 |
Correct |
2 ms |
9816 KB |
Output is correct |
5 |
Correct |
2 ms |
9816 KB |
Output is correct |
6 |
Correct |
2 ms |
9816 KB |
Output is correct |
7 |
Correct |
2 ms |
9816 KB |
Output is correct |
8 |
Correct |
2 ms |
9816 KB |
Output is correct |
9 |
Correct |
2 ms |
9816 KB |
Output is correct |
10 |
Correct |
2 ms |
9816 KB |
Output is correct |
11 |
Correct |
2 ms |
9828 KB |
Output is correct |
12 |
Correct |
2 ms |
9816 KB |
Output is correct |
13 |
Correct |
3 ms |
9816 KB |
Output is correct |
14 |
Correct |
2 ms |
9816 KB |
Output is correct |
15 |
Correct |
2 ms |
9816 KB |
Output is correct |
16 |
Correct |
2 ms |
9816 KB |
Output is correct |
17 |
Correct |
2 ms |
9792 KB |
Output is correct |
18 |
Correct |
2 ms |
9632 KB |
Output is correct |
19 |
Correct |
2 ms |
9816 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
9816 KB |
Output is correct |
2 |
Correct |
3 ms |
9816 KB |
Output is correct |
3 |
Correct |
3 ms |
9816 KB |
Output is correct |
4 |
Correct |
2 ms |
9816 KB |
Output is correct |
5 |
Correct |
2 ms |
9816 KB |
Output is correct |
6 |
Correct |
2 ms |
9816 KB |
Output is correct |
7 |
Correct |
2 ms |
9816 KB |
Output is correct |
8 |
Correct |
2 ms |
9816 KB |
Output is correct |
9 |
Correct |
2 ms |
9816 KB |
Output is correct |
10 |
Correct |
2 ms |
9816 KB |
Output is correct |
11 |
Correct |
2 ms |
9828 KB |
Output is correct |
12 |
Correct |
2 ms |
9816 KB |
Output is correct |
13 |
Correct |
3 ms |
9816 KB |
Output is correct |
14 |
Correct |
2 ms |
9816 KB |
Output is correct |
15 |
Correct |
2 ms |
9816 KB |
Output is correct |
16 |
Correct |
2 ms |
9816 KB |
Output is correct |
17 |
Correct |
2 ms |
9792 KB |
Output is correct |
18 |
Correct |
2 ms |
9632 KB |
Output is correct |
19 |
Correct |
2 ms |
9816 KB |
Output is correct |
20 |
Correct |
3 ms |
9816 KB |
Output is correct |
21 |
Correct |
3 ms |
9816 KB |
Output is correct |
22 |
Correct |
2 ms |
9816 KB |
Output is correct |
23 |
Correct |
2 ms |
9816 KB |
Output is correct |
24 |
Correct |
4 ms |
9816 KB |
Output is correct |
25 |
Correct |
5 ms |
9816 KB |
Output is correct |
26 |
Correct |
3 ms |
9812 KB |
Output is correct |
27 |
Correct |
3 ms |
9816 KB |
Output is correct |
28 |
Correct |
3 ms |
9880 KB |
Output is correct |
29 |
Correct |
3 ms |
9816 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
9816 KB |
Output is correct |
2 |
Correct |
3 ms |
9816 KB |
Output is correct |
3 |
Correct |
3 ms |
9816 KB |
Output is correct |
4 |
Correct |
2 ms |
9816 KB |
Output is correct |
5 |
Correct |
2 ms |
9816 KB |
Output is correct |
6 |
Correct |
2 ms |
9816 KB |
Output is correct |
7 |
Correct |
2 ms |
9816 KB |
Output is correct |
8 |
Correct |
2 ms |
9816 KB |
Output is correct |
9 |
Correct |
2 ms |
9816 KB |
Output is correct |
10 |
Correct |
2 ms |
9816 KB |
Output is correct |
11 |
Correct |
2 ms |
9828 KB |
Output is correct |
12 |
Correct |
2 ms |
9816 KB |
Output is correct |
13 |
Correct |
3 ms |
9816 KB |
Output is correct |
14 |
Correct |
2 ms |
9816 KB |
Output is correct |
15 |
Correct |
2 ms |
9816 KB |
Output is correct |
16 |
Correct |
2 ms |
9816 KB |
Output is correct |
17 |
Correct |
2 ms |
9792 KB |
Output is correct |
18 |
Correct |
2 ms |
9632 KB |
Output is correct |
19 |
Correct |
2 ms |
9816 KB |
Output is correct |
20 |
Correct |
3 ms |
9816 KB |
Output is correct |
21 |
Correct |
3 ms |
9816 KB |
Output is correct |
22 |
Correct |
2 ms |
9816 KB |
Output is correct |
23 |
Correct |
2 ms |
9816 KB |
Output is correct |
24 |
Correct |
4 ms |
9816 KB |
Output is correct |
25 |
Correct |
5 ms |
9816 KB |
Output is correct |
26 |
Correct |
3 ms |
9812 KB |
Output is correct |
27 |
Correct |
3 ms |
9816 KB |
Output is correct |
28 |
Correct |
3 ms |
9880 KB |
Output is correct |
29 |
Correct |
3 ms |
9816 KB |
Output is correct |
30 |
Correct |
8 ms |
10328 KB |
Output is correct |
31 |
Correct |
4 ms |
9956 KB |
Output is correct |
32 |
Correct |
9 ms |
10812 KB |
Output is correct |
33 |
Correct |
9 ms |
10712 KB |
Output is correct |
34 |
Correct |
444 ms |
11656 KB |
Output is correct |
35 |
Correct |
149 ms |
10980 KB |
Output is correct |
36 |
Correct |
15 ms |
10840 KB |
Output is correct |
37 |
Correct |
14 ms |
10584 KB |
Output is correct |
38 |
Correct |
14 ms |
10604 KB |
Output is correct |
39 |
Correct |
13 ms |
10584 KB |
Output is correct |
40 |
Correct |
358 ms |
11848 KB |
Output is correct |
41 |
Correct |
70 ms |
11096 KB |
Output is correct |
42 |
Correct |
50 ms |
11048 KB |
Output is correct |
43 |
Correct |
18 ms |
12244 KB |
Output is correct |
44 |
Correct |
248 ms |
12088 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
9816 KB |
Output is correct |
2 |
Correct |
3 ms |
9816 KB |
Output is correct |
3 |
Correct |
3 ms |
9816 KB |
Output is correct |
4 |
Correct |
2 ms |
9816 KB |
Output is correct |
5 |
Correct |
2 ms |
9816 KB |
Output is correct |
6 |
Correct |
2 ms |
9816 KB |
Output is correct |
7 |
Correct |
2 ms |
9816 KB |
Output is correct |
8 |
Correct |
2 ms |
9816 KB |
Output is correct |
9 |
Correct |
2 ms |
9816 KB |
Output is correct |
10 |
Correct |
2 ms |
9816 KB |
Output is correct |
11 |
Correct |
2 ms |
9828 KB |
Output is correct |
12 |
Correct |
2 ms |
9816 KB |
Output is correct |
13 |
Correct |
3 ms |
9816 KB |
Output is correct |
14 |
Correct |
2 ms |
9816 KB |
Output is correct |
15 |
Correct |
2 ms |
9816 KB |
Output is correct |
16 |
Correct |
2 ms |
9816 KB |
Output is correct |
17 |
Correct |
2 ms |
9792 KB |
Output is correct |
18 |
Correct |
2 ms |
9632 KB |
Output is correct |
19 |
Correct |
2 ms |
9816 KB |
Output is correct |
20 |
Correct |
3 ms |
9816 KB |
Output is correct |
21 |
Correct |
3 ms |
9816 KB |
Output is correct |
22 |
Correct |
2 ms |
9816 KB |
Output is correct |
23 |
Correct |
2 ms |
9816 KB |
Output is correct |
24 |
Correct |
4 ms |
9816 KB |
Output is correct |
25 |
Correct |
5 ms |
9816 KB |
Output is correct |
26 |
Correct |
3 ms |
9812 KB |
Output is correct |
27 |
Correct |
3 ms |
9816 KB |
Output is correct |
28 |
Correct |
3 ms |
9880 KB |
Output is correct |
29 |
Correct |
3 ms |
9816 KB |
Output is correct |
30 |
Correct |
8 ms |
10328 KB |
Output is correct |
31 |
Correct |
4 ms |
9956 KB |
Output is correct |
32 |
Correct |
9 ms |
10812 KB |
Output is correct |
33 |
Correct |
9 ms |
10712 KB |
Output is correct |
34 |
Correct |
444 ms |
11656 KB |
Output is correct |
35 |
Correct |
149 ms |
10980 KB |
Output is correct |
36 |
Correct |
15 ms |
10840 KB |
Output is correct |
37 |
Correct |
14 ms |
10584 KB |
Output is correct |
38 |
Correct |
14 ms |
10604 KB |
Output is correct |
39 |
Correct |
13 ms |
10584 KB |
Output is correct |
40 |
Correct |
358 ms |
11848 KB |
Output is correct |
41 |
Correct |
70 ms |
11096 KB |
Output is correct |
42 |
Correct |
50 ms |
11048 KB |
Output is correct |
43 |
Correct |
18 ms |
12244 KB |
Output is correct |
44 |
Correct |
248 ms |
12088 KB |
Output is correct |
45 |
Correct |
73 ms |
15696 KB |
Output is correct |
46 |
Correct |
4 ms |
10072 KB |
Output is correct |
47 |
Correct |
3 ms |
10072 KB |
Output is correct |
48 |
Correct |
97 ms |
23184 KB |
Output is correct |
49 |
Correct |
93 ms |
19248 KB |
Output is correct |
50 |
Execution timed out |
4011 ms |
23884 KB |
Time limit exceeded |
51 |
Halted |
0 ms |
0 KB |
- |