//by szh
#include<bits/stdc++.h>
using namespace std;
#define fi first.first
#define se first.second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x<<endl
#define pq priority_queue
#define inf 0x3f
#define rep(i,a,b) for (int i=a;i<(b);i++)
#define MP make_pair
#define SZ(x) (int(x.size()))
#define ll long long
#define mod 1000000007
#define ALL(x) x.begin(),x.end()
void inc(int &a,int b) {a=(a+b)%mod;}
void dec(int &a,int b) {a=(a-b+mod)%mod;}
int lowbit(int x) {return x&(-x);}
ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;}
#include "parks.h"
int id[5][200010];
int construct_roads(std::vector<int> x, std::vector<int> y) {
memset(id,-1,sizeof(id));
rep(i,0,SZ(x)) {
id[x[i]][y[i]]= i;
}
vector <int> u,v,a,b;
rep(i,0,200010) {
if (id[2][i]!=-1) {
if (i>=2 and id[2][i-2]!=-1) u.pb(id[2][i]),v.pb(id[2][i-2]),a.pb(1),b.pb(i-1);
}
if (id[4][i]!=-1) {
if (i>=2 and id[4][i-2]!=-1) u.pb(id[4][i]),v.pb(id[4][i-2]),a.pb(5),b.pb(i-1);
if (id[2][i]!=-1) u.pb(id[4][i]),v.pb(id[2][i]),a.pb(3),b.pb(i-1);
}
}
if (SZ(u)!=SZ(x)-1) return 0;
build(u,v,a,b);
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4180 KB |
Output is correct |
2 |
Correct |
3 ms |
4180 KB |
Output is correct |
3 |
Correct |
3 ms |
4180 KB |
Output is correct |
4 |
Correct |
2 ms |
4180 KB |
Output is correct |
5 |
Correct |
3 ms |
4152 KB |
Output is correct |
6 |
Correct |
2 ms |
4180 KB |
Output is correct |
7 |
Correct |
2 ms |
4180 KB |
Output is correct |
8 |
Correct |
3 ms |
4180 KB |
Output is correct |
9 |
Correct |
50 ms |
11384 KB |
Output is correct |
10 |
Correct |
7 ms |
5076 KB |
Output is correct |
11 |
Correct |
29 ms |
8080 KB |
Output is correct |
12 |
Correct |
10 ms |
5528 KB |
Output is correct |
13 |
Correct |
9 ms |
6152 KB |
Output is correct |
14 |
Correct |
3 ms |
4180 KB |
Output is correct |
15 |
Correct |
3 ms |
4292 KB |
Output is correct |
16 |
Correct |
64 ms |
11448 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4180 KB |
Output is correct |
2 |
Correct |
3 ms |
4180 KB |
Output is correct |
3 |
Correct |
3 ms |
4180 KB |
Output is correct |
4 |
Correct |
2 ms |
4180 KB |
Output is correct |
5 |
Correct |
3 ms |
4152 KB |
Output is correct |
6 |
Correct |
2 ms |
4180 KB |
Output is correct |
7 |
Correct |
2 ms |
4180 KB |
Output is correct |
8 |
Correct |
3 ms |
4180 KB |
Output is correct |
9 |
Correct |
50 ms |
11384 KB |
Output is correct |
10 |
Correct |
7 ms |
5076 KB |
Output is correct |
11 |
Correct |
29 ms |
8080 KB |
Output is correct |
12 |
Correct |
10 ms |
5528 KB |
Output is correct |
13 |
Correct |
9 ms |
6152 KB |
Output is correct |
14 |
Correct |
3 ms |
4180 KB |
Output is correct |
15 |
Correct |
3 ms |
4292 KB |
Output is correct |
16 |
Correct |
64 ms |
11448 KB |
Output is correct |
17 |
Incorrect |
3 ms |
4180 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4180 KB |
Output is correct |
2 |
Correct |
3 ms |
4180 KB |
Output is correct |
3 |
Correct |
3 ms |
4180 KB |
Output is correct |
4 |
Correct |
2 ms |
4180 KB |
Output is correct |
5 |
Correct |
3 ms |
4152 KB |
Output is correct |
6 |
Correct |
2 ms |
4180 KB |
Output is correct |
7 |
Correct |
2 ms |
4180 KB |
Output is correct |
8 |
Correct |
3 ms |
4180 KB |
Output is correct |
9 |
Correct |
50 ms |
11384 KB |
Output is correct |
10 |
Correct |
7 ms |
5076 KB |
Output is correct |
11 |
Correct |
29 ms |
8080 KB |
Output is correct |
12 |
Correct |
10 ms |
5528 KB |
Output is correct |
13 |
Correct |
9 ms |
6152 KB |
Output is correct |
14 |
Correct |
3 ms |
4180 KB |
Output is correct |
15 |
Correct |
3 ms |
4292 KB |
Output is correct |
16 |
Correct |
64 ms |
11448 KB |
Output is correct |
17 |
Incorrect |
3 ms |
4180 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4180 KB |
Output is correct |
2 |
Correct |
3 ms |
4180 KB |
Output is correct |
3 |
Correct |
3 ms |
4180 KB |
Output is correct |
4 |
Correct |
2 ms |
4180 KB |
Output is correct |
5 |
Correct |
3 ms |
4152 KB |
Output is correct |
6 |
Correct |
2 ms |
4180 KB |
Output is correct |
7 |
Correct |
2 ms |
4180 KB |
Output is correct |
8 |
Correct |
3 ms |
4180 KB |
Output is correct |
9 |
Correct |
50 ms |
11384 KB |
Output is correct |
10 |
Correct |
7 ms |
5076 KB |
Output is correct |
11 |
Correct |
29 ms |
8080 KB |
Output is correct |
12 |
Correct |
10 ms |
5528 KB |
Output is correct |
13 |
Correct |
9 ms |
6152 KB |
Output is correct |
14 |
Correct |
3 ms |
4180 KB |
Output is correct |
15 |
Correct |
3 ms |
4292 KB |
Output is correct |
16 |
Correct |
64 ms |
11448 KB |
Output is correct |
17 |
Runtime error |
5 ms |
8276 KB |
Execution killed with signal 11 |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4180 KB |
Output is correct |
2 |
Correct |
3 ms |
4180 KB |
Output is correct |
3 |
Correct |
3 ms |
4180 KB |
Output is correct |
4 |
Correct |
2 ms |
4180 KB |
Output is correct |
5 |
Correct |
3 ms |
4152 KB |
Output is correct |
6 |
Correct |
2 ms |
4180 KB |
Output is correct |
7 |
Correct |
2 ms |
4180 KB |
Output is correct |
8 |
Correct |
3 ms |
4180 KB |
Output is correct |
9 |
Correct |
50 ms |
11384 KB |
Output is correct |
10 |
Correct |
7 ms |
5076 KB |
Output is correct |
11 |
Correct |
29 ms |
8080 KB |
Output is correct |
12 |
Correct |
10 ms |
5528 KB |
Output is correct |
13 |
Correct |
9 ms |
6152 KB |
Output is correct |
14 |
Correct |
3 ms |
4180 KB |
Output is correct |
15 |
Correct |
3 ms |
4292 KB |
Output is correct |
16 |
Correct |
64 ms |
11448 KB |
Output is correct |
17 |
Runtime error |
45 ms |
16676 KB |
Execution killed with signal 11 |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4180 KB |
Output is correct |
2 |
Correct |
3 ms |
4180 KB |
Output is correct |
3 |
Correct |
3 ms |
4180 KB |
Output is correct |
4 |
Correct |
2 ms |
4180 KB |
Output is correct |
5 |
Correct |
3 ms |
4152 KB |
Output is correct |
6 |
Correct |
2 ms |
4180 KB |
Output is correct |
7 |
Correct |
2 ms |
4180 KB |
Output is correct |
8 |
Correct |
3 ms |
4180 KB |
Output is correct |
9 |
Correct |
50 ms |
11384 KB |
Output is correct |
10 |
Correct |
7 ms |
5076 KB |
Output is correct |
11 |
Correct |
29 ms |
8080 KB |
Output is correct |
12 |
Correct |
10 ms |
5528 KB |
Output is correct |
13 |
Correct |
9 ms |
6152 KB |
Output is correct |
14 |
Correct |
3 ms |
4180 KB |
Output is correct |
15 |
Correct |
3 ms |
4292 KB |
Output is correct |
16 |
Correct |
64 ms |
11448 KB |
Output is correct |
17 |
Incorrect |
3 ms |
4180 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |