#include "parks.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define REP(i,a,b) for(ll i=(ll) a; i<(ll) b; i++)
#define pb push_back
#define mp make_pair
#define pl pair<ll,ll>
#define ff first
#define ss second
#define whole(x) x.begin(),x.end()
#define DEBUG(i) cout<<"DEBUG "<<i<<endl
#define INF 500000000LL
#define EPS 0.00000001
#define pi 3.14159
ll mod=1000000007LL;
int construct_roads(std::vector<int> ax, std::vector<int> ay) {
int n = ax.size();
std::vector<int> u, v, a, b;
int grd[3][100007];
memset(grd, 0, sizeof grd);
for(int i = 0; i < n; i++){
grd[ax[i]/2][ay[i]/2] = i+1;
grd[0][ay[i]/2] += 1<<(ax[i]/2 - 1);
}
bool grp = false;
for(int y = 1; y < 100007; y++){
if(grd[0][y] && !grd[0][y-1] && grp)
return 0;
if(!grd[0][y])
continue;
grp = true;
if(grd[1][y] && grd[1][y-1]){
u.pb(grd[1][y]-1);
v.pb(grd[1][y-1]-1);
a.pb(1);
b.pb(2*y-1);
}
if(grd[2][y] && grd[2][y-1]){
u.pb(grd[2][y]-1);
v.pb(grd[2][y-1]-1);
a.pb(5);
b.pb(2*y-1);
}
if(grd[1][y] && grd[2][y]){
u.pb(grd[1][y]-1);
v.pb(grd[2][y]-1);
a.pb(3);
b.pb(2*y-1);
}
if(grd[0][y] == 1 && grd[0][y-1] == 2)
return 0;
if(grd[0][y] == 2 && grd[0][y-1] == 1)
return 0;
}
build(u, v, a, b);
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1348 KB |
Output is correct |
2 |
Correct |
2 ms |
1484 KB |
Output is correct |
3 |
Correct |
1 ms |
1356 KB |
Output is correct |
4 |
Correct |
1 ms |
1436 KB |
Output is correct |
5 |
Correct |
2 ms |
1356 KB |
Output is correct |
6 |
Correct |
1 ms |
1356 KB |
Output is correct |
7 |
Correct |
1 ms |
1444 KB |
Output is correct |
8 |
Correct |
1 ms |
1444 KB |
Output is correct |
9 |
Correct |
51 ms |
7848 KB |
Output is correct |
10 |
Correct |
6 ms |
2252 KB |
Output is correct |
11 |
Correct |
29 ms |
4932 KB |
Output is correct |
12 |
Correct |
8 ms |
2604 KB |
Output is correct |
13 |
Correct |
8 ms |
2844 KB |
Output is correct |
14 |
Correct |
1 ms |
1484 KB |
Output is correct |
15 |
Correct |
1 ms |
1456 KB |
Output is correct |
16 |
Correct |
72 ms |
7864 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1348 KB |
Output is correct |
2 |
Correct |
2 ms |
1484 KB |
Output is correct |
3 |
Correct |
1 ms |
1356 KB |
Output is correct |
4 |
Correct |
1 ms |
1436 KB |
Output is correct |
5 |
Correct |
2 ms |
1356 KB |
Output is correct |
6 |
Correct |
1 ms |
1356 KB |
Output is correct |
7 |
Correct |
1 ms |
1444 KB |
Output is correct |
8 |
Correct |
1 ms |
1444 KB |
Output is correct |
9 |
Correct |
51 ms |
7848 KB |
Output is correct |
10 |
Correct |
6 ms |
2252 KB |
Output is correct |
11 |
Correct |
29 ms |
4932 KB |
Output is correct |
12 |
Correct |
8 ms |
2604 KB |
Output is correct |
13 |
Correct |
8 ms |
2844 KB |
Output is correct |
14 |
Correct |
1 ms |
1484 KB |
Output is correct |
15 |
Correct |
1 ms |
1456 KB |
Output is correct |
16 |
Correct |
72 ms |
7864 KB |
Output is correct |
17 |
Correct |
1 ms |
1444 KB |
Output is correct |
18 |
Correct |
1 ms |
1420 KB |
Output is correct |
19 |
Correct |
1 ms |
1356 KB |
Output is correct |
20 |
Correct |
1 ms |
1356 KB |
Output is correct |
21 |
Correct |
1 ms |
1484 KB |
Output is correct |
22 |
Correct |
1 ms |
1356 KB |
Output is correct |
23 |
Correct |
167 ms |
18836 KB |
Output is correct |
24 |
Correct |
1 ms |
1348 KB |
Output is correct |
25 |
Correct |
2 ms |
1576 KB |
Output is correct |
26 |
Correct |
2 ms |
1464 KB |
Output is correct |
27 |
Correct |
3 ms |
1480 KB |
Output is correct |
28 |
Correct |
56 ms |
8460 KB |
Output is correct |
29 |
Correct |
75 ms |
11956 KB |
Output is correct |
30 |
Correct |
103 ms |
15388 KB |
Output is correct |
31 |
Correct |
137 ms |
18952 KB |
Output is correct |
32 |
Correct |
1 ms |
1432 KB |
Output is correct |
33 |
Correct |
1 ms |
1356 KB |
Output is correct |
34 |
Correct |
1 ms |
1356 KB |
Output is correct |
35 |
Correct |
1 ms |
1356 KB |
Output is correct |
36 |
Correct |
1 ms |
1356 KB |
Output is correct |
37 |
Correct |
1 ms |
1356 KB |
Output is correct |
38 |
Correct |
1 ms |
1448 KB |
Output is correct |
39 |
Correct |
1 ms |
1356 KB |
Output is correct |
40 |
Correct |
1 ms |
1440 KB |
Output is correct |
41 |
Correct |
1 ms |
1356 KB |
Output is correct |
42 |
Correct |
2 ms |
1356 KB |
Output is correct |
43 |
Correct |
2 ms |
1484 KB |
Output is correct |
44 |
Correct |
1 ms |
1484 KB |
Output is correct |
45 |
Correct |
51 ms |
7960 KB |
Output is correct |
46 |
Correct |
71 ms |
11804 KB |
Output is correct |
47 |
Correct |
73 ms |
11908 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1348 KB |
Output is correct |
2 |
Correct |
2 ms |
1484 KB |
Output is correct |
3 |
Correct |
1 ms |
1356 KB |
Output is correct |
4 |
Correct |
1 ms |
1436 KB |
Output is correct |
5 |
Correct |
2 ms |
1356 KB |
Output is correct |
6 |
Correct |
1 ms |
1356 KB |
Output is correct |
7 |
Correct |
1 ms |
1444 KB |
Output is correct |
8 |
Correct |
1 ms |
1444 KB |
Output is correct |
9 |
Correct |
51 ms |
7848 KB |
Output is correct |
10 |
Correct |
6 ms |
2252 KB |
Output is correct |
11 |
Correct |
29 ms |
4932 KB |
Output is correct |
12 |
Correct |
8 ms |
2604 KB |
Output is correct |
13 |
Correct |
8 ms |
2844 KB |
Output is correct |
14 |
Correct |
1 ms |
1484 KB |
Output is correct |
15 |
Correct |
1 ms |
1456 KB |
Output is correct |
16 |
Correct |
72 ms |
7864 KB |
Output is correct |
17 |
Correct |
1 ms |
1444 KB |
Output is correct |
18 |
Correct |
1 ms |
1420 KB |
Output is correct |
19 |
Correct |
1 ms |
1356 KB |
Output is correct |
20 |
Correct |
1 ms |
1356 KB |
Output is correct |
21 |
Correct |
1 ms |
1484 KB |
Output is correct |
22 |
Correct |
1 ms |
1356 KB |
Output is correct |
23 |
Correct |
167 ms |
18836 KB |
Output is correct |
24 |
Correct |
1 ms |
1348 KB |
Output is correct |
25 |
Correct |
2 ms |
1576 KB |
Output is correct |
26 |
Correct |
2 ms |
1464 KB |
Output is correct |
27 |
Correct |
3 ms |
1480 KB |
Output is correct |
28 |
Correct |
56 ms |
8460 KB |
Output is correct |
29 |
Correct |
75 ms |
11956 KB |
Output is correct |
30 |
Correct |
103 ms |
15388 KB |
Output is correct |
31 |
Correct |
137 ms |
18952 KB |
Output is correct |
32 |
Correct |
1 ms |
1432 KB |
Output is correct |
33 |
Correct |
1 ms |
1356 KB |
Output is correct |
34 |
Correct |
1 ms |
1356 KB |
Output is correct |
35 |
Correct |
1 ms |
1356 KB |
Output is correct |
36 |
Correct |
1 ms |
1356 KB |
Output is correct |
37 |
Correct |
1 ms |
1356 KB |
Output is correct |
38 |
Correct |
1 ms |
1448 KB |
Output is correct |
39 |
Correct |
1 ms |
1356 KB |
Output is correct |
40 |
Correct |
1 ms |
1440 KB |
Output is correct |
41 |
Correct |
1 ms |
1356 KB |
Output is correct |
42 |
Correct |
2 ms |
1356 KB |
Output is correct |
43 |
Correct |
2 ms |
1484 KB |
Output is correct |
44 |
Correct |
1 ms |
1484 KB |
Output is correct |
45 |
Correct |
51 ms |
7960 KB |
Output is correct |
46 |
Correct |
71 ms |
11804 KB |
Output is correct |
47 |
Correct |
73 ms |
11908 KB |
Output is correct |
48 |
Runtime error |
2 ms |
2724 KB |
Execution killed with signal 6 |
49 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1348 KB |
Output is correct |
2 |
Correct |
2 ms |
1484 KB |
Output is correct |
3 |
Correct |
1 ms |
1356 KB |
Output is correct |
4 |
Correct |
1 ms |
1436 KB |
Output is correct |
5 |
Correct |
2 ms |
1356 KB |
Output is correct |
6 |
Correct |
1 ms |
1356 KB |
Output is correct |
7 |
Correct |
1 ms |
1444 KB |
Output is correct |
8 |
Correct |
1 ms |
1444 KB |
Output is correct |
9 |
Correct |
51 ms |
7848 KB |
Output is correct |
10 |
Correct |
6 ms |
2252 KB |
Output is correct |
11 |
Correct |
29 ms |
4932 KB |
Output is correct |
12 |
Correct |
8 ms |
2604 KB |
Output is correct |
13 |
Correct |
8 ms |
2844 KB |
Output is correct |
14 |
Correct |
1 ms |
1484 KB |
Output is correct |
15 |
Correct |
1 ms |
1456 KB |
Output is correct |
16 |
Correct |
72 ms |
7864 KB |
Output is correct |
17 |
Runtime error |
2 ms |
2764 KB |
Execution killed with signal 7 |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1348 KB |
Output is correct |
2 |
Correct |
2 ms |
1484 KB |
Output is correct |
3 |
Correct |
1 ms |
1356 KB |
Output is correct |
4 |
Correct |
1 ms |
1436 KB |
Output is correct |
5 |
Correct |
2 ms |
1356 KB |
Output is correct |
6 |
Correct |
1 ms |
1356 KB |
Output is correct |
7 |
Correct |
1 ms |
1444 KB |
Output is correct |
8 |
Correct |
1 ms |
1444 KB |
Output is correct |
9 |
Correct |
51 ms |
7848 KB |
Output is correct |
10 |
Correct |
6 ms |
2252 KB |
Output is correct |
11 |
Correct |
29 ms |
4932 KB |
Output is correct |
12 |
Correct |
8 ms |
2604 KB |
Output is correct |
13 |
Correct |
8 ms |
2844 KB |
Output is correct |
14 |
Correct |
1 ms |
1484 KB |
Output is correct |
15 |
Correct |
1 ms |
1456 KB |
Output is correct |
16 |
Correct |
72 ms |
7864 KB |
Output is correct |
17 |
Runtime error |
42 ms |
9180 KB |
Execution killed with signal 7 |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1348 KB |
Output is correct |
2 |
Correct |
2 ms |
1484 KB |
Output is correct |
3 |
Correct |
1 ms |
1356 KB |
Output is correct |
4 |
Correct |
1 ms |
1436 KB |
Output is correct |
5 |
Correct |
2 ms |
1356 KB |
Output is correct |
6 |
Correct |
1 ms |
1356 KB |
Output is correct |
7 |
Correct |
1 ms |
1444 KB |
Output is correct |
8 |
Correct |
1 ms |
1444 KB |
Output is correct |
9 |
Correct |
51 ms |
7848 KB |
Output is correct |
10 |
Correct |
6 ms |
2252 KB |
Output is correct |
11 |
Correct |
29 ms |
4932 KB |
Output is correct |
12 |
Correct |
8 ms |
2604 KB |
Output is correct |
13 |
Correct |
8 ms |
2844 KB |
Output is correct |
14 |
Correct |
1 ms |
1484 KB |
Output is correct |
15 |
Correct |
1 ms |
1456 KB |
Output is correct |
16 |
Correct |
72 ms |
7864 KB |
Output is correct |
17 |
Correct |
1 ms |
1444 KB |
Output is correct |
18 |
Correct |
1 ms |
1420 KB |
Output is correct |
19 |
Correct |
1 ms |
1356 KB |
Output is correct |
20 |
Correct |
1 ms |
1356 KB |
Output is correct |
21 |
Correct |
1 ms |
1484 KB |
Output is correct |
22 |
Correct |
1 ms |
1356 KB |
Output is correct |
23 |
Correct |
167 ms |
18836 KB |
Output is correct |
24 |
Correct |
1 ms |
1348 KB |
Output is correct |
25 |
Correct |
2 ms |
1576 KB |
Output is correct |
26 |
Correct |
2 ms |
1464 KB |
Output is correct |
27 |
Correct |
3 ms |
1480 KB |
Output is correct |
28 |
Correct |
56 ms |
8460 KB |
Output is correct |
29 |
Correct |
75 ms |
11956 KB |
Output is correct |
30 |
Correct |
103 ms |
15388 KB |
Output is correct |
31 |
Correct |
137 ms |
18952 KB |
Output is correct |
32 |
Correct |
1 ms |
1432 KB |
Output is correct |
33 |
Correct |
1 ms |
1356 KB |
Output is correct |
34 |
Correct |
1 ms |
1356 KB |
Output is correct |
35 |
Correct |
1 ms |
1356 KB |
Output is correct |
36 |
Correct |
1 ms |
1356 KB |
Output is correct |
37 |
Correct |
1 ms |
1356 KB |
Output is correct |
38 |
Correct |
1 ms |
1448 KB |
Output is correct |
39 |
Correct |
1 ms |
1356 KB |
Output is correct |
40 |
Correct |
1 ms |
1440 KB |
Output is correct |
41 |
Correct |
1 ms |
1356 KB |
Output is correct |
42 |
Correct |
2 ms |
1356 KB |
Output is correct |
43 |
Correct |
2 ms |
1484 KB |
Output is correct |
44 |
Correct |
1 ms |
1484 KB |
Output is correct |
45 |
Correct |
51 ms |
7960 KB |
Output is correct |
46 |
Correct |
71 ms |
11804 KB |
Output is correct |
47 |
Correct |
73 ms |
11908 KB |
Output is correct |
48 |
Runtime error |
2 ms |
2724 KB |
Execution killed with signal 6 |
49 |
Halted |
0 ms |
0 KB |
- |