#include "bits/stdc++.h"
#include "game.h"
//#define int long long
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
using namespace std;
const int N = 3e5 + 5;
vector<int> v[N],g[N];
int n,k,in[N],out[N];
bool ok=0;
void upd_in(int a,int val){
if(val>=in[a] || ok) return;
in[a]=val;
if(in[a]<out[a]){
ok=1;
return;
}
if(in[a]==out[a] && a>=k){
ok=1;
return;
}
for(int x:g[a]){
upd_in(x,val);
if(ok) return;
}
}
void upd_out(int a,int val){
if(val<=out[a] || ok) return;
out[a]=val;
if(in[a]<out[a]){
ok=1;
return;
}
if(in[a]==out[a] && a>=k){
ok=1;
return;
}
for(int x:v[a]){
upd_out(x,val);
if(ok) return;
}
}
void init(int _n,int _k){
n=_n,k=_k;
fill(in,in+N,k);
fill(out,out+N,-1);
for(int i=0;i<k;i++) in[i]=out[i]=i;
for(int i=0;i<k-1;i++){
v[i].push_back(i+1);
g[i+1].push_back(i);
}
}
int add_teleporter(int a, int b){
v[a].push_back(b);
g[b].push_back(a);
if(in[a]>in[b]) upd_in(a,in[b]);
if(out[a]>out[b]) upd_out(b,out[a]);
if(a==b && a<k) ok=1;
return ok;
}
/*void _(){
cin >> n >> m >> k;
fill(in,in+N,k);
fill(out,out+N,-1);
for(int i=0;i<k;i++) in[i]=out[i]=i;
for(int i=0;i<k-1;i++){
v[i].push_back(i+1);
g[i+1].push_back(i);
}
for(int i=1;i<=m;i++){
int a,b;
cin >> a >> b;
v[a].push_back(b);
g[b].push_back(a);
if(in[a]>in[b]) upd_in(a,in[b]);
if(out[a]>out[b]) upd_out(b,out[a]);
if(a==b && a<k) ok=1;
cout << ok << '\n';
}
}
int32_t main(){
cin.tie(0); ios::sync_with_stdio(0);
int tc=1;//cin >> tc;
while(tc--) _();
return 0;
}*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
16720 KB |
Output is correct |
2 |
Correct |
5 ms |
16720 KB |
Output is correct |
3 |
Correct |
4 ms |
16720 KB |
Output is correct |
4 |
Correct |
5 ms |
16732 KB |
Output is correct |
5 |
Correct |
6 ms |
16720 KB |
Output is correct |
6 |
Correct |
5 ms |
16696 KB |
Output is correct |
7 |
Correct |
5 ms |
16720 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
16720 KB |
Output is correct |
2 |
Correct |
5 ms |
16720 KB |
Output is correct |
3 |
Correct |
4 ms |
16720 KB |
Output is correct |
4 |
Correct |
5 ms |
16732 KB |
Output is correct |
5 |
Correct |
6 ms |
16720 KB |
Output is correct |
6 |
Correct |
5 ms |
16696 KB |
Output is correct |
7 |
Correct |
5 ms |
16720 KB |
Output is correct |
8 |
Correct |
7 ms |
16720 KB |
Output is correct |
9 |
Correct |
5 ms |
16720 KB |
Output is correct |
10 |
Correct |
5 ms |
16720 KB |
Output is correct |
11 |
Correct |
6 ms |
16720 KB |
Output is correct |
12 |
Correct |
5 ms |
16720 KB |
Output is correct |
13 |
Correct |
5 ms |
16720 KB |
Output is correct |
14 |
Correct |
4 ms |
16720 KB |
Output is correct |
15 |
Correct |
7 ms |
16720 KB |
Output is correct |
16 |
Correct |
6 ms |
16720 KB |
Output is correct |
17 |
Correct |
6 ms |
16720 KB |
Output is correct |
18 |
Correct |
4 ms |
16720 KB |
Output is correct |
19 |
Correct |
5 ms |
16720 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
16720 KB |
Output is correct |
2 |
Correct |
5 ms |
16720 KB |
Output is correct |
3 |
Correct |
4 ms |
16720 KB |
Output is correct |
4 |
Correct |
5 ms |
16732 KB |
Output is correct |
5 |
Correct |
6 ms |
16720 KB |
Output is correct |
6 |
Correct |
5 ms |
16696 KB |
Output is correct |
7 |
Correct |
5 ms |
16720 KB |
Output is correct |
8 |
Correct |
7 ms |
16720 KB |
Output is correct |
9 |
Correct |
5 ms |
16720 KB |
Output is correct |
10 |
Correct |
5 ms |
16720 KB |
Output is correct |
11 |
Correct |
6 ms |
16720 KB |
Output is correct |
12 |
Correct |
5 ms |
16720 KB |
Output is correct |
13 |
Correct |
5 ms |
16720 KB |
Output is correct |
14 |
Correct |
4 ms |
16720 KB |
Output is correct |
15 |
Correct |
7 ms |
16720 KB |
Output is correct |
16 |
Correct |
6 ms |
16720 KB |
Output is correct |
17 |
Correct |
6 ms |
16720 KB |
Output is correct |
18 |
Correct |
4 ms |
16720 KB |
Output is correct |
19 |
Correct |
5 ms |
16720 KB |
Output is correct |
20 |
Correct |
5 ms |
16720 KB |
Output is correct |
21 |
Correct |
5 ms |
16720 KB |
Output is correct |
22 |
Correct |
7 ms |
16720 KB |
Output is correct |
23 |
Correct |
6 ms |
16720 KB |
Output is correct |
24 |
Correct |
7 ms |
16720 KB |
Output is correct |
25 |
Correct |
7 ms |
16976 KB |
Output is correct |
26 |
Correct |
13 ms |
16720 KB |
Output is correct |
27 |
Correct |
7 ms |
16976 KB |
Output is correct |
28 |
Correct |
6 ms |
16976 KB |
Output is correct |
29 |
Correct |
6 ms |
16972 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
16720 KB |
Output is correct |
2 |
Correct |
5 ms |
16720 KB |
Output is correct |
3 |
Correct |
4 ms |
16720 KB |
Output is correct |
4 |
Correct |
5 ms |
16732 KB |
Output is correct |
5 |
Correct |
6 ms |
16720 KB |
Output is correct |
6 |
Correct |
5 ms |
16696 KB |
Output is correct |
7 |
Correct |
5 ms |
16720 KB |
Output is correct |
8 |
Correct |
7 ms |
16720 KB |
Output is correct |
9 |
Correct |
5 ms |
16720 KB |
Output is correct |
10 |
Correct |
5 ms |
16720 KB |
Output is correct |
11 |
Correct |
6 ms |
16720 KB |
Output is correct |
12 |
Correct |
5 ms |
16720 KB |
Output is correct |
13 |
Correct |
5 ms |
16720 KB |
Output is correct |
14 |
Correct |
4 ms |
16720 KB |
Output is correct |
15 |
Correct |
7 ms |
16720 KB |
Output is correct |
16 |
Correct |
6 ms |
16720 KB |
Output is correct |
17 |
Correct |
6 ms |
16720 KB |
Output is correct |
18 |
Correct |
4 ms |
16720 KB |
Output is correct |
19 |
Correct |
5 ms |
16720 KB |
Output is correct |
20 |
Correct |
5 ms |
16720 KB |
Output is correct |
21 |
Correct |
5 ms |
16720 KB |
Output is correct |
22 |
Correct |
7 ms |
16720 KB |
Output is correct |
23 |
Correct |
6 ms |
16720 KB |
Output is correct |
24 |
Correct |
7 ms |
16720 KB |
Output is correct |
25 |
Correct |
7 ms |
16976 KB |
Output is correct |
26 |
Correct |
13 ms |
16720 KB |
Output is correct |
27 |
Correct |
7 ms |
16976 KB |
Output is correct |
28 |
Correct |
6 ms |
16976 KB |
Output is correct |
29 |
Correct |
6 ms |
16972 KB |
Output is correct |
30 |
Correct |
15 ms |
18172 KB |
Output is correct |
31 |
Correct |
10 ms |
17232 KB |
Output is correct |
32 |
Correct |
24 ms |
18768 KB |
Output is correct |
33 |
Correct |
23 ms |
18844 KB |
Output is correct |
34 |
Correct |
987 ms |
19536 KB |
Output is correct |
35 |
Correct |
383 ms |
19016 KB |
Output is correct |
36 |
Correct |
33 ms |
18760 KB |
Output is correct |
37 |
Correct |
30 ms |
18764 KB |
Output is correct |
38 |
Correct |
24 ms |
18664 KB |
Output is correct |
39 |
Correct |
24 ms |
18576 KB |
Output is correct |
40 |
Correct |
860 ms |
19508 KB |
Output is correct |
41 |
Correct |
170 ms |
18732 KB |
Output is correct |
42 |
Correct |
116 ms |
18540 KB |
Output is correct |
43 |
Correct |
36 ms |
19272 KB |
Output is correct |
44 |
Correct |
782 ms |
19752 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
16720 KB |
Output is correct |
2 |
Correct |
5 ms |
16720 KB |
Output is correct |
3 |
Correct |
4 ms |
16720 KB |
Output is correct |
4 |
Correct |
5 ms |
16732 KB |
Output is correct |
5 |
Correct |
6 ms |
16720 KB |
Output is correct |
6 |
Correct |
5 ms |
16696 KB |
Output is correct |
7 |
Correct |
5 ms |
16720 KB |
Output is correct |
8 |
Correct |
7 ms |
16720 KB |
Output is correct |
9 |
Correct |
5 ms |
16720 KB |
Output is correct |
10 |
Correct |
5 ms |
16720 KB |
Output is correct |
11 |
Correct |
6 ms |
16720 KB |
Output is correct |
12 |
Correct |
5 ms |
16720 KB |
Output is correct |
13 |
Correct |
5 ms |
16720 KB |
Output is correct |
14 |
Correct |
4 ms |
16720 KB |
Output is correct |
15 |
Correct |
7 ms |
16720 KB |
Output is correct |
16 |
Correct |
6 ms |
16720 KB |
Output is correct |
17 |
Correct |
6 ms |
16720 KB |
Output is correct |
18 |
Correct |
4 ms |
16720 KB |
Output is correct |
19 |
Correct |
5 ms |
16720 KB |
Output is correct |
20 |
Correct |
5 ms |
16720 KB |
Output is correct |
21 |
Correct |
5 ms |
16720 KB |
Output is correct |
22 |
Correct |
7 ms |
16720 KB |
Output is correct |
23 |
Correct |
6 ms |
16720 KB |
Output is correct |
24 |
Correct |
7 ms |
16720 KB |
Output is correct |
25 |
Correct |
7 ms |
16976 KB |
Output is correct |
26 |
Correct |
13 ms |
16720 KB |
Output is correct |
27 |
Correct |
7 ms |
16976 KB |
Output is correct |
28 |
Correct |
6 ms |
16976 KB |
Output is correct |
29 |
Correct |
6 ms |
16972 KB |
Output is correct |
30 |
Correct |
15 ms |
18172 KB |
Output is correct |
31 |
Correct |
10 ms |
17232 KB |
Output is correct |
32 |
Correct |
24 ms |
18768 KB |
Output is correct |
33 |
Correct |
23 ms |
18844 KB |
Output is correct |
34 |
Correct |
987 ms |
19536 KB |
Output is correct |
35 |
Correct |
383 ms |
19016 KB |
Output is correct |
36 |
Correct |
33 ms |
18760 KB |
Output is correct |
37 |
Correct |
30 ms |
18764 KB |
Output is correct |
38 |
Correct |
24 ms |
18664 KB |
Output is correct |
39 |
Correct |
24 ms |
18576 KB |
Output is correct |
40 |
Correct |
860 ms |
19508 KB |
Output is correct |
41 |
Correct |
170 ms |
18732 KB |
Output is correct |
42 |
Correct |
116 ms |
18540 KB |
Output is correct |
43 |
Correct |
36 ms |
19272 KB |
Output is correct |
44 |
Correct |
782 ms |
19752 KB |
Output is correct |
45 |
Correct |
150 ms |
28244 KB |
Output is correct |
46 |
Correct |
6 ms |
17232 KB |
Output is correct |
47 |
Correct |
6 ms |
17232 KB |
Output is correct |
48 |
Correct |
295 ms |
39692 KB |
Output is correct |
49 |
Correct |
228 ms |
35884 KB |
Output is correct |
50 |
Execution timed out |
4075 ms |
40436 KB |
Time limit exceeded |
51 |
Halted |
0 ms |
0 KB |
- |