#include "parks.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
struct DSU{
int par[N], setsize[N], setcnt;
void reset(int n){
for(int i = 0; i < n; i++) par[i] = i, setsize[i] = 1;
setcnt = n;
}
int setfind(int a){
if(a == par[a]) return a;
else return par[a] = setfind(par[a]);
}
void setunion(int a, int b){
a = setfind(a), b = setfind(b);
if(a != b){
if(setsize[b] > setsize[a]) swap(a, b);
par[b] = par[a];
setsize[a] += setsize[b];
setcnt--;
}
}
};
DSU dsu;
struct Point{
int x, y;
bool operator < (const Point &sc) const{
if(y == sc.y) return x < sc.x;
else return y < sc.y;
}
};
map<Point, int> nodes;
map<Point, Point> edges;
map<Point, bool> vis;
bool check(Point p){
if(nodes.find({p.x - 1, p.y - 1}) != nodes.end() && nodes.find({p.x - 1, p.y + 1}) != nodes.end() && dsu.setfind(nodes[{p.x - 1, p.y - 1}]) != dsu.setfind(nodes[{p.x - 1, p.y + 1}])){
edges[{nodes[{p.x - 1, p.y - 1}], nodes[{p.x - 1, p.y + 1}]}] = p;
dsu.setunion(nodes[{p.x - 1, p.y - 1}], nodes[{p.x - 1, p.y + 1}]);
return true;
}
if(nodes.find({p.x - 1, p.y - 1}) != nodes.end() && nodes.find({p.x + 1, p.y - 1}) != nodes.end() && dsu.setfind(nodes[{p.x - 1, p.y - 1}]) != dsu.setfind(nodes[{p.x + 1, p.y - 1}])){
edges[{nodes[{p.x - 1, p.y - 1}], nodes[{p.x + 1, p.y - 1}]}] = p;
dsu.setunion(nodes[{p.x - 1, p.y - 1}], nodes[{p.x + 1, p.y - 1}]);
return true;
}
if(nodes.find({p.x + 1, p.y - 1}) != nodes.end() && nodes.find({p.x + 1, p.y + 1}) != nodes.end() && dsu.setfind(nodes[{p.x + 1, p.y - 1}]) != dsu.setfind(nodes[{p.x + 1, p.y + 1}])){
edges[{nodes[{p.x + 1, p.y - 1}], nodes[{p.x + 1, p.y + 1}]}] = p;
dsu.setunion(nodes[{p.x + 1, p.y - 1}], nodes[{p.x + 1, p.y + 1}]);
return true;
}
if(nodes.find({p.x + 1, p.y + 1}) != nodes.end() && nodes.find({p.x - 1, p.y + 1}) != nodes.end() && dsu.setfind(nodes[{p.x + 1, p.y + 1}]) != dsu.setfind(nodes[{p.x - 1, p.y + 1}])){
edges[{nodes[{p.x + 1, p.y + 1}], nodes[{p.x - 1, p.y + 1}]}] = p;
dsu.setunion(nodes[{p.x + 1, p.y + 1}], nodes[{p.x - 1, p.y + 1}]);
return true;
}
return false;
}
void dfs(Point p){
if(nodes.find({p.x - 1, p.y - 1}) != nodes.end() && nodes.find({p.x - 1, p.y + 1}) != nodes.end() && !vis[{p.x - 2, p.y}] && dsu.setfind(nodes[{p.x - 1, p.y - 1}]) != dsu.setfind(nodes[{p.x - 1, p.y + 1}])){
edges[{nodes[{p.x - 1, p.y - 1}], nodes[{p.x - 1, p.y + 1}]}] = {p.x - 2, p.y};
dsu.setunion(nodes[{p.x - 1, p.y - 1}], nodes[{p.x - 1, p.y + 1}]);
vis[{p.x - 2, p.y}] = true;
dfs({p.x - 2, p.y});
}
if(nodes.find({p.x - 1, p.y - 1}) != nodes.end() && nodes.find({p.x + 1, p.y - 1}) != nodes.end() && !vis[{p.x, p.y - 2}] && dsu.setfind(nodes[{p.x - 1, p.y - 1}]) != dsu.setfind(nodes[{p.x + 1, p.y - 1}])){
edges[{nodes[{p.x - 1, p.y - 1}], nodes[{p.x + 1, p.y - 1}]}] = {p.x, p.y - 2};
dsu.setunion(nodes[{p.x - 1, p.y - 1}], nodes[{p.x + 1, p.y - 1}]);
vis[{p.x, p.y - 2}] = true;
dfs({p.x, p.y - 2});
}
if(nodes.find({p.x + 1, p.y - 1}) != nodes.end() && nodes.find({p.x + 1, p.y + 1}) != nodes.end() && !vis[{p.x + 2, p.y}] && dsu.setfind(nodes[{p.x + 1, p.y - 1}]) != dsu.setfind(nodes[{p.x + 1, p.y + 1}])){
edges[{nodes[{p.x + 1, p.y - 1}], nodes[{p.x + 1, p.y + 1}]}] = {p.x + 2, p.y};
dsu.setunion(nodes[{p.x + 1, p.y - 1}], nodes[{p.x + 1, p.y + 1}]);
vis[{p.x + 2, p.y}] = true;
dfs({p.x + 2, p.y});
}
if(nodes.find({p.x + 1, p.y + 1}) != nodes.end() && nodes.find({p.x - 1, p.y + 1}) != nodes.end() && !vis[{p.x, p.y + 2}] && dsu.setfind(nodes[{p.x + 1, p.y + 1}]) != dsu.setfind(nodes[{p.x - 1, p.y + 1}])){
edges[{nodes[{p.x + 1, p.y + 1}], nodes[{p.x - 1, p.y + 1}]}] = {p.x, p.y + 2};
dsu.setunion(nodes[{p.x + 1, p.y + 1}], nodes[{p.x - 1, p.y + 1}]);
vis[{p.x, p.y + 2}] = true;
dfs({p.x, p.y + 2});
}
if(!vis[{p.x - 2, p.y}] && check({p.x - 2, p.y})){
vis[{p.x - 2, p.y}] = true;
dfs({p.x - 2, p.y});
}
if(!vis[{p.x + 2, p.y}] && check({p.x + 2, p.y})){
vis[{p.x + 2, p.y}] = true;
dfs({p.x + 2, p.y});
}
if(!vis[{p.x, p.y - 2}] && check({p.x, p.y - 2})){
vis[{p.x, p.y - 2}] = true;
dfs({p.x, p.y - 2});
}
if(!vis[{p.x, p.y + 2}] && check({p.x, p.y + 2})){
vis[{p.x, p.y + 2}] = true;
dfs({p.x, p.y + 2});
}
}
int construct_roads(vector<int> xvec, vector<int> yvec){
int n = xvec.size();
dsu.reset(n);
for(int i = 0; i < n; i++) nodes[{xvec[i], yvec[i]}] = i;
if(*max_element(xvec.begin(), xvec.end()) <= 2){ // subtask 1
for(auto p : nodes){
Point po = p.first;
if(nodes.find({2, po.y + 2}) != nodes.end()){
edges[{p.second, nodes[{2, po.y + 2}]}] = {1, po.y + 1};
dsu.setunion(p.second, nodes[{2, po.y + 2}]);
}
}
}
else if(*max_element(xvec.begin(), xvec.end()) <= 4){ // subtask 2
vector<int> x2, x4;
for(int i = 0; i < n; i++){
if(xvec[i] == 2) x2.push_back(yvec[i]);
else if(xvec[i] == 4) x4.push_back(yvec[i]);
}
sort(x2.begin(), x2.end());
sort(x4.begin(), x4.end());
for(auto y : x2){
if(nodes.find({2, y + 2}) != nodes.end()){
edges[{nodes[{2, y}], nodes[{2, y + 2}]}] = {1, y + 1};
dsu.setunion(nodes[{2, y}], nodes[{2, y + 2}]);
}
}
for(auto y : x4){
if(nodes.find({4, y + 2}) != nodes.end()){
edges[{nodes[{4, y}], nodes[{4, y + 2}]}] = {5, y + 1};
dsu.setunion(nodes[{4, y}], nodes[{4, y + 2}]);
}
if(nodes.find({2, y}) != nodes.end()){
edges[{nodes[{4, y}], nodes[{2, y}]}] = {3, y + 1};
dsu.setunion(nodes[{4, y}], nodes[{2, y}]);
}
}
}
else if(*max_element(xvec.begin(), xvec.end()) <= 6){ // subtask 3
vector<int> x2, x4, x6;
for(int i = 0; i < n; i++){
if(xvec[i] == 2) x2.push_back(yvec[i]);
else if(xvec[i] == 4) x4.push_back(yvec[i]);
else if(xvec[i] == 6) x6.push_back(yvec[i]);
}
sort(x2.begin(), x2.end());
sort(x4.begin(), x4.end());
sort(x6.begin(), x6.end());
for(auto y : x2){
if(nodes.find({2, y + 2}) != nodes.end()){
edges[{nodes[{2, y}], nodes[{2, y + 2}]}] = {1, y + 1};
dsu.setunion(nodes[{2, y}], nodes[{2, y + 2}]);
}
}
for(auto y : x6){
if(nodes.find({6, y + 2}) != nodes.end()){
edges[{nodes[{6, y}], nodes[{6, y + 2}]}] = {7, y + 1};
dsu.setunion(nodes[{6, y}], nodes[{6, y + 2}]);
}
}
for(auto y : x4){
if(nodes.find({4, y + 2}) != nodes.end()){
dsu.setunion(nodes[{4, y}], nodes[{4, y + 2}]);
}
}
for(auto y : x4){
if(nodes.find({6, y}) != nodes.end() && dsu.setfind(nodes[{4, y}]) != dsu.setfind(nodes[{6, y}])){
edges[{nodes[{4, y}], nodes[{6, y}]}] = {5, y - 1};
vis[{5, y - 1}] = true;
dsu.setunion(nodes[{4, y}], nodes[{6, y}]);
if(nodes.find({2, y}) != nodes.end() && dsu.setfind(nodes[{4, y}]) != dsu.setfind(nodes[{2, y}])){
edges[{nodes[{2, y}], nodes[{4, y}]}] = {3, y + 1};
vis[{3, y + 1}] = true;
dsu.setunion(nodes[{2, y}], nodes[{4, y}]);
}
}
else if(nodes.find({2, y}) != nodes.end() && dsu.setfind(nodes[{4, y}]) != dsu.setfind(nodes[{2, y}])){
edges[{nodes[{2, y}], nodes[{4, y}]}] = {3, y - 1};
vis[{3, y - 1}] = true;
dsu.setunion(nodes[{2, y}], nodes[{4, y}]);
}
}
for(auto y : x4){
if(nodes.find({4, y + 2}) != nodes.end()){
if(!vis[{3, y + 1}]){
edges[{nodes[{4, y}], nodes[{4, y + 2}]}] = {3, y + 1};
}
else if(!vis[{5, y + 1}]){
edges[{nodes[{4, y}], nodes[{4, y + 2}]}] = {5, y + 1};
}
// else assert(false);
}
}
}
else{ // subtask 4, 5
stack<Point> que;
Point fpo = nodes.begin()->first;
if(nodes.find({fpo.x + 2, fpo.y}) != nodes.end()){
dfs({fpo.x + 1, fpo.y - 1});
}
else if(nodes.find({fpo.x, fpo.y + 2}) != nodes.end()){
dfs({fpo.x - 1, fpo.y + 1});
}
}
if(dsu.setcnt == 1){
vector<int> vecs[4];
for(auto p : edges){
vecs[0].push_back(p.first.x);
vecs[1].push_back(p.first.y);
vecs[2].push_back(p.second.x);
vecs[3].push_back(p.second.y);
}
build(vecs[0], vecs[1], vecs[2], vecs[3]);
return 1;
}
else return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
196 ms |
19904 KB |
Output is correct |
10 |
Correct |
14 ms |
2492 KB |
Output is correct |
11 |
Correct |
77 ms |
10996 KB |
Output is correct |
12 |
Correct |
17 ms |
3428 KB |
Output is correct |
13 |
Correct |
44 ms |
6808 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
596 KB |
Output is correct |
16 |
Correct |
219 ms |
20016 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
196 ms |
19904 KB |
Output is correct |
10 |
Correct |
14 ms |
2492 KB |
Output is correct |
11 |
Correct |
77 ms |
10996 KB |
Output is correct |
12 |
Correct |
17 ms |
3428 KB |
Output is correct |
13 |
Correct |
44 ms |
6808 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
596 KB |
Output is correct |
16 |
Correct |
219 ms |
20016 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
23 |
Correct |
670 ms |
50468 KB |
Output is correct |
24 |
Correct |
1 ms |
212 KB |
Output is correct |
25 |
Correct |
3 ms |
596 KB |
Output is correct |
26 |
Correct |
6 ms |
852 KB |
Output is correct |
27 |
Correct |
7 ms |
980 KB |
Output is correct |
28 |
Correct |
202 ms |
20540 KB |
Output is correct |
29 |
Correct |
325 ms |
30464 KB |
Output is correct |
30 |
Correct |
450 ms |
40716 KB |
Output is correct |
31 |
Correct |
613 ms |
50460 KB |
Output is correct |
32 |
Correct |
0 ms |
336 KB |
Output is correct |
33 |
Correct |
0 ms |
212 KB |
Output is correct |
34 |
Correct |
0 ms |
212 KB |
Output is correct |
35 |
Correct |
0 ms |
212 KB |
Output is correct |
36 |
Correct |
1 ms |
212 KB |
Output is correct |
37 |
Correct |
0 ms |
212 KB |
Output is correct |
38 |
Correct |
0 ms |
212 KB |
Output is correct |
39 |
Correct |
1 ms |
212 KB |
Output is correct |
40 |
Correct |
1 ms |
212 KB |
Output is correct |
41 |
Correct |
0 ms |
212 KB |
Output is correct |
42 |
Correct |
0 ms |
212 KB |
Output is correct |
43 |
Correct |
2 ms |
596 KB |
Output is correct |
44 |
Correct |
3 ms |
724 KB |
Output is correct |
45 |
Correct |
185 ms |
20180 KB |
Output is correct |
46 |
Correct |
418 ms |
29768 KB |
Output is correct |
47 |
Correct |
433 ms |
29688 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
196 ms |
19904 KB |
Output is correct |
10 |
Correct |
14 ms |
2492 KB |
Output is correct |
11 |
Correct |
77 ms |
10996 KB |
Output is correct |
12 |
Correct |
17 ms |
3428 KB |
Output is correct |
13 |
Correct |
44 ms |
6808 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
596 KB |
Output is correct |
16 |
Correct |
219 ms |
20016 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
23 |
Correct |
670 ms |
50468 KB |
Output is correct |
24 |
Correct |
1 ms |
212 KB |
Output is correct |
25 |
Correct |
3 ms |
596 KB |
Output is correct |
26 |
Correct |
6 ms |
852 KB |
Output is correct |
27 |
Correct |
7 ms |
980 KB |
Output is correct |
28 |
Correct |
202 ms |
20540 KB |
Output is correct |
29 |
Correct |
325 ms |
30464 KB |
Output is correct |
30 |
Correct |
450 ms |
40716 KB |
Output is correct |
31 |
Correct |
613 ms |
50460 KB |
Output is correct |
32 |
Correct |
0 ms |
336 KB |
Output is correct |
33 |
Correct |
0 ms |
212 KB |
Output is correct |
34 |
Correct |
0 ms |
212 KB |
Output is correct |
35 |
Correct |
0 ms |
212 KB |
Output is correct |
36 |
Correct |
1 ms |
212 KB |
Output is correct |
37 |
Correct |
0 ms |
212 KB |
Output is correct |
38 |
Correct |
0 ms |
212 KB |
Output is correct |
39 |
Correct |
1 ms |
212 KB |
Output is correct |
40 |
Correct |
1 ms |
212 KB |
Output is correct |
41 |
Correct |
0 ms |
212 KB |
Output is correct |
42 |
Correct |
0 ms |
212 KB |
Output is correct |
43 |
Correct |
2 ms |
596 KB |
Output is correct |
44 |
Correct |
3 ms |
724 KB |
Output is correct |
45 |
Correct |
185 ms |
20180 KB |
Output is correct |
46 |
Correct |
418 ms |
29768 KB |
Output is correct |
47 |
Correct |
433 ms |
29688 KB |
Output is correct |
48 |
Correct |
1 ms |
212 KB |
Output is correct |
49 |
Correct |
1 ms |
212 KB |
Output is correct |
50 |
Correct |
0 ms |
212 KB |
Output is correct |
51 |
Correct |
0 ms |
212 KB |
Output is correct |
52 |
Correct |
0 ms |
212 KB |
Output is correct |
53 |
Correct |
0 ms |
212 KB |
Output is correct |
54 |
Correct |
0 ms |
212 KB |
Output is correct |
55 |
Correct |
609 ms |
44232 KB |
Output is correct |
56 |
Correct |
0 ms |
212 KB |
Output is correct |
57 |
Correct |
4 ms |
724 KB |
Output is correct |
58 |
Correct |
11 ms |
1744 KB |
Output is correct |
59 |
Correct |
15 ms |
2024 KB |
Output is correct |
60 |
Correct |
256 ms |
22412 KB |
Output is correct |
61 |
Correct |
399 ms |
29596 KB |
Output is correct |
62 |
Correct |
502 ms |
36124 KB |
Output is correct |
63 |
Correct |
629 ms |
44196 KB |
Output is correct |
64 |
Correct |
1 ms |
212 KB |
Output is correct |
65 |
Correct |
0 ms |
212 KB |
Output is correct |
66 |
Correct |
1 ms |
212 KB |
Output is correct |
67 |
Correct |
498 ms |
40020 KB |
Output is correct |
68 |
Correct |
531 ms |
39996 KB |
Output is correct |
69 |
Correct |
491 ms |
39900 KB |
Output is correct |
70 |
Correct |
5 ms |
980 KB |
Output is correct |
71 |
Correct |
12 ms |
1816 KB |
Output is correct |
72 |
Correct |
246 ms |
23776 KB |
Output is correct |
73 |
Correct |
536 ms |
34548 KB |
Output is correct |
74 |
Correct |
629 ms |
46456 KB |
Output is correct |
75 |
Correct |
583 ms |
42544 KB |
Output is correct |
76 |
Correct |
531 ms |
40060 KB |
Output is correct |
77 |
Correct |
6 ms |
1108 KB |
Output is correct |
78 |
Correct |
12 ms |
1844 KB |
Output is correct |
79 |
Correct |
285 ms |
22992 KB |
Output is correct |
80 |
Correct |
459 ms |
33820 KB |
Output is correct |
81 |
Correct |
658 ms |
45612 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
196 ms |
19904 KB |
Output is correct |
10 |
Correct |
14 ms |
2492 KB |
Output is correct |
11 |
Correct |
77 ms |
10996 KB |
Output is correct |
12 |
Correct |
17 ms |
3428 KB |
Output is correct |
13 |
Correct |
44 ms |
6808 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
596 KB |
Output is correct |
16 |
Correct |
219 ms |
20016 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1228 ms |
88088 KB |
Output is correct |
21 |
Correct |
1075 ms |
88100 KB |
Output is correct |
22 |
Correct |
1120 ms |
88060 KB |
Output is correct |
23 |
Correct |
1056 ms |
89212 KB |
Output is correct |
24 |
Correct |
171 ms |
17496 KB |
Output is correct |
25 |
Correct |
134 ms |
17740 KB |
Output is correct |
26 |
Correct |
140 ms |
17764 KB |
Output is correct |
27 |
Correct |
1389 ms |
64912 KB |
Output is correct |
28 |
Correct |
1251 ms |
65428 KB |
Output is correct |
29 |
Correct |
985 ms |
65124 KB |
Output is correct |
30 |
Correct |
936 ms |
65184 KB |
Output is correct |
31 |
Correct |
0 ms |
212 KB |
Output is correct |
32 |
Correct |
64 ms |
5828 KB |
Output is correct |
33 |
Correct |
70 ms |
10172 KB |
Output is correct |
34 |
Correct |
983 ms |
114020 KB |
Output is correct |
35 |
Correct |
26 ms |
2280 KB |
Output is correct |
36 |
Correct |
71 ms |
7268 KB |
Output is correct |
37 |
Correct |
85 ms |
12452 KB |
Output is correct |
38 |
Correct |
392 ms |
28604 KB |
Output is correct |
39 |
Correct |
528 ms |
39216 KB |
Output is correct |
40 |
Correct |
727 ms |
49688 KB |
Output is correct |
41 |
Correct |
920 ms |
60912 KB |
Output is correct |
42 |
Correct |
1099 ms |
70524 KB |
Output is correct |
43 |
Correct |
1 ms |
304 KB |
Output is correct |
44 |
Correct |
1 ms |
212 KB |
Output is correct |
45 |
Correct |
1 ms |
212 KB |
Output is correct |
46 |
Correct |
1 ms |
212 KB |
Output is correct |
47 |
Correct |
0 ms |
308 KB |
Output is correct |
48 |
Correct |
1 ms |
212 KB |
Output is correct |
49 |
Correct |
1 ms |
212 KB |
Output is correct |
50 |
Correct |
1 ms |
212 KB |
Output is correct |
51 |
Correct |
1 ms |
212 KB |
Output is correct |
52 |
Correct |
1 ms |
212 KB |
Output is correct |
53 |
Correct |
1 ms |
212 KB |
Output is correct |
54 |
Correct |
2 ms |
596 KB |
Output is correct |
55 |
Correct |
3 ms |
724 KB |
Output is correct |
56 |
Correct |
190 ms |
21072 KB |
Output is correct |
57 |
Correct |
378 ms |
30960 KB |
Output is correct |
58 |
Correct |
331 ms |
30916 KB |
Output is correct |
59 |
Correct |
1 ms |
212 KB |
Output is correct |
60 |
Correct |
1 ms |
212 KB |
Output is correct |
61 |
Correct |
1 ms |
212 KB |
Output is correct |
62 |
Correct |
514 ms |
41836 KB |
Output is correct |
63 |
Correct |
525 ms |
41716 KB |
Output is correct |
64 |
Correct |
568 ms |
41488 KB |
Output is correct |
65 |
Correct |
5 ms |
980 KB |
Output is correct |
66 |
Correct |
14 ms |
1752 KB |
Output is correct |
67 |
Correct |
273 ms |
24628 KB |
Output is correct |
68 |
Correct |
462 ms |
35820 KB |
Output is correct |
69 |
Correct |
587 ms |
48316 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
196 ms |
19904 KB |
Output is correct |
10 |
Correct |
14 ms |
2492 KB |
Output is correct |
11 |
Correct |
77 ms |
10996 KB |
Output is correct |
12 |
Correct |
17 ms |
3428 KB |
Output is correct |
13 |
Correct |
44 ms |
6808 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
596 KB |
Output is correct |
16 |
Correct |
219 ms |
20016 KB |
Output is correct |
17 |
Correct |
1103 ms |
112332 KB |
Output is correct |
18 |
Correct |
1089 ms |
100632 KB |
Output is correct |
19 |
Correct |
986 ms |
111516 KB |
Output is correct |
20 |
Correct |
943 ms |
101036 KB |
Output is correct |
21 |
Correct |
872 ms |
90900 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
23 |
Correct |
127 ms |
11660 KB |
Output is correct |
24 |
Correct |
36 ms |
4688 KB |
Output is correct |
25 |
Correct |
70 ms |
10192 KB |
Output is correct |
26 |
Correct |
104 ms |
14540 KB |
Output is correct |
27 |
Correct |
537 ms |
39420 KB |
Output is correct |
28 |
Correct |
604 ms |
46824 KB |
Output is correct |
29 |
Correct |
741 ms |
57436 KB |
Output is correct |
30 |
Correct |
886 ms |
67868 KB |
Output is correct |
31 |
Correct |
1091 ms |
77480 KB |
Output is correct |
32 |
Correct |
497 ms |
44196 KB |
Output is correct |
33 |
Correct |
440 ms |
41824 KB |
Output is correct |
34 |
Correct |
6 ms |
1236 KB |
Output is correct |
35 |
Correct |
12 ms |
2016 KB |
Output is correct |
36 |
Correct |
236 ms |
23788 KB |
Output is correct |
37 |
Correct |
398 ms |
35088 KB |
Output is correct |
38 |
Correct |
555 ms |
47140 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
196 ms |
19904 KB |
Output is correct |
10 |
Correct |
14 ms |
2492 KB |
Output is correct |
11 |
Correct |
77 ms |
10996 KB |
Output is correct |
12 |
Correct |
17 ms |
3428 KB |
Output is correct |
13 |
Correct |
44 ms |
6808 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
596 KB |
Output is correct |
16 |
Correct |
219 ms |
20016 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
23 |
Correct |
670 ms |
50468 KB |
Output is correct |
24 |
Correct |
1 ms |
212 KB |
Output is correct |
25 |
Correct |
3 ms |
596 KB |
Output is correct |
26 |
Correct |
6 ms |
852 KB |
Output is correct |
27 |
Correct |
7 ms |
980 KB |
Output is correct |
28 |
Correct |
202 ms |
20540 KB |
Output is correct |
29 |
Correct |
325 ms |
30464 KB |
Output is correct |
30 |
Correct |
450 ms |
40716 KB |
Output is correct |
31 |
Correct |
613 ms |
50460 KB |
Output is correct |
32 |
Correct |
0 ms |
336 KB |
Output is correct |
33 |
Correct |
0 ms |
212 KB |
Output is correct |
34 |
Correct |
0 ms |
212 KB |
Output is correct |
35 |
Correct |
0 ms |
212 KB |
Output is correct |
36 |
Correct |
1 ms |
212 KB |
Output is correct |
37 |
Correct |
0 ms |
212 KB |
Output is correct |
38 |
Correct |
0 ms |
212 KB |
Output is correct |
39 |
Correct |
1 ms |
212 KB |
Output is correct |
40 |
Correct |
1 ms |
212 KB |
Output is correct |
41 |
Correct |
0 ms |
212 KB |
Output is correct |
42 |
Correct |
0 ms |
212 KB |
Output is correct |
43 |
Correct |
2 ms |
596 KB |
Output is correct |
44 |
Correct |
3 ms |
724 KB |
Output is correct |
45 |
Correct |
185 ms |
20180 KB |
Output is correct |
46 |
Correct |
418 ms |
29768 KB |
Output is correct |
47 |
Correct |
433 ms |
29688 KB |
Output is correct |
48 |
Correct |
1 ms |
212 KB |
Output is correct |
49 |
Correct |
1 ms |
212 KB |
Output is correct |
50 |
Correct |
0 ms |
212 KB |
Output is correct |
51 |
Correct |
0 ms |
212 KB |
Output is correct |
52 |
Correct |
0 ms |
212 KB |
Output is correct |
53 |
Correct |
0 ms |
212 KB |
Output is correct |
54 |
Correct |
0 ms |
212 KB |
Output is correct |
55 |
Correct |
609 ms |
44232 KB |
Output is correct |
56 |
Correct |
0 ms |
212 KB |
Output is correct |
57 |
Correct |
4 ms |
724 KB |
Output is correct |
58 |
Correct |
11 ms |
1744 KB |
Output is correct |
59 |
Correct |
15 ms |
2024 KB |
Output is correct |
60 |
Correct |
256 ms |
22412 KB |
Output is correct |
61 |
Correct |
399 ms |
29596 KB |
Output is correct |
62 |
Correct |
502 ms |
36124 KB |
Output is correct |
63 |
Correct |
629 ms |
44196 KB |
Output is correct |
64 |
Correct |
1 ms |
212 KB |
Output is correct |
65 |
Correct |
0 ms |
212 KB |
Output is correct |
66 |
Correct |
1 ms |
212 KB |
Output is correct |
67 |
Correct |
498 ms |
40020 KB |
Output is correct |
68 |
Correct |
531 ms |
39996 KB |
Output is correct |
69 |
Correct |
491 ms |
39900 KB |
Output is correct |
70 |
Correct |
5 ms |
980 KB |
Output is correct |
71 |
Correct |
12 ms |
1816 KB |
Output is correct |
72 |
Correct |
246 ms |
23776 KB |
Output is correct |
73 |
Correct |
536 ms |
34548 KB |
Output is correct |
74 |
Correct |
629 ms |
46456 KB |
Output is correct |
75 |
Correct |
583 ms |
42544 KB |
Output is correct |
76 |
Correct |
531 ms |
40060 KB |
Output is correct |
77 |
Correct |
6 ms |
1108 KB |
Output is correct |
78 |
Correct |
12 ms |
1844 KB |
Output is correct |
79 |
Correct |
285 ms |
22992 KB |
Output is correct |
80 |
Correct |
459 ms |
33820 KB |
Output is correct |
81 |
Correct |
658 ms |
45612 KB |
Output is correct |
82 |
Correct |
0 ms |
212 KB |
Output is correct |
83 |
Correct |
0 ms |
212 KB |
Output is correct |
84 |
Correct |
1 ms |
212 KB |
Output is correct |
85 |
Correct |
1228 ms |
88088 KB |
Output is correct |
86 |
Correct |
1075 ms |
88100 KB |
Output is correct |
87 |
Correct |
1120 ms |
88060 KB |
Output is correct |
88 |
Correct |
1056 ms |
89212 KB |
Output is correct |
89 |
Correct |
171 ms |
17496 KB |
Output is correct |
90 |
Correct |
134 ms |
17740 KB |
Output is correct |
91 |
Correct |
140 ms |
17764 KB |
Output is correct |
92 |
Correct |
1389 ms |
64912 KB |
Output is correct |
93 |
Correct |
1251 ms |
65428 KB |
Output is correct |
94 |
Correct |
985 ms |
65124 KB |
Output is correct |
95 |
Correct |
936 ms |
65184 KB |
Output is correct |
96 |
Correct |
0 ms |
212 KB |
Output is correct |
97 |
Correct |
64 ms |
5828 KB |
Output is correct |
98 |
Correct |
70 ms |
10172 KB |
Output is correct |
99 |
Correct |
983 ms |
114020 KB |
Output is correct |
100 |
Correct |
26 ms |
2280 KB |
Output is correct |
101 |
Correct |
71 ms |
7268 KB |
Output is correct |
102 |
Correct |
85 ms |
12452 KB |
Output is correct |
103 |
Correct |
392 ms |
28604 KB |
Output is correct |
104 |
Correct |
528 ms |
39216 KB |
Output is correct |
105 |
Correct |
727 ms |
49688 KB |
Output is correct |
106 |
Correct |
920 ms |
60912 KB |
Output is correct |
107 |
Correct |
1099 ms |
70524 KB |
Output is correct |
108 |
Correct |
1 ms |
304 KB |
Output is correct |
109 |
Correct |
1 ms |
212 KB |
Output is correct |
110 |
Correct |
1 ms |
212 KB |
Output is correct |
111 |
Correct |
1 ms |
212 KB |
Output is correct |
112 |
Correct |
0 ms |
308 KB |
Output is correct |
113 |
Correct |
1 ms |
212 KB |
Output is correct |
114 |
Correct |
1 ms |
212 KB |
Output is correct |
115 |
Correct |
1 ms |
212 KB |
Output is correct |
116 |
Correct |
1 ms |
212 KB |
Output is correct |
117 |
Correct |
1 ms |
212 KB |
Output is correct |
118 |
Correct |
1 ms |
212 KB |
Output is correct |
119 |
Correct |
2 ms |
596 KB |
Output is correct |
120 |
Correct |
3 ms |
724 KB |
Output is correct |
121 |
Correct |
190 ms |
21072 KB |
Output is correct |
122 |
Correct |
378 ms |
30960 KB |
Output is correct |
123 |
Correct |
331 ms |
30916 KB |
Output is correct |
124 |
Correct |
1 ms |
212 KB |
Output is correct |
125 |
Correct |
1 ms |
212 KB |
Output is correct |
126 |
Correct |
1 ms |
212 KB |
Output is correct |
127 |
Correct |
514 ms |
41836 KB |
Output is correct |
128 |
Correct |
525 ms |
41716 KB |
Output is correct |
129 |
Correct |
568 ms |
41488 KB |
Output is correct |
130 |
Correct |
5 ms |
980 KB |
Output is correct |
131 |
Correct |
14 ms |
1752 KB |
Output is correct |
132 |
Correct |
273 ms |
24628 KB |
Output is correct |
133 |
Correct |
462 ms |
35820 KB |
Output is correct |
134 |
Correct |
587 ms |
48316 KB |
Output is correct |
135 |
Correct |
1103 ms |
112332 KB |
Output is correct |
136 |
Correct |
1089 ms |
100632 KB |
Output is correct |
137 |
Correct |
986 ms |
111516 KB |
Output is correct |
138 |
Correct |
943 ms |
101036 KB |
Output is correct |
139 |
Correct |
872 ms |
90900 KB |
Output is correct |
140 |
Correct |
1 ms |
212 KB |
Output is correct |
141 |
Correct |
127 ms |
11660 KB |
Output is correct |
142 |
Correct |
36 ms |
4688 KB |
Output is correct |
143 |
Correct |
70 ms |
10192 KB |
Output is correct |
144 |
Correct |
104 ms |
14540 KB |
Output is correct |
145 |
Correct |
537 ms |
39420 KB |
Output is correct |
146 |
Correct |
604 ms |
46824 KB |
Output is correct |
147 |
Correct |
741 ms |
57436 KB |
Output is correct |
148 |
Correct |
886 ms |
67868 KB |
Output is correct |
149 |
Correct |
1091 ms |
77480 KB |
Output is correct |
150 |
Correct |
497 ms |
44196 KB |
Output is correct |
151 |
Correct |
440 ms |
41824 KB |
Output is correct |
152 |
Correct |
6 ms |
1236 KB |
Output is correct |
153 |
Correct |
12 ms |
2016 KB |
Output is correct |
154 |
Correct |
236 ms |
23788 KB |
Output is correct |
155 |
Correct |
398 ms |
35088 KB |
Output is correct |
156 |
Correct |
555 ms |
47140 KB |
Output is correct |
157 |
Correct |
1 ms |
212 KB |
Output is correct |
158 |
Correct |
1 ms |
308 KB |
Output is correct |
159 |
Correct |
1 ms |
212 KB |
Output is correct |
160 |
Correct |
1 ms |
212 KB |
Output is correct |
161 |
Correct |
810 ms |
100920 KB |
Output is correct |
162 |
Correct |
930 ms |
114224 KB |
Output is correct |
163 |
Correct |
902 ms |
94364 KB |
Output is correct |
164 |
Correct |
930 ms |
94176 KB |
Output is correct |
165 |
Correct |
1142 ms |
96276 KB |
Output is correct |
166 |
Correct |
925 ms |
99704 KB |
Output is correct |
167 |
Incorrect |
157 ms |
15948 KB |
Solution announced impossible, but it is possible. |
168 |
Halted |
0 ms |
0 KB |
- |