#include "parks.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
const int dx[] = {-1,0,0,1};
const int dy[] = {0,1,-1,0};
vector<int> AdjList[200005];
ii EdgeList[800005];
ii EdgeList2[800005];
map<ii, int> indx;
map<ii, int> indxEdge;
map<ii, int> indxBench;
vector<int> AdjListBench[800005];
set<int> AdjListRoad[200005];
int degBench[800005];
ii benchXY[800005];
struct UnionFind{
vector<int> p;
vector<int> rank1;
void init(int n){
p.assign(n, 0);
rank1.assign(n, 0);
for(int i = 0; i < n; i ++){
p[i] = i;
rank1[i] = 0;
}
}
int findSet(int i){
return (p[i] == i) ? i : (p[i] = findSet(p[i]));
}
bool isSameSet(int i, int j){
return findSet(i) == findSet(j);
}
void unionSet(int i, int j){
int x = findSet(i);
int y = findSet(j);
if(x != y){
if(rank1[x] > rank1[y]){
p[y] = x;
}else{
p[x] = y;
if(rank1[x] == rank1[y]){
rank1[y] ++;
}
}
}
}
};
int p[200005];
int construct_roads(std::vector<int> x, std::vector<int> y) {
int n = (int)x.size();
if (n == 1) {
build({}, {}, {}, {});
return 1;
}
vector<int> U(n-1);
vector<int> V(n-1);
vector<int> A(n-1);
vector<int> B(n-1);
for(int i = 0; i < n; i ++){
indx[ii(x[i], y[i])] = i;
}
int cnt3 = 0;
for(pair<ii, int> temp: indx){
p[cnt3 ++] = temp.second;
}
int m = 0;
for(int i = 0; i < n; i ++){
int i2 = p[i];
for(int k = 0; k < 4; k ++){
int nx = x[i2] + 2*dx[k];
int ny = y[i2] + 2*dy[k];
if(indx.find(ii(nx, ny)) != indx.end()){
int j = indx[ii(nx, ny)];
EdgeList[m ++] = ii(i2, j);
}
}
}
UnionFind* uf = new UnionFind();
uf->init(n);
int cnt = 0;
for(int i = 0; i < m; i ++){
int u, v;
tie(u, v) = EdgeList[i];
if(!uf->isSameSet(u, v)){
uf->unionSet(u, v);
AdjList[u].push_back(v);
AdjList[v].push_back(u);
EdgeList2[cnt] = ii(u, v);
indxEdge[ii(u, v)] = cnt;
cnt ++;
}
}
if(cnt != n-1){
return 0;
}
int benches = 0;
memset(degBench, 0, sizeof(degBench));
for(int i = 0; i < n-1; i ++){
int u, v;
tie(u, v) = EdgeList2[i];
int x2 = (x[u] + x[v])/2;
int y2 = (y[u] + y[v])/2;
for(int k = 0; k < 4; k ++){
int nx = x2 + dx[k];
int ny = y2 + dy[k];
if(nx%2 == 1 && ny%2 == 1){
int indx2 = benches;
if(indxBench.find(ii(nx, ny)) != indxBench.end()){
indx2 = indxBench[ii(nx, ny)];
}else{
benchXY[benches] = ii(nx, ny);
indxBench[ii(nx, ny)] = benches;
//printf("bench %d; (%d, %d)\n", benches, nx, ny);
benches ++;
}
AdjListBench[indx2].push_back(i);
AdjListRoad[i].insert(indx2);
//printf("road %d; bench %d\n", i, indx2);
degBench[i] ++;
}
}
}
set<ii> s;
for(int i = 0; i < n-1; i ++){
if(degBench[i] > 0){
s.insert(ii(degBench[i], i));
}
}
int cnt2 = 0;
while(!s.empty()){
ii temp = *s.begin();
int indx = temp.second;
int bench = *(AdjListRoad[indx].begin());
//printf("road %d matched to bench %d\n", indx, bench);
tie(U[cnt2], V[cnt2]) = EdgeList2[indx];
tie(A[cnt2], B[cnt2]) = benchXY[bench];
cnt2 ++;
for(int road: AdjListBench[bench]){
//assert(s.count(ii(degBench[road], road)));
s.erase(ii(degBench[road], road));
degBench[road] --;
AdjListRoad[road].erase(bench);
if(degBench[road] > 0 && road != indx){
s.insert(ii(degBench[road], road));
}
}
}
if(cnt2 == n-1){
build(U, V, A, B);
return 1;
}else{
return 0;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
33100 KB |
Output is correct |
2 |
Correct |
25 ms |
36300 KB |
Output is correct |
3 |
Correct |
23 ms |
33160 KB |
Output is correct |
4 |
Correct |
27 ms |
36272 KB |
Output is correct |
5 |
Correct |
22 ms |
36300 KB |
Output is correct |
6 |
Correct |
23 ms |
33100 KB |
Output is correct |
7 |
Correct |
20 ms |
33120 KB |
Output is correct |
8 |
Correct |
21 ms |
33172 KB |
Output is correct |
9 |
Correct |
622 ms |
93088 KB |
Output is correct |
10 |
Correct |
57 ms |
42024 KB |
Output is correct |
11 |
Correct |
223 ms |
66800 KB |
Output is correct |
12 |
Correct |
73 ms |
44876 KB |
Output is correct |
13 |
Correct |
87 ms |
43076 KB |
Output is correct |
14 |
Correct |
22 ms |
33356 KB |
Output is correct |
15 |
Correct |
24 ms |
33560 KB |
Output is correct |
16 |
Correct |
474 ms |
93052 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
33100 KB |
Output is correct |
2 |
Correct |
25 ms |
36300 KB |
Output is correct |
3 |
Correct |
23 ms |
33160 KB |
Output is correct |
4 |
Correct |
27 ms |
36272 KB |
Output is correct |
5 |
Correct |
22 ms |
36300 KB |
Output is correct |
6 |
Correct |
23 ms |
33100 KB |
Output is correct |
7 |
Correct |
20 ms |
33120 KB |
Output is correct |
8 |
Correct |
21 ms |
33172 KB |
Output is correct |
9 |
Correct |
622 ms |
93088 KB |
Output is correct |
10 |
Correct |
57 ms |
42024 KB |
Output is correct |
11 |
Correct |
223 ms |
66800 KB |
Output is correct |
12 |
Correct |
73 ms |
44876 KB |
Output is correct |
13 |
Correct |
87 ms |
43076 KB |
Output is correct |
14 |
Correct |
22 ms |
33356 KB |
Output is correct |
15 |
Correct |
24 ms |
33560 KB |
Output is correct |
16 |
Correct |
474 ms |
93052 KB |
Output is correct |
17 |
Correct |
26 ms |
36276 KB |
Output is correct |
18 |
Correct |
21 ms |
36296 KB |
Output is correct |
19 |
Correct |
24 ms |
36300 KB |
Output is correct |
20 |
Correct |
23 ms |
36320 KB |
Output is correct |
21 |
Correct |
21 ms |
33160 KB |
Output is correct |
22 |
Correct |
21 ms |
36300 KB |
Output is correct |
23 |
Correct |
1189 ms |
131152 KB |
Output is correct |
24 |
Correct |
24 ms |
36264 KB |
Output is correct |
25 |
Correct |
43 ms |
36868 KB |
Output is correct |
26 |
Correct |
25 ms |
33880 KB |
Output is correct |
27 |
Correct |
26 ms |
33996 KB |
Output is correct |
28 |
Correct |
432 ms |
74240 KB |
Output is correct |
29 |
Correct |
654 ms |
93192 KB |
Output is correct |
30 |
Correct |
962 ms |
112072 KB |
Output is correct |
31 |
Correct |
1108 ms |
131060 KB |
Output is correct |
32 |
Correct |
21 ms |
36300 KB |
Output is correct |
33 |
Correct |
23 ms |
36280 KB |
Output is correct |
34 |
Correct |
20 ms |
36300 KB |
Output is correct |
35 |
Correct |
20 ms |
33100 KB |
Output is correct |
36 |
Correct |
21 ms |
33200 KB |
Output is correct |
37 |
Correct |
23 ms |
36324 KB |
Output is correct |
38 |
Correct |
21 ms |
36264 KB |
Output is correct |
39 |
Correct |
24 ms |
36288 KB |
Output is correct |
40 |
Correct |
24 ms |
36252 KB |
Output is correct |
41 |
Correct |
29 ms |
33072 KB |
Output is correct |
42 |
Correct |
22 ms |
36300 KB |
Output is correct |
43 |
Correct |
22 ms |
33612 KB |
Output is correct |
44 |
Correct |
25 ms |
33848 KB |
Output is correct |
45 |
Correct |
486 ms |
86728 KB |
Output is correct |
46 |
Correct |
822 ms |
109544 KB |
Output is correct |
47 |
Correct |
877 ms |
109460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
33100 KB |
Output is correct |
2 |
Correct |
25 ms |
36300 KB |
Output is correct |
3 |
Correct |
23 ms |
33160 KB |
Output is correct |
4 |
Correct |
27 ms |
36272 KB |
Output is correct |
5 |
Correct |
22 ms |
36300 KB |
Output is correct |
6 |
Correct |
23 ms |
33100 KB |
Output is correct |
7 |
Correct |
20 ms |
33120 KB |
Output is correct |
8 |
Correct |
21 ms |
33172 KB |
Output is correct |
9 |
Correct |
622 ms |
93088 KB |
Output is correct |
10 |
Correct |
57 ms |
42024 KB |
Output is correct |
11 |
Correct |
223 ms |
66800 KB |
Output is correct |
12 |
Correct |
73 ms |
44876 KB |
Output is correct |
13 |
Correct |
87 ms |
43076 KB |
Output is correct |
14 |
Correct |
22 ms |
33356 KB |
Output is correct |
15 |
Correct |
24 ms |
33560 KB |
Output is correct |
16 |
Correct |
474 ms |
93052 KB |
Output is correct |
17 |
Correct |
26 ms |
36276 KB |
Output is correct |
18 |
Correct |
21 ms |
36296 KB |
Output is correct |
19 |
Correct |
24 ms |
36300 KB |
Output is correct |
20 |
Correct |
23 ms |
36320 KB |
Output is correct |
21 |
Correct |
21 ms |
33160 KB |
Output is correct |
22 |
Correct |
21 ms |
36300 KB |
Output is correct |
23 |
Correct |
1189 ms |
131152 KB |
Output is correct |
24 |
Correct |
24 ms |
36264 KB |
Output is correct |
25 |
Correct |
43 ms |
36868 KB |
Output is correct |
26 |
Correct |
25 ms |
33880 KB |
Output is correct |
27 |
Correct |
26 ms |
33996 KB |
Output is correct |
28 |
Correct |
432 ms |
74240 KB |
Output is correct |
29 |
Correct |
654 ms |
93192 KB |
Output is correct |
30 |
Correct |
962 ms |
112072 KB |
Output is correct |
31 |
Correct |
1108 ms |
131060 KB |
Output is correct |
32 |
Correct |
21 ms |
36300 KB |
Output is correct |
33 |
Correct |
23 ms |
36280 KB |
Output is correct |
34 |
Correct |
20 ms |
36300 KB |
Output is correct |
35 |
Correct |
20 ms |
33100 KB |
Output is correct |
36 |
Correct |
21 ms |
33200 KB |
Output is correct |
37 |
Correct |
23 ms |
36324 KB |
Output is correct |
38 |
Correct |
21 ms |
36264 KB |
Output is correct |
39 |
Correct |
24 ms |
36288 KB |
Output is correct |
40 |
Correct |
24 ms |
36252 KB |
Output is correct |
41 |
Correct |
29 ms |
33072 KB |
Output is correct |
42 |
Correct |
22 ms |
36300 KB |
Output is correct |
43 |
Correct |
22 ms |
33612 KB |
Output is correct |
44 |
Correct |
25 ms |
33848 KB |
Output is correct |
45 |
Correct |
486 ms |
86728 KB |
Output is correct |
46 |
Correct |
822 ms |
109544 KB |
Output is correct |
47 |
Correct |
877 ms |
109460 KB |
Output is correct |
48 |
Correct |
21 ms |
36340 KB |
Output is correct |
49 |
Correct |
20 ms |
36304 KB |
Output is correct |
50 |
Correct |
23 ms |
36248 KB |
Output is correct |
51 |
Correct |
28 ms |
36268 KB |
Output is correct |
52 |
Correct |
25 ms |
36248 KB |
Output is correct |
53 |
Correct |
22 ms |
36300 KB |
Output is correct |
54 |
Correct |
21 ms |
36300 KB |
Output is correct |
55 |
Correct |
1157 ms |
131544 KB |
Output is correct |
56 |
Correct |
26 ms |
36300 KB |
Output is correct |
57 |
Correct |
36 ms |
37060 KB |
Output is correct |
58 |
Correct |
43 ms |
39224 KB |
Output is correct |
59 |
Correct |
37 ms |
35388 KB |
Output is correct |
60 |
Correct |
552 ms |
87108 KB |
Output is correct |
61 |
Correct |
875 ms |
100576 KB |
Output is correct |
62 |
Correct |
896 ms |
114864 KB |
Output is correct |
63 |
Correct |
1153 ms |
131552 KB |
Output is correct |
64 |
Correct |
23 ms |
33180 KB |
Output is correct |
65 |
Correct |
23 ms |
36292 KB |
Output is correct |
66 |
Correct |
22 ms |
33172 KB |
Output is correct |
67 |
Correct |
1227 ms |
149760 KB |
Output is correct |
68 |
Correct |
1126 ms |
149736 KB |
Output is correct |
69 |
Correct |
1117 ms |
149188 KB |
Output is correct |
70 |
Correct |
30 ms |
33996 KB |
Output is correct |
71 |
Correct |
33 ms |
34908 KB |
Output is correct |
72 |
Correct |
543 ms |
88612 KB |
Output is correct |
73 |
Correct |
780 ms |
114176 KB |
Output is correct |
74 |
Correct |
1264 ms |
140304 KB |
Output is correct |
75 |
Correct |
1268 ms |
138144 KB |
Output is correct |
76 |
Correct |
1070 ms |
149844 KB |
Output is correct |
77 |
Correct |
28 ms |
34252 KB |
Output is correct |
78 |
Correct |
38 ms |
35204 KB |
Output is correct |
79 |
Correct |
583 ms |
88688 KB |
Output is correct |
80 |
Correct |
815 ms |
114924 KB |
Output is correct |
81 |
Correct |
1165 ms |
141092 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
33100 KB |
Output is correct |
2 |
Correct |
25 ms |
36300 KB |
Output is correct |
3 |
Correct |
23 ms |
33160 KB |
Output is correct |
4 |
Correct |
27 ms |
36272 KB |
Output is correct |
5 |
Correct |
22 ms |
36300 KB |
Output is correct |
6 |
Correct |
23 ms |
33100 KB |
Output is correct |
7 |
Correct |
20 ms |
33120 KB |
Output is correct |
8 |
Correct |
21 ms |
33172 KB |
Output is correct |
9 |
Correct |
622 ms |
93088 KB |
Output is correct |
10 |
Correct |
57 ms |
42024 KB |
Output is correct |
11 |
Correct |
223 ms |
66800 KB |
Output is correct |
12 |
Correct |
73 ms |
44876 KB |
Output is correct |
13 |
Correct |
87 ms |
43076 KB |
Output is correct |
14 |
Correct |
22 ms |
33356 KB |
Output is correct |
15 |
Correct |
24 ms |
33560 KB |
Output is correct |
16 |
Correct |
474 ms |
93052 KB |
Output is correct |
17 |
Correct |
22 ms |
36220 KB |
Output is correct |
18 |
Correct |
23 ms |
36240 KB |
Output is correct |
19 |
Correct |
21 ms |
33200 KB |
Output is correct |
20 |
Correct |
955 ms |
129620 KB |
Output is correct |
21 |
Correct |
1106 ms |
129496 KB |
Output is correct |
22 |
Correct |
1036 ms |
129416 KB |
Output is correct |
23 |
Correct |
969 ms |
132804 KB |
Output is correct |
24 |
Correct |
355 ms |
54228 KB |
Output is correct |
25 |
Correct |
640 ms |
77808 KB |
Output is correct |
26 |
Correct |
687 ms |
77820 KB |
Output is correct |
27 |
Correct |
1133 ms |
149716 KB |
Output is correct |
28 |
Correct |
1086 ms |
149836 KB |
Output is correct |
29 |
Correct |
1208 ms |
149696 KB |
Output is correct |
30 |
Correct |
1170 ms |
149824 KB |
Output is correct |
31 |
Correct |
24 ms |
36300 KB |
Output is correct |
32 |
Correct |
72 ms |
43676 KB |
Output is correct |
33 |
Correct |
134 ms |
43704 KB |
Output is correct |
34 |
Correct |
1025 ms |
129612 KB |
Output is correct |
35 |
Correct |
36 ms |
35396 KB |
Output is correct |
36 |
Correct |
124 ms |
44336 KB |
Output is correct |
37 |
Correct |
276 ms |
55480 KB |
Output is correct |
38 |
Correct |
414 ms |
77604 KB |
Output is correct |
39 |
Correct |
581 ms |
93128 KB |
Output is correct |
40 |
Correct |
707 ms |
108560 KB |
Output is correct |
41 |
Correct |
914 ms |
124032 KB |
Output is correct |
42 |
Correct |
1083 ms |
139604 KB |
Output is correct |
43 |
Correct |
28 ms |
36300 KB |
Output is correct |
44 |
Correct |
25 ms |
36300 KB |
Output is correct |
45 |
Correct |
25 ms |
36284 KB |
Output is correct |
46 |
Correct |
22 ms |
33132 KB |
Output is correct |
47 |
Correct |
24 ms |
33116 KB |
Output is correct |
48 |
Correct |
24 ms |
36300 KB |
Output is correct |
49 |
Correct |
23 ms |
36216 KB |
Output is correct |
50 |
Correct |
24 ms |
36300 KB |
Output is correct |
51 |
Correct |
23 ms |
36224 KB |
Output is correct |
52 |
Correct |
20 ms |
33100 KB |
Output is correct |
53 |
Correct |
22 ms |
36268 KB |
Output is correct |
54 |
Correct |
24 ms |
33612 KB |
Output is correct |
55 |
Correct |
27 ms |
33868 KB |
Output is correct |
56 |
Correct |
496 ms |
86696 KB |
Output is correct |
57 |
Correct |
808 ms |
109412 KB |
Output is correct |
58 |
Correct |
764 ms |
109508 KB |
Output is correct |
59 |
Correct |
23 ms |
33096 KB |
Output is correct |
60 |
Correct |
23 ms |
36300 KB |
Output is correct |
61 |
Correct |
21 ms |
33100 KB |
Output is correct |
62 |
Correct |
1116 ms |
149748 KB |
Output is correct |
63 |
Correct |
1078 ms |
149824 KB |
Output is correct |
64 |
Correct |
1189 ms |
149316 KB |
Output is correct |
65 |
Correct |
28 ms |
33996 KB |
Output is correct |
66 |
Correct |
34 ms |
34908 KB |
Output is correct |
67 |
Correct |
535 ms |
88672 KB |
Output is correct |
68 |
Correct |
920 ms |
114116 KB |
Output is correct |
69 |
Correct |
1317 ms |
140344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
33100 KB |
Output is correct |
2 |
Correct |
25 ms |
36300 KB |
Output is correct |
3 |
Correct |
23 ms |
33160 KB |
Output is correct |
4 |
Correct |
27 ms |
36272 KB |
Output is correct |
5 |
Correct |
22 ms |
36300 KB |
Output is correct |
6 |
Correct |
23 ms |
33100 KB |
Output is correct |
7 |
Correct |
20 ms |
33120 KB |
Output is correct |
8 |
Correct |
21 ms |
33172 KB |
Output is correct |
9 |
Correct |
622 ms |
93088 KB |
Output is correct |
10 |
Correct |
57 ms |
42024 KB |
Output is correct |
11 |
Correct |
223 ms |
66800 KB |
Output is correct |
12 |
Correct |
73 ms |
44876 KB |
Output is correct |
13 |
Correct |
87 ms |
43076 KB |
Output is correct |
14 |
Correct |
22 ms |
33356 KB |
Output is correct |
15 |
Correct |
24 ms |
33560 KB |
Output is correct |
16 |
Correct |
474 ms |
93052 KB |
Output is correct |
17 |
Correct |
1154 ms |
149800 KB |
Output is correct |
18 |
Correct |
1132 ms |
149852 KB |
Output is correct |
19 |
Correct |
1049 ms |
129496 KB |
Output is correct |
20 |
Correct |
1086 ms |
135300 KB |
Output is correct |
21 |
Correct |
911 ms |
132072 KB |
Output is correct |
22 |
Correct |
26 ms |
36224 KB |
Output is correct |
23 |
Correct |
140 ms |
52648 KB |
Output is correct |
24 |
Correct |
57 ms |
37600 KB |
Output is correct |
25 |
Correct |
184 ms |
49004 KB |
Output is correct |
26 |
Correct |
354 ms |
60348 KB |
Output is correct |
27 |
Correct |
535 ms |
89284 KB |
Output is correct |
28 |
Correct |
626 ms |
102596 KB |
Output is correct |
29 |
Correct |
872 ms |
115708 KB |
Output is correct |
30 |
Correct |
1153 ms |
129084 KB |
Output is correct |
31 |
Correct |
1259 ms |
142380 KB |
Output is correct |
32 |
Correct |
1187 ms |
138308 KB |
Output is correct |
33 |
Correct |
1180 ms |
149844 KB |
Output is correct |
34 |
Correct |
29 ms |
34252 KB |
Output is correct |
35 |
Correct |
34 ms |
35124 KB |
Output is correct |
36 |
Correct |
568 ms |
88632 KB |
Output is correct |
37 |
Correct |
836 ms |
114924 KB |
Output is correct |
38 |
Correct |
1174 ms |
141024 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
33100 KB |
Output is correct |
2 |
Correct |
25 ms |
36300 KB |
Output is correct |
3 |
Correct |
23 ms |
33160 KB |
Output is correct |
4 |
Correct |
27 ms |
36272 KB |
Output is correct |
5 |
Correct |
22 ms |
36300 KB |
Output is correct |
6 |
Correct |
23 ms |
33100 KB |
Output is correct |
7 |
Correct |
20 ms |
33120 KB |
Output is correct |
8 |
Correct |
21 ms |
33172 KB |
Output is correct |
9 |
Correct |
622 ms |
93088 KB |
Output is correct |
10 |
Correct |
57 ms |
42024 KB |
Output is correct |
11 |
Correct |
223 ms |
66800 KB |
Output is correct |
12 |
Correct |
73 ms |
44876 KB |
Output is correct |
13 |
Correct |
87 ms |
43076 KB |
Output is correct |
14 |
Correct |
22 ms |
33356 KB |
Output is correct |
15 |
Correct |
24 ms |
33560 KB |
Output is correct |
16 |
Correct |
474 ms |
93052 KB |
Output is correct |
17 |
Correct |
26 ms |
36276 KB |
Output is correct |
18 |
Correct |
21 ms |
36296 KB |
Output is correct |
19 |
Correct |
24 ms |
36300 KB |
Output is correct |
20 |
Correct |
23 ms |
36320 KB |
Output is correct |
21 |
Correct |
21 ms |
33160 KB |
Output is correct |
22 |
Correct |
21 ms |
36300 KB |
Output is correct |
23 |
Correct |
1189 ms |
131152 KB |
Output is correct |
24 |
Correct |
24 ms |
36264 KB |
Output is correct |
25 |
Correct |
43 ms |
36868 KB |
Output is correct |
26 |
Correct |
25 ms |
33880 KB |
Output is correct |
27 |
Correct |
26 ms |
33996 KB |
Output is correct |
28 |
Correct |
432 ms |
74240 KB |
Output is correct |
29 |
Correct |
654 ms |
93192 KB |
Output is correct |
30 |
Correct |
962 ms |
112072 KB |
Output is correct |
31 |
Correct |
1108 ms |
131060 KB |
Output is correct |
32 |
Correct |
21 ms |
36300 KB |
Output is correct |
33 |
Correct |
23 ms |
36280 KB |
Output is correct |
34 |
Correct |
20 ms |
36300 KB |
Output is correct |
35 |
Correct |
20 ms |
33100 KB |
Output is correct |
36 |
Correct |
21 ms |
33200 KB |
Output is correct |
37 |
Correct |
23 ms |
36324 KB |
Output is correct |
38 |
Correct |
21 ms |
36264 KB |
Output is correct |
39 |
Correct |
24 ms |
36288 KB |
Output is correct |
40 |
Correct |
24 ms |
36252 KB |
Output is correct |
41 |
Correct |
29 ms |
33072 KB |
Output is correct |
42 |
Correct |
22 ms |
36300 KB |
Output is correct |
43 |
Correct |
22 ms |
33612 KB |
Output is correct |
44 |
Correct |
25 ms |
33848 KB |
Output is correct |
45 |
Correct |
486 ms |
86728 KB |
Output is correct |
46 |
Correct |
822 ms |
109544 KB |
Output is correct |
47 |
Correct |
877 ms |
109460 KB |
Output is correct |
48 |
Correct |
21 ms |
36340 KB |
Output is correct |
49 |
Correct |
20 ms |
36304 KB |
Output is correct |
50 |
Correct |
23 ms |
36248 KB |
Output is correct |
51 |
Correct |
28 ms |
36268 KB |
Output is correct |
52 |
Correct |
25 ms |
36248 KB |
Output is correct |
53 |
Correct |
22 ms |
36300 KB |
Output is correct |
54 |
Correct |
21 ms |
36300 KB |
Output is correct |
55 |
Correct |
1157 ms |
131544 KB |
Output is correct |
56 |
Correct |
26 ms |
36300 KB |
Output is correct |
57 |
Correct |
36 ms |
37060 KB |
Output is correct |
58 |
Correct |
43 ms |
39224 KB |
Output is correct |
59 |
Correct |
37 ms |
35388 KB |
Output is correct |
60 |
Correct |
552 ms |
87108 KB |
Output is correct |
61 |
Correct |
875 ms |
100576 KB |
Output is correct |
62 |
Correct |
896 ms |
114864 KB |
Output is correct |
63 |
Correct |
1153 ms |
131552 KB |
Output is correct |
64 |
Correct |
23 ms |
33180 KB |
Output is correct |
65 |
Correct |
23 ms |
36292 KB |
Output is correct |
66 |
Correct |
22 ms |
33172 KB |
Output is correct |
67 |
Correct |
1227 ms |
149760 KB |
Output is correct |
68 |
Correct |
1126 ms |
149736 KB |
Output is correct |
69 |
Correct |
1117 ms |
149188 KB |
Output is correct |
70 |
Correct |
30 ms |
33996 KB |
Output is correct |
71 |
Correct |
33 ms |
34908 KB |
Output is correct |
72 |
Correct |
543 ms |
88612 KB |
Output is correct |
73 |
Correct |
780 ms |
114176 KB |
Output is correct |
74 |
Correct |
1264 ms |
140304 KB |
Output is correct |
75 |
Correct |
1268 ms |
138144 KB |
Output is correct |
76 |
Correct |
1070 ms |
149844 KB |
Output is correct |
77 |
Correct |
28 ms |
34252 KB |
Output is correct |
78 |
Correct |
38 ms |
35204 KB |
Output is correct |
79 |
Correct |
583 ms |
88688 KB |
Output is correct |
80 |
Correct |
815 ms |
114924 KB |
Output is correct |
81 |
Correct |
1165 ms |
141092 KB |
Output is correct |
82 |
Correct |
22 ms |
36220 KB |
Output is correct |
83 |
Correct |
23 ms |
36240 KB |
Output is correct |
84 |
Correct |
21 ms |
33200 KB |
Output is correct |
85 |
Correct |
955 ms |
129620 KB |
Output is correct |
86 |
Correct |
1106 ms |
129496 KB |
Output is correct |
87 |
Correct |
1036 ms |
129416 KB |
Output is correct |
88 |
Correct |
969 ms |
132804 KB |
Output is correct |
89 |
Correct |
355 ms |
54228 KB |
Output is correct |
90 |
Correct |
640 ms |
77808 KB |
Output is correct |
91 |
Correct |
687 ms |
77820 KB |
Output is correct |
92 |
Correct |
1133 ms |
149716 KB |
Output is correct |
93 |
Correct |
1086 ms |
149836 KB |
Output is correct |
94 |
Correct |
1208 ms |
149696 KB |
Output is correct |
95 |
Correct |
1170 ms |
149824 KB |
Output is correct |
96 |
Correct |
24 ms |
36300 KB |
Output is correct |
97 |
Correct |
72 ms |
43676 KB |
Output is correct |
98 |
Correct |
134 ms |
43704 KB |
Output is correct |
99 |
Correct |
1025 ms |
129612 KB |
Output is correct |
100 |
Correct |
36 ms |
35396 KB |
Output is correct |
101 |
Correct |
124 ms |
44336 KB |
Output is correct |
102 |
Correct |
276 ms |
55480 KB |
Output is correct |
103 |
Correct |
414 ms |
77604 KB |
Output is correct |
104 |
Correct |
581 ms |
93128 KB |
Output is correct |
105 |
Correct |
707 ms |
108560 KB |
Output is correct |
106 |
Correct |
914 ms |
124032 KB |
Output is correct |
107 |
Correct |
1083 ms |
139604 KB |
Output is correct |
108 |
Correct |
28 ms |
36300 KB |
Output is correct |
109 |
Correct |
25 ms |
36300 KB |
Output is correct |
110 |
Correct |
25 ms |
36284 KB |
Output is correct |
111 |
Correct |
22 ms |
33132 KB |
Output is correct |
112 |
Correct |
24 ms |
33116 KB |
Output is correct |
113 |
Correct |
24 ms |
36300 KB |
Output is correct |
114 |
Correct |
23 ms |
36216 KB |
Output is correct |
115 |
Correct |
24 ms |
36300 KB |
Output is correct |
116 |
Correct |
23 ms |
36224 KB |
Output is correct |
117 |
Correct |
20 ms |
33100 KB |
Output is correct |
118 |
Correct |
22 ms |
36268 KB |
Output is correct |
119 |
Correct |
24 ms |
33612 KB |
Output is correct |
120 |
Correct |
27 ms |
33868 KB |
Output is correct |
121 |
Correct |
496 ms |
86696 KB |
Output is correct |
122 |
Correct |
808 ms |
109412 KB |
Output is correct |
123 |
Correct |
764 ms |
109508 KB |
Output is correct |
124 |
Correct |
23 ms |
33096 KB |
Output is correct |
125 |
Correct |
23 ms |
36300 KB |
Output is correct |
126 |
Correct |
21 ms |
33100 KB |
Output is correct |
127 |
Correct |
1116 ms |
149748 KB |
Output is correct |
128 |
Correct |
1078 ms |
149824 KB |
Output is correct |
129 |
Correct |
1189 ms |
149316 KB |
Output is correct |
130 |
Correct |
28 ms |
33996 KB |
Output is correct |
131 |
Correct |
34 ms |
34908 KB |
Output is correct |
132 |
Correct |
535 ms |
88672 KB |
Output is correct |
133 |
Correct |
920 ms |
114116 KB |
Output is correct |
134 |
Correct |
1317 ms |
140344 KB |
Output is correct |
135 |
Correct |
1154 ms |
149800 KB |
Output is correct |
136 |
Correct |
1132 ms |
149852 KB |
Output is correct |
137 |
Correct |
1049 ms |
129496 KB |
Output is correct |
138 |
Correct |
1086 ms |
135300 KB |
Output is correct |
139 |
Correct |
911 ms |
132072 KB |
Output is correct |
140 |
Correct |
26 ms |
36224 KB |
Output is correct |
141 |
Correct |
140 ms |
52648 KB |
Output is correct |
142 |
Correct |
57 ms |
37600 KB |
Output is correct |
143 |
Correct |
184 ms |
49004 KB |
Output is correct |
144 |
Correct |
354 ms |
60348 KB |
Output is correct |
145 |
Correct |
535 ms |
89284 KB |
Output is correct |
146 |
Correct |
626 ms |
102596 KB |
Output is correct |
147 |
Correct |
872 ms |
115708 KB |
Output is correct |
148 |
Correct |
1153 ms |
129084 KB |
Output is correct |
149 |
Correct |
1259 ms |
142380 KB |
Output is correct |
150 |
Correct |
1187 ms |
138308 KB |
Output is correct |
151 |
Correct |
1180 ms |
149844 KB |
Output is correct |
152 |
Correct |
29 ms |
34252 KB |
Output is correct |
153 |
Correct |
34 ms |
35124 KB |
Output is correct |
154 |
Correct |
568 ms |
88632 KB |
Output is correct |
155 |
Correct |
836 ms |
114924 KB |
Output is correct |
156 |
Correct |
1174 ms |
141024 KB |
Output is correct |
157 |
Correct |
25 ms |
36300 KB |
Output is correct |
158 |
Correct |
24 ms |
33100 KB |
Output is correct |
159 |
Correct |
22 ms |
36300 KB |
Output is correct |
160 |
Correct |
24 ms |
36324 KB |
Output is correct |
161 |
Correct |
1111 ms |
132656 KB |
Output is correct |
162 |
Correct |
1129 ms |
129664 KB |
Output is correct |
163 |
Correct |
1108 ms |
130624 KB |
Output is correct |
164 |
Correct |
1026 ms |
130488 KB |
Output is correct |
165 |
Correct |
1137 ms |
138228 KB |
Output is correct |
166 |
Correct |
1171 ms |
138820 KB |
Output is correct |
167 |
Incorrect |
187 ms |
58696 KB |
Solution announced impossible, but it is possible. |
168 |
Halted |
0 ms |
0 KB |
- |