#include "game.h"
#include<bits/stdc++.h>
using namespace std;
int const n_max=3e5+10;
int mx[n_max];
vector<int> node[n_max];
int n,k;
void init(int N, int K)
{
n=N;
k=K;
fill(mx,mx+n,-1);
}
bool flag=false;
int add_teleporter(int u, int v)
{
if(flag)return 1;
node[u].push_back(v);
queue<int> q;
int val=mx[u];
if(u<k)val=u;
if(val==-1)return 0;
q.push(v);
while(!q.empty())
{
int cur=q.front();
q.pop();
if(mx[cur]>=val)continue;
if(cur<k&&val>=cur)
{
flag=true;
return 1;
}
mx[cur]=val;
for(auto nxt:node[cur])
{
if(mx[nxt]>=val)continue;
q.push(nxt);
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
7256 KB |
Output is correct |
2 |
Correct |
3 ms |
7256 KB |
Output is correct |
3 |
Correct |
3 ms |
7424 KB |
Output is correct |
4 |
Correct |
4 ms |
7256 KB |
Output is correct |
5 |
Correct |
3 ms |
7256 KB |
Output is correct |
6 |
Correct |
4 ms |
7256 KB |
Output is correct |
7 |
Correct |
4 ms |
7256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
7256 KB |
Output is correct |
2 |
Correct |
3 ms |
7256 KB |
Output is correct |
3 |
Correct |
3 ms |
7424 KB |
Output is correct |
4 |
Correct |
4 ms |
7256 KB |
Output is correct |
5 |
Correct |
3 ms |
7256 KB |
Output is correct |
6 |
Correct |
4 ms |
7256 KB |
Output is correct |
7 |
Correct |
4 ms |
7256 KB |
Output is correct |
8 |
Correct |
3 ms |
7256 KB |
Output is correct |
9 |
Correct |
3 ms |
7324 KB |
Output is correct |
10 |
Correct |
3 ms |
7256 KB |
Output is correct |
11 |
Correct |
3 ms |
7256 KB |
Output is correct |
12 |
Correct |
3 ms |
7244 KB |
Output is correct |
13 |
Correct |
4 ms |
7256 KB |
Output is correct |
14 |
Correct |
3 ms |
7256 KB |
Output is correct |
15 |
Correct |
4 ms |
7256 KB |
Output is correct |
16 |
Correct |
3 ms |
7256 KB |
Output is correct |
17 |
Correct |
4 ms |
7256 KB |
Output is correct |
18 |
Correct |
4 ms |
7256 KB |
Output is correct |
19 |
Correct |
4 ms |
7256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
7256 KB |
Output is correct |
2 |
Correct |
3 ms |
7256 KB |
Output is correct |
3 |
Correct |
3 ms |
7424 KB |
Output is correct |
4 |
Correct |
4 ms |
7256 KB |
Output is correct |
5 |
Correct |
3 ms |
7256 KB |
Output is correct |
6 |
Correct |
4 ms |
7256 KB |
Output is correct |
7 |
Correct |
4 ms |
7256 KB |
Output is correct |
8 |
Correct |
3 ms |
7256 KB |
Output is correct |
9 |
Correct |
3 ms |
7324 KB |
Output is correct |
10 |
Correct |
3 ms |
7256 KB |
Output is correct |
11 |
Correct |
3 ms |
7256 KB |
Output is correct |
12 |
Correct |
3 ms |
7244 KB |
Output is correct |
13 |
Correct |
4 ms |
7256 KB |
Output is correct |
14 |
Correct |
3 ms |
7256 KB |
Output is correct |
15 |
Correct |
4 ms |
7256 KB |
Output is correct |
16 |
Correct |
3 ms |
7256 KB |
Output is correct |
17 |
Correct |
4 ms |
7256 KB |
Output is correct |
18 |
Correct |
4 ms |
7256 KB |
Output is correct |
19 |
Correct |
4 ms |
7256 KB |
Output is correct |
20 |
Correct |
4 ms |
7256 KB |
Output is correct |
21 |
Correct |
5 ms |
7256 KB |
Output is correct |
22 |
Correct |
4 ms |
7520 KB |
Output is correct |
23 |
Correct |
4 ms |
7512 KB |
Output is correct |
24 |
Correct |
5 ms |
7512 KB |
Output is correct |
25 |
Correct |
5 ms |
8536 KB |
Output is correct |
26 |
Correct |
5 ms |
7512 KB |
Output is correct |
27 |
Correct |
5 ms |
7512 KB |
Output is correct |
28 |
Correct |
4 ms |
7256 KB |
Output is correct |
29 |
Correct |
5 ms |
7512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
7256 KB |
Output is correct |
2 |
Correct |
3 ms |
7256 KB |
Output is correct |
3 |
Correct |
3 ms |
7424 KB |
Output is correct |
4 |
Correct |
4 ms |
7256 KB |
Output is correct |
5 |
Correct |
3 ms |
7256 KB |
Output is correct |
6 |
Correct |
4 ms |
7256 KB |
Output is correct |
7 |
Correct |
4 ms |
7256 KB |
Output is correct |
8 |
Correct |
3 ms |
7256 KB |
Output is correct |
9 |
Correct |
3 ms |
7324 KB |
Output is correct |
10 |
Correct |
3 ms |
7256 KB |
Output is correct |
11 |
Correct |
3 ms |
7256 KB |
Output is correct |
12 |
Correct |
3 ms |
7244 KB |
Output is correct |
13 |
Correct |
4 ms |
7256 KB |
Output is correct |
14 |
Correct |
3 ms |
7256 KB |
Output is correct |
15 |
Correct |
4 ms |
7256 KB |
Output is correct |
16 |
Correct |
3 ms |
7256 KB |
Output is correct |
17 |
Correct |
4 ms |
7256 KB |
Output is correct |
18 |
Correct |
4 ms |
7256 KB |
Output is correct |
19 |
Correct |
4 ms |
7256 KB |
Output is correct |
20 |
Correct |
4 ms |
7256 KB |
Output is correct |
21 |
Correct |
5 ms |
7256 KB |
Output is correct |
22 |
Correct |
4 ms |
7520 KB |
Output is correct |
23 |
Correct |
4 ms |
7512 KB |
Output is correct |
24 |
Correct |
5 ms |
7512 KB |
Output is correct |
25 |
Correct |
5 ms |
8536 KB |
Output is correct |
26 |
Correct |
5 ms |
7512 KB |
Output is correct |
27 |
Correct |
5 ms |
7512 KB |
Output is correct |
28 |
Correct |
4 ms |
7256 KB |
Output is correct |
29 |
Correct |
5 ms |
7512 KB |
Output is correct |
30 |
Correct |
15 ms |
8536 KB |
Output is correct |
31 |
Correct |
7 ms |
8024 KB |
Output is correct |
32 |
Correct |
16 ms |
8792 KB |
Output is correct |
33 |
Correct |
16 ms |
9016 KB |
Output is correct |
34 |
Correct |
451 ms |
8820 KB |
Output is correct |
35 |
Correct |
164 ms |
8792 KB |
Output is correct |
36 |
Correct |
27 ms |
9364 KB |
Output is correct |
37 |
Correct |
22 ms |
9128 KB |
Output is correct |
38 |
Correct |
24 ms |
9012 KB |
Output is correct |
39 |
Correct |
28 ms |
8916 KB |
Output is correct |
40 |
Correct |
369 ms |
8768 KB |
Output is correct |
41 |
Correct |
83 ms |
8536 KB |
Output is correct |
42 |
Correct |
56 ms |
8912 KB |
Output is correct |
43 |
Correct |
27 ms |
10072 KB |
Output is correct |
44 |
Correct |
114 ms |
9048 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
7256 KB |
Output is correct |
2 |
Correct |
3 ms |
7256 KB |
Output is correct |
3 |
Correct |
3 ms |
7424 KB |
Output is correct |
4 |
Correct |
4 ms |
7256 KB |
Output is correct |
5 |
Correct |
3 ms |
7256 KB |
Output is correct |
6 |
Correct |
4 ms |
7256 KB |
Output is correct |
7 |
Correct |
4 ms |
7256 KB |
Output is correct |
8 |
Correct |
3 ms |
7256 KB |
Output is correct |
9 |
Correct |
3 ms |
7324 KB |
Output is correct |
10 |
Correct |
3 ms |
7256 KB |
Output is correct |
11 |
Correct |
3 ms |
7256 KB |
Output is correct |
12 |
Correct |
3 ms |
7244 KB |
Output is correct |
13 |
Correct |
4 ms |
7256 KB |
Output is correct |
14 |
Correct |
3 ms |
7256 KB |
Output is correct |
15 |
Correct |
4 ms |
7256 KB |
Output is correct |
16 |
Correct |
3 ms |
7256 KB |
Output is correct |
17 |
Correct |
4 ms |
7256 KB |
Output is correct |
18 |
Correct |
4 ms |
7256 KB |
Output is correct |
19 |
Correct |
4 ms |
7256 KB |
Output is correct |
20 |
Correct |
4 ms |
7256 KB |
Output is correct |
21 |
Correct |
5 ms |
7256 KB |
Output is correct |
22 |
Correct |
4 ms |
7520 KB |
Output is correct |
23 |
Correct |
4 ms |
7512 KB |
Output is correct |
24 |
Correct |
5 ms |
7512 KB |
Output is correct |
25 |
Correct |
5 ms |
8536 KB |
Output is correct |
26 |
Correct |
5 ms |
7512 KB |
Output is correct |
27 |
Correct |
5 ms |
7512 KB |
Output is correct |
28 |
Correct |
4 ms |
7256 KB |
Output is correct |
29 |
Correct |
5 ms |
7512 KB |
Output is correct |
30 |
Correct |
15 ms |
8536 KB |
Output is correct |
31 |
Correct |
7 ms |
8024 KB |
Output is correct |
32 |
Correct |
16 ms |
8792 KB |
Output is correct |
33 |
Correct |
16 ms |
9016 KB |
Output is correct |
34 |
Correct |
451 ms |
8820 KB |
Output is correct |
35 |
Correct |
164 ms |
8792 KB |
Output is correct |
36 |
Correct |
27 ms |
9364 KB |
Output is correct |
37 |
Correct |
22 ms |
9128 KB |
Output is correct |
38 |
Correct |
24 ms |
9012 KB |
Output is correct |
39 |
Correct |
28 ms |
8916 KB |
Output is correct |
40 |
Correct |
369 ms |
8768 KB |
Output is correct |
41 |
Correct |
83 ms |
8536 KB |
Output is correct |
42 |
Correct |
56 ms |
8912 KB |
Output is correct |
43 |
Correct |
27 ms |
10072 KB |
Output is correct |
44 |
Correct |
114 ms |
9048 KB |
Output is correct |
45 |
Correct |
148 ms |
15112 KB |
Output is correct |
46 |
Correct |
8 ms |
8792 KB |
Output is correct |
47 |
Correct |
6 ms |
8792 KB |
Output is correct |
48 |
Correct |
173 ms |
18692 KB |
Output is correct |
49 |
Correct |
147 ms |
18780 KB |
Output is correct |
50 |
Execution timed out |
4088 ms |
13588 KB |
Time limit exceeded |
51 |
Halted |
0 ms |
0 KB |
- |