/*
Mayoeba Yabureru
*/
#include "parks.h"
#include<bits/stdc++.h>
using namespace std;
static vector<int> _u, _v, _a, _b;
int construct_roads(vector<int> x, vector<int> y) {
int n = x.size();
vector<vector<int>> gr(n + 1);
vector<int> dsu(n + 1);
map<pair<int, int>, int> mp;
map<pair<int, int>, pair<int, int>> mpp;
vector<pair<int, int>> vv;
x.insert(x.begin(), 0);
y.insert(y.begin(), 0);
for (int i = 1; i <= n; i ++) {
mp[{x[i], y[i]}] = i;
vv.push_back({x[i], y[i]});
dsu[i] = i;
}
vector<int> u, v, a, b;
map<pair<int, int>, int> taken;
map<pair<int, int>, int> connected;
function<int(int)> fp = [&](int x) {
if (dsu[x] == x) return x;
return dsu[x] = fp(dsu[x]);
};
function cmp = [&] (pair<int, int> a, pair<int, int> b) {
if (a.first + a.second < b.first + b.second) return 1;
return 0;
};
sort(vv.begin(), vv.end(), cmp);
for (int i = 0; i < n; i ++) {
vector nx = {0, 0}, ny = {2, -2};
for (int j = 0; j < 4; j ++) {
auto xx = make_pair(vv[i].first + nx[j], vv[i].second + ny[j]);
if (mp[xx]) {
int fx = fp(mp[vv[i]]), fy = fp(mp[xx]);
if (fx != fy) {
if (vv[i].first < xx.first || vv[i].second < xx.second) {
u.push_back(mp[vv[i]]);
v.push_back(mp[xx]);
}
else {
v.push_back(mp[vv[i]]);
u.push_back(mp[xx]);
}
gr[mp[vv[i]]].push_back(mp[xx]);
gr[mp[xx]].push_back(mp[vv[i]]);
dsu[fx] = fy;
connected[{mp[vv[i]], mp[xx]}] = 1;
connected[{mp[xx], mp[vv[i]]}] = 1;
}
}
}
}
for (int i = 0; i < n; i ++) {
vector nx = {2, -2}, ny = {0, 0};
for (int j = 0; j < 4; j ++) {
auto xx = make_pair(vv[i].first + nx[j], vv[i].second + ny[j]);
if (mp[xx]) {
int fx = fp(mp[vv[i]]), fy = fp(mp[xx]);
if (fx != fy) {
if (vv[i].first < xx.first || vv[i].second < xx.second) {
u.push_back(mp[vv[i]]);
v.push_back(mp[xx]);
}
else {
v.push_back(mp[vv[i]]);
u.push_back(mp[xx]);
}
gr[mp[vv[i]]].push_back(mp[xx]);
gr[mp[xx]].push_back(mp[vv[i]]);
dsu[fx] = fy;
connected[{mp[vv[i]], mp[xx]}] = 1;
connected[{mp[xx], mp[vv[i]]}] = 1;
}
}
}
}
int num = 0, st = 1;
vector<int> vis(n + 1);
function<void(int)> go = [&] (int v) {
num ++;
vis[v] = 1;
vector nx = {0, 2, 0, -2}, ny = {2, 0, -2, 0};
int ii = 0;
for (int i = 0; i < 4; i ++) {
int u = mp[{x[v] + nx[i], y[v] + ny[i]}];
if (u == 0) continue;
if (vis[u]) {
ii = (i + 1) % 4;
break;
}
}
int nummmm = 10;
while (nummmm --) {
int i = ii;
ii = (ii + 1) % 4;
int u = mp[{x[v] + nx[i], y[v] + ny[i]}];
if (u == 0 || vis[u] || connected[{u, v}] == 0) continue;
if (x[v] != x[u]) {
int xx = v, uu = u;
if (x[xx] > x[uu]) {
if (taken[{x[uu] + 1, y[uu] - 1}] == 0) {
mpp[{uu, xx}] = {x[uu] + 1, y[uu] - 1};
taken[{x[uu] + 1, y[uu] - 1}] = 1;
}
else if (taken[{x[uu] + 1, y[uu] + 1}] == 0) {
mpp[{uu, xx}] = {x[uu] + 1, y[uu] + 1};
taken[{x[uu] + 1, y[uu] + 1}] = 1;
}
else assert(0);
}
else {
if (taken[{x[xx] + 1, y[xx] + 1}] == 0) {
mpp[{xx, uu}] = {x[xx] + 1, y[xx] + 1};
taken[{x[xx] + 1, y[xx] + 1}] = 1;
}
else if (taken[{x[xx] + 1, y[xx] - 1}] == 0) {
mpp[{xx, uu}] = {x[xx] + 1, y[xx] - 1};
taken[{x[xx] + 1, y[xx] - 1}] = 1;
}
else assert(0);
}
}
else {
int xx = v, uu = u;
if (y[xx] > y[uu]) {
if (taken[{x[uu] + 1, y[uu] + 1}] == 0) {
mpp[{uu, xx}] = {x[uu] + 1, y[uu] + 1};
taken[{x[uu] + 1, y[uu] + 1}] = 1;
}
else if (taken[{x[uu] - 1, y[uu] + 1}] == 0) {
mpp[{uu, xx}] = {x[uu] - 1, y[uu] + 1};
taken[{x[uu] - 1, y[uu] + 1}] = 1;
}
else assert(0);
}
else {
if (taken[{x[xx] - 1, y[xx] + 1}] == 0) {
mpp[{xx, uu}] = {x[xx] - 1, y[xx] + 1};
taken[{x[xx] - 1, y[xx] + 1}] = 1;
}
else if (taken[{x[xx] + 1, y[xx] + 1}] == 0) {
mpp[{xx, uu}] = {x[xx] + 1, y[xx] + 1};
taken[{x[xx] + 1, y[xx] + 1}] = 1;
}
else assert(0);
}
}
go(u);
}
};
go(st);
for (int i = 0; i < u.size(); i ++) {
a.push_back(mpp[{u[i], v[i]}].first);
b.push_back(mpp[{u[i], v[i]}].second);
u[i] --;
v[i] --;
}
if (num == n) {
build(u, v, a, b);
return 1;
}
return 0;
}
Compilation message
parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:161:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
161 | for (int i = 0; i < u.size(); i ++) {
| ~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
844 ms |
98092 KB |
Output is correct |
10 |
Correct |
46 ms |
10576 KB |
Output is correct |
11 |
Correct |
343 ms |
55628 KB |
Output is correct |
12 |
Correct |
70 ms |
15696 KB |
Output is correct |
13 |
Correct |
214 ms |
36496 KB |
Output is correct |
14 |
Correct |
3 ms |
856 KB |
Output is correct |
15 |
Correct |
8 ms |
1372 KB |
Output is correct |
16 |
Correct |
859 ms |
81376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
844 ms |
98092 KB |
Output is correct |
10 |
Correct |
46 ms |
10576 KB |
Output is correct |
11 |
Correct |
343 ms |
55628 KB |
Output is correct |
12 |
Correct |
70 ms |
15696 KB |
Output is correct |
13 |
Correct |
214 ms |
36496 KB |
Output is correct |
14 |
Correct |
3 ms |
856 KB |
Output is correct |
15 |
Correct |
8 ms |
1372 KB |
Output is correct |
16 |
Correct |
859 ms |
81376 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
2058 ms |
187712 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
5 ms |
1372 KB |
Output is correct |
26 |
Correct |
15 ms |
2140 KB |
Output is correct |
27 |
Correct |
18 ms |
2392 KB |
Output is correct |
28 |
Correct |
689 ms |
79124 KB |
Output is correct |
29 |
Correct |
1121 ms |
98720 KB |
Output is correct |
30 |
Correct |
1570 ms |
126176 KB |
Output is correct |
31 |
Correct |
1974 ms |
184376 KB |
Output is correct |
32 |
Correct |
1 ms |
348 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
344 KB |
Output is correct |
35 |
Correct |
0 ms |
344 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
38 |
Correct |
0 ms |
348 KB |
Output is correct |
39 |
Correct |
0 ms |
348 KB |
Output is correct |
40 |
Correct |
0 ms |
348 KB |
Output is correct |
41 |
Correct |
0 ms |
348 KB |
Output is correct |
42 |
Correct |
1 ms |
436 KB |
Output is correct |
43 |
Correct |
8 ms |
1472 KB |
Output is correct |
44 |
Correct |
9 ms |
1828 KB |
Output is correct |
45 |
Correct |
884 ms |
81024 KB |
Output is correct |
46 |
Correct |
1269 ms |
119260 KB |
Output is correct |
47 |
Correct |
1332 ms |
116644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
844 ms |
98092 KB |
Output is correct |
10 |
Correct |
46 ms |
10576 KB |
Output is correct |
11 |
Correct |
343 ms |
55628 KB |
Output is correct |
12 |
Correct |
70 ms |
15696 KB |
Output is correct |
13 |
Correct |
214 ms |
36496 KB |
Output is correct |
14 |
Correct |
3 ms |
856 KB |
Output is correct |
15 |
Correct |
8 ms |
1372 KB |
Output is correct |
16 |
Correct |
859 ms |
81376 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
2058 ms |
187712 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
5 ms |
1372 KB |
Output is correct |
26 |
Correct |
15 ms |
2140 KB |
Output is correct |
27 |
Correct |
18 ms |
2392 KB |
Output is correct |
28 |
Correct |
689 ms |
79124 KB |
Output is correct |
29 |
Correct |
1121 ms |
98720 KB |
Output is correct |
30 |
Correct |
1570 ms |
126176 KB |
Output is correct |
31 |
Correct |
1974 ms |
184376 KB |
Output is correct |
32 |
Correct |
1 ms |
348 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
344 KB |
Output is correct |
35 |
Correct |
0 ms |
344 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
38 |
Correct |
0 ms |
348 KB |
Output is correct |
39 |
Correct |
0 ms |
348 KB |
Output is correct |
40 |
Correct |
0 ms |
348 KB |
Output is correct |
41 |
Correct |
0 ms |
348 KB |
Output is correct |
42 |
Correct |
1 ms |
436 KB |
Output is correct |
43 |
Correct |
8 ms |
1472 KB |
Output is correct |
44 |
Correct |
9 ms |
1828 KB |
Output is correct |
45 |
Correct |
884 ms |
81024 KB |
Output is correct |
46 |
Correct |
1269 ms |
119260 KB |
Output is correct |
47 |
Correct |
1332 ms |
116644 KB |
Output is correct |
48 |
Correct |
0 ms |
348 KB |
Output is correct |
49 |
Correct |
0 ms |
348 KB |
Output is correct |
50 |
Correct |
0 ms |
348 KB |
Output is correct |
51 |
Correct |
0 ms |
348 KB |
Output is correct |
52 |
Correct |
1 ms |
348 KB |
Output is correct |
53 |
Correct |
0 ms |
348 KB |
Output is correct |
54 |
Correct |
0 ms |
348 KB |
Output is correct |
55 |
Correct |
2214 ms |
155944 KB |
Output is correct |
56 |
Correct |
0 ms |
348 KB |
Output is correct |
57 |
Correct |
10 ms |
1732 KB |
Output is correct |
58 |
Correct |
35 ms |
5140 KB |
Output is correct |
59 |
Correct |
48 ms |
4944 KB |
Output is correct |
60 |
Correct |
1121 ms |
69952 KB |
Output is correct |
61 |
Correct |
1455 ms |
107860 KB |
Output is correct |
62 |
Correct |
1797 ms |
128896 KB |
Output is correct |
63 |
Correct |
2313 ms |
145928 KB |
Output is correct |
64 |
Correct |
0 ms |
348 KB |
Output is correct |
65 |
Correct |
1 ms |
348 KB |
Output is correct |
66 |
Correct |
0 ms |
348 KB |
Output is correct |
67 |
Correct |
2050 ms |
167520 KB |
Output is correct |
68 |
Correct |
2214 ms |
174704 KB |
Output is correct |
69 |
Correct |
2097 ms |
183304 KB |
Output is correct |
70 |
Correct |
20 ms |
2492 KB |
Output is correct |
71 |
Correct |
31 ms |
4444 KB |
Output is correct |
72 |
Correct |
959 ms |
66828 KB |
Output is correct |
73 |
Correct |
1621 ms |
108068 KB |
Output is correct |
74 |
Correct |
2240 ms |
133204 KB |
Output is correct |
75 |
Correct |
2021 ms |
142796 KB |
Output is correct |
76 |
Correct |
1846 ms |
182828 KB |
Output is correct |
77 |
Correct |
27 ms |
3156 KB |
Output is correct |
78 |
Correct |
37 ms |
5204 KB |
Output is correct |
79 |
Correct |
868 ms |
68416 KB |
Output is correct |
80 |
Correct |
1383 ms |
105912 KB |
Output is correct |
81 |
Correct |
2125 ms |
139936 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
844 ms |
98092 KB |
Output is correct |
10 |
Correct |
46 ms |
10576 KB |
Output is correct |
11 |
Correct |
343 ms |
55628 KB |
Output is correct |
12 |
Correct |
70 ms |
15696 KB |
Output is correct |
13 |
Correct |
214 ms |
36496 KB |
Output is correct |
14 |
Correct |
3 ms |
856 KB |
Output is correct |
15 |
Correct |
8 ms |
1372 KB |
Output is correct |
16 |
Correct |
859 ms |
81376 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
2375 ms |
190692 KB |
Output is correct |
21 |
Correct |
1953 ms |
174124 KB |
Output is correct |
22 |
Correct |
2364 ms |
163972 KB |
Output is correct |
23 |
Correct |
1595 ms |
147204 KB |
Output is correct |
24 |
Correct |
766 ms |
50728 KB |
Output is correct |
25 |
Correct |
1544 ms |
85040 KB |
Output is correct |
26 |
Correct |
1567 ms |
85036 KB |
Output is correct |
27 |
Correct |
2201 ms |
104900 KB |
Output is correct |
28 |
Correct |
2111 ms |
104868 KB |
Output is correct |
29 |
Correct |
2689 ms |
104976 KB |
Output is correct |
30 |
Correct |
2478 ms |
104952 KB |
Output is correct |
31 |
Correct |
1 ms |
344 KB |
Output is correct |
32 |
Correct |
107 ms |
10176 KB |
Output is correct |
33 |
Correct |
177 ms |
25916 KB |
Output is correct |
34 |
Correct |
1833 ms |
172048 KB |
Output is correct |
35 |
Correct |
48 ms |
4804 KB |
Output is correct |
36 |
Correct |
283 ms |
21420 KB |
Output is correct |
37 |
Correct |
672 ms |
41936 KB |
Output is correct |
38 |
Correct |
714 ms |
41088 KB |
Output is correct |
39 |
Correct |
1140 ms |
56008 KB |
Output is correct |
40 |
Correct |
1564 ms |
70992 KB |
Output is correct |
41 |
Correct |
1881 ms |
85780 KB |
Output is correct |
42 |
Correct |
2471 ms |
101468 KB |
Output is correct |
43 |
Correct |
1 ms |
348 KB |
Output is correct |
44 |
Correct |
0 ms |
360 KB |
Output is correct |
45 |
Correct |
1 ms |
348 KB |
Output is correct |
46 |
Correct |
0 ms |
348 KB |
Output is correct |
47 |
Correct |
0 ms |
348 KB |
Output is correct |
48 |
Correct |
1 ms |
348 KB |
Output is correct |
49 |
Correct |
0 ms |
348 KB |
Output is correct |
50 |
Correct |
0 ms |
344 KB |
Output is correct |
51 |
Correct |
0 ms |
348 KB |
Output is correct |
52 |
Correct |
0 ms |
348 KB |
Output is correct |
53 |
Correct |
0 ms |
344 KB |
Output is correct |
54 |
Correct |
9 ms |
1628 KB |
Output is correct |
55 |
Correct |
11 ms |
1888 KB |
Output is correct |
56 |
Correct |
835 ms |
81212 KB |
Output is correct |
57 |
Correct |
1322 ms |
119260 KB |
Output is correct |
58 |
Correct |
1415 ms |
116784 KB |
Output is correct |
59 |
Correct |
1 ms |
344 KB |
Output is correct |
60 |
Correct |
1 ms |
348 KB |
Output is correct |
61 |
Correct |
1 ms |
348 KB |
Output is correct |
62 |
Correct |
2072 ms |
166508 KB |
Output is correct |
63 |
Correct |
2130 ms |
174712 KB |
Output is correct |
64 |
Correct |
1983 ms |
183336 KB |
Output is correct |
65 |
Correct |
16 ms |
2392 KB |
Output is correct |
66 |
Correct |
34 ms |
4368 KB |
Output is correct |
67 |
Correct |
919 ms |
66904 KB |
Output is correct |
68 |
Correct |
1528 ms |
107956 KB |
Output is correct |
69 |
Correct |
2080 ms |
133400 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
844 ms |
98092 KB |
Output is correct |
10 |
Correct |
46 ms |
10576 KB |
Output is correct |
11 |
Correct |
343 ms |
55628 KB |
Output is correct |
12 |
Correct |
70 ms |
15696 KB |
Output is correct |
13 |
Correct |
214 ms |
36496 KB |
Output is correct |
14 |
Correct |
3 ms |
856 KB |
Output is correct |
15 |
Correct |
8 ms |
1372 KB |
Output is correct |
16 |
Correct |
859 ms |
81376 KB |
Output is correct |
17 |
Correct |
2156 ms |
201052 KB |
Output is correct |
18 |
Correct |
2195 ms |
174636 KB |
Output is correct |
19 |
Correct |
2458 ms |
174728 KB |
Output is correct |
20 |
Correct |
2448 ms |
98648 KB |
Output is correct |
21 |
Correct |
2158 ms |
97076 KB |
Output is correct |
22 |
Correct |
1 ms |
344 KB |
Output is correct |
23 |
Correct |
240 ms |
17672 KB |
Output is correct |
24 |
Correct |
110 ms |
9164 KB |
Output is correct |
25 |
Correct |
419 ms |
29476 KB |
Output is correct |
26 |
Correct |
760 ms |
49056 KB |
Output is correct |
27 |
Correct |
1088 ms |
51384 KB |
Output is correct |
28 |
Correct |
1415 ms |
64176 KB |
Output is correct |
29 |
Correct |
1772 ms |
76728 KB |
Output is correct |
30 |
Correct |
2142 ms |
89188 KB |
Output is correct |
31 |
Correct |
2538 ms |
102052 KB |
Output is correct |
32 |
Correct |
2302 ms |
142912 KB |
Output is correct |
33 |
Correct |
2100 ms |
182828 KB |
Output is correct |
34 |
Correct |
29 ms |
3160 KB |
Output is correct |
35 |
Correct |
50 ms |
5124 KB |
Output is correct |
36 |
Correct |
990 ms |
68588 KB |
Output is correct |
37 |
Correct |
1494 ms |
105780 KB |
Output is correct |
38 |
Correct |
2066 ms |
140076 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
844 ms |
98092 KB |
Output is correct |
10 |
Correct |
46 ms |
10576 KB |
Output is correct |
11 |
Correct |
343 ms |
55628 KB |
Output is correct |
12 |
Correct |
70 ms |
15696 KB |
Output is correct |
13 |
Correct |
214 ms |
36496 KB |
Output is correct |
14 |
Correct |
3 ms |
856 KB |
Output is correct |
15 |
Correct |
8 ms |
1372 KB |
Output is correct |
16 |
Correct |
859 ms |
81376 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
2058 ms |
187712 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
5 ms |
1372 KB |
Output is correct |
26 |
Correct |
15 ms |
2140 KB |
Output is correct |
27 |
Correct |
18 ms |
2392 KB |
Output is correct |
28 |
Correct |
689 ms |
79124 KB |
Output is correct |
29 |
Correct |
1121 ms |
98720 KB |
Output is correct |
30 |
Correct |
1570 ms |
126176 KB |
Output is correct |
31 |
Correct |
1974 ms |
184376 KB |
Output is correct |
32 |
Correct |
1 ms |
348 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
344 KB |
Output is correct |
35 |
Correct |
0 ms |
344 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
38 |
Correct |
0 ms |
348 KB |
Output is correct |
39 |
Correct |
0 ms |
348 KB |
Output is correct |
40 |
Correct |
0 ms |
348 KB |
Output is correct |
41 |
Correct |
0 ms |
348 KB |
Output is correct |
42 |
Correct |
1 ms |
436 KB |
Output is correct |
43 |
Correct |
8 ms |
1472 KB |
Output is correct |
44 |
Correct |
9 ms |
1828 KB |
Output is correct |
45 |
Correct |
884 ms |
81024 KB |
Output is correct |
46 |
Correct |
1269 ms |
119260 KB |
Output is correct |
47 |
Correct |
1332 ms |
116644 KB |
Output is correct |
48 |
Correct |
0 ms |
348 KB |
Output is correct |
49 |
Correct |
0 ms |
348 KB |
Output is correct |
50 |
Correct |
0 ms |
348 KB |
Output is correct |
51 |
Correct |
0 ms |
348 KB |
Output is correct |
52 |
Correct |
1 ms |
348 KB |
Output is correct |
53 |
Correct |
0 ms |
348 KB |
Output is correct |
54 |
Correct |
0 ms |
348 KB |
Output is correct |
55 |
Correct |
2214 ms |
155944 KB |
Output is correct |
56 |
Correct |
0 ms |
348 KB |
Output is correct |
57 |
Correct |
10 ms |
1732 KB |
Output is correct |
58 |
Correct |
35 ms |
5140 KB |
Output is correct |
59 |
Correct |
48 ms |
4944 KB |
Output is correct |
60 |
Correct |
1121 ms |
69952 KB |
Output is correct |
61 |
Correct |
1455 ms |
107860 KB |
Output is correct |
62 |
Correct |
1797 ms |
128896 KB |
Output is correct |
63 |
Correct |
2313 ms |
145928 KB |
Output is correct |
64 |
Correct |
0 ms |
348 KB |
Output is correct |
65 |
Correct |
1 ms |
348 KB |
Output is correct |
66 |
Correct |
0 ms |
348 KB |
Output is correct |
67 |
Correct |
2050 ms |
167520 KB |
Output is correct |
68 |
Correct |
2214 ms |
174704 KB |
Output is correct |
69 |
Correct |
2097 ms |
183304 KB |
Output is correct |
70 |
Correct |
20 ms |
2492 KB |
Output is correct |
71 |
Correct |
31 ms |
4444 KB |
Output is correct |
72 |
Correct |
959 ms |
66828 KB |
Output is correct |
73 |
Correct |
1621 ms |
108068 KB |
Output is correct |
74 |
Correct |
2240 ms |
133204 KB |
Output is correct |
75 |
Correct |
2021 ms |
142796 KB |
Output is correct |
76 |
Correct |
1846 ms |
182828 KB |
Output is correct |
77 |
Correct |
27 ms |
3156 KB |
Output is correct |
78 |
Correct |
37 ms |
5204 KB |
Output is correct |
79 |
Correct |
868 ms |
68416 KB |
Output is correct |
80 |
Correct |
1383 ms |
105912 KB |
Output is correct |
81 |
Correct |
2125 ms |
139936 KB |
Output is correct |
82 |
Correct |
1 ms |
344 KB |
Output is correct |
83 |
Correct |
0 ms |
348 KB |
Output is correct |
84 |
Correct |
0 ms |
348 KB |
Output is correct |
85 |
Correct |
2375 ms |
190692 KB |
Output is correct |
86 |
Correct |
1953 ms |
174124 KB |
Output is correct |
87 |
Correct |
2364 ms |
163972 KB |
Output is correct |
88 |
Correct |
1595 ms |
147204 KB |
Output is correct |
89 |
Correct |
766 ms |
50728 KB |
Output is correct |
90 |
Correct |
1544 ms |
85040 KB |
Output is correct |
91 |
Correct |
1567 ms |
85036 KB |
Output is correct |
92 |
Correct |
2201 ms |
104900 KB |
Output is correct |
93 |
Correct |
2111 ms |
104868 KB |
Output is correct |
94 |
Correct |
2689 ms |
104976 KB |
Output is correct |
95 |
Correct |
2478 ms |
104952 KB |
Output is correct |
96 |
Correct |
1 ms |
344 KB |
Output is correct |
97 |
Correct |
107 ms |
10176 KB |
Output is correct |
98 |
Correct |
177 ms |
25916 KB |
Output is correct |
99 |
Correct |
1833 ms |
172048 KB |
Output is correct |
100 |
Correct |
48 ms |
4804 KB |
Output is correct |
101 |
Correct |
283 ms |
21420 KB |
Output is correct |
102 |
Correct |
672 ms |
41936 KB |
Output is correct |
103 |
Correct |
714 ms |
41088 KB |
Output is correct |
104 |
Correct |
1140 ms |
56008 KB |
Output is correct |
105 |
Correct |
1564 ms |
70992 KB |
Output is correct |
106 |
Correct |
1881 ms |
85780 KB |
Output is correct |
107 |
Correct |
2471 ms |
101468 KB |
Output is correct |
108 |
Correct |
1 ms |
348 KB |
Output is correct |
109 |
Correct |
0 ms |
360 KB |
Output is correct |
110 |
Correct |
1 ms |
348 KB |
Output is correct |
111 |
Correct |
0 ms |
348 KB |
Output is correct |
112 |
Correct |
0 ms |
348 KB |
Output is correct |
113 |
Correct |
1 ms |
348 KB |
Output is correct |
114 |
Correct |
0 ms |
348 KB |
Output is correct |
115 |
Correct |
0 ms |
344 KB |
Output is correct |
116 |
Correct |
0 ms |
348 KB |
Output is correct |
117 |
Correct |
0 ms |
348 KB |
Output is correct |
118 |
Correct |
0 ms |
344 KB |
Output is correct |
119 |
Correct |
9 ms |
1628 KB |
Output is correct |
120 |
Correct |
11 ms |
1888 KB |
Output is correct |
121 |
Correct |
835 ms |
81212 KB |
Output is correct |
122 |
Correct |
1322 ms |
119260 KB |
Output is correct |
123 |
Correct |
1415 ms |
116784 KB |
Output is correct |
124 |
Correct |
1 ms |
344 KB |
Output is correct |
125 |
Correct |
1 ms |
348 KB |
Output is correct |
126 |
Correct |
1 ms |
348 KB |
Output is correct |
127 |
Correct |
2072 ms |
166508 KB |
Output is correct |
128 |
Correct |
2130 ms |
174712 KB |
Output is correct |
129 |
Correct |
1983 ms |
183336 KB |
Output is correct |
130 |
Correct |
16 ms |
2392 KB |
Output is correct |
131 |
Correct |
34 ms |
4368 KB |
Output is correct |
132 |
Correct |
919 ms |
66904 KB |
Output is correct |
133 |
Correct |
1528 ms |
107956 KB |
Output is correct |
134 |
Correct |
2080 ms |
133400 KB |
Output is correct |
135 |
Correct |
2156 ms |
201052 KB |
Output is correct |
136 |
Correct |
2195 ms |
174636 KB |
Output is correct |
137 |
Correct |
2458 ms |
174728 KB |
Output is correct |
138 |
Correct |
2448 ms |
98648 KB |
Output is correct |
139 |
Correct |
2158 ms |
97076 KB |
Output is correct |
140 |
Correct |
1 ms |
344 KB |
Output is correct |
141 |
Correct |
240 ms |
17672 KB |
Output is correct |
142 |
Correct |
110 ms |
9164 KB |
Output is correct |
143 |
Correct |
419 ms |
29476 KB |
Output is correct |
144 |
Correct |
760 ms |
49056 KB |
Output is correct |
145 |
Correct |
1088 ms |
51384 KB |
Output is correct |
146 |
Correct |
1415 ms |
64176 KB |
Output is correct |
147 |
Correct |
1772 ms |
76728 KB |
Output is correct |
148 |
Correct |
2142 ms |
89188 KB |
Output is correct |
149 |
Correct |
2538 ms |
102052 KB |
Output is correct |
150 |
Correct |
2302 ms |
142912 KB |
Output is correct |
151 |
Correct |
2100 ms |
182828 KB |
Output is correct |
152 |
Correct |
29 ms |
3160 KB |
Output is correct |
153 |
Correct |
50 ms |
5124 KB |
Output is correct |
154 |
Correct |
990 ms |
68588 KB |
Output is correct |
155 |
Correct |
1494 ms |
105780 KB |
Output is correct |
156 |
Correct |
2066 ms |
140076 KB |
Output is correct |
157 |
Correct |
1 ms |
348 KB |
Output is correct |
158 |
Correct |
1 ms |
348 KB |
Output is correct |
159 |
Correct |
0 ms |
348 KB |
Output is correct |
160 |
Correct |
0 ms |
348 KB |
Output is correct |
161 |
Correct |
2583 ms |
105168 KB |
Output is correct |
162 |
Correct |
2126 ms |
163600 KB |
Output is correct |
163 |
Correct |
1909 ms |
135140 KB |
Output is correct |
164 |
Correct |
1848 ms |
132144 KB |
Output is correct |
165 |
Runtime error |
901 ms |
122716 KB |
Execution killed with signal 6 |
166 |
Halted |
0 ms |
0 KB |
- |