답안 #995081

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
995081 2024-06-08T12:22:08 Z dimashhh 분수 공원 (IOI21_parks) C++17
100 / 100
353 ms 41516 KB
#include <bits/stdc++.h>
#include "parks.h"

using namespace std;

const int N = 1e6 + 1;
vector<array<int,3>> a;
vector<pair<int,int>> edges;
vector<int> u,v,x,y;
int n,p[N];
map<pair<int,int>,int> id;
int get(int v){
    if(p[v] == v) return v;
    return p[v] = get(p[v]);
}
bool merge(int x,int y){
    x = get(x);
    y = get(y);
    if(x == y) return false;
    p[x] = y;
    return true;
}
bool check(){
    for(int i = 1;i < n;i++){
        if(get(i) != get(0)) return false;
    }
    return true;
}
int P[N],timer = 1;
map<pair<int,int>,pair<int,int>> mt;
map<pair<int,int>,int> vis;
vector<int> xx,yy;
bool dfs(pair<int,int> C){
    int i =C.first,j= C.second;
    if(vis[{i,j}] == timer) return false;
    vis[{i,j}] = timer;
    if(yy[i] == yy[j]){
        if(!mt.count({xx[i] - 1,yy[i] - 1}) || dfs(mt[{xx[i] - 1,yy[i] - 1}])){
            mt[{xx[i] - 1,yy[i] - 1}] = C;
            return true;
        }
        if(!mt.count({xx[i] - 1,yy[i] + 1}) || dfs(mt[{xx[i] - 1,yy[i] + 1}])){
            mt[{xx[i] - 1,yy[i] + 1}] = C;
            return true;
        }
    }else{
        if(!mt.count({xx[i] - 1,yy[i] - 1}) || dfs(mt[{xx[i] - 1,yy[i] - 1}])){
            mt[{xx[i] - 1,yy[i] - 1}] = C;
            return true;
        }
        if(!mt.count({xx[i] + 1,yy[i] - 1}) || dfs(mt[{xx[i] + 1,yy[i] - 1}])){
            mt[{xx[i] + 1,yy[i] - 1}] = C;
            return true;
        }
    }
    return false;
}
bool vis1[N];
int construct_roads(std::vector<int> X, std::vector<int> Y){
    xx = X;
    yy = Y;
    n = (int)X.size();
    for(int i = 0;i < n;i++){
        p[i] = id[{X[i],Y[i]}] = i;
        P[i] = i;
    }
    sort(P,P + n,[&](int c,int d){
        return make_pair(X[c],Y[c]) < make_pair(X[d],Y[d]);
    });
    for(int j = 0;j < n;j++){
        int i = P[j];
        if(id.count({X[i] - 2,Y[i]})){
            merge(i,id[{X[i] - 2,Y[i]}]);
            edges.push_back({i,id[{X[i] - 2,Y[i]}]});
        }
        if(id.count({X[i],Y[i] - 2})){
            merge(i,id[{X[i],Y[i] - 2}]);
            edges.push_back({i,id[{X[i],Y[i] - 2}]});
        }
    }
    if(!check()) return 0;
    for(int i =0 ;i < n;i++){
        p[i] =i;
    }
    id.clear();
    for(int f =0 ;f < (int)edges.size();f++){
        int i = edges[f].first,j = edges[f].second;
        if(get(i) == get(j)) continue;
        if(X[i] == X[j]){
            if(!mt.count({X[i] - 1,Y[i] - 1})){
                mt[{X[i] - 1,Y[i] - 1}] = {i,j};
                vis1[f] = 1;
            }else if(!mt.count({X[i] + 1,Y[i] - 1})){
                mt[{X[i] + 1,Y[i] - 1}] = {i,j};
                vis1[f] = 1;
            }
        }else{
            if(!mt.count({X[i] - 1,Y[i] - 1})){
                mt[{X[i] - 1,Y[i] - 1}] = {i,j};
                vis1[f] = 1;
            }else if(!mt.count({X[i] - 1,Y[i] + 1})){
                mt[{X[i] - 1,Y[i] + 1}] = {i,j};
                vis1[f] = 1;
            }
        }
        if(vis1[f]){
            merge(i,j);
        }
    }
    for(int i = 0;i < (int)edges.size();++i){
        if(vis1[i] ||get(edges[i].first) == get(edges[i].second)) continue;
        timer++;
        bool ok = dfs({edges[i].first,edges[i].second});
        if(ok){
            merge(edges[i].first,edges[i].second);
        }
    }
    for(auto [pp,pp1]:mt){
        x.push_back(pp.first);y.push_back(pp.second);
        u.push_back(pp1.first);v.push_back(pp1.second);
    }
    if(!check()) return 0;
    build(u,v,x,y);
    return 1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4440 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4440 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 112 ms 21080 KB Output is correct
10 Correct 12 ms 6232 KB Output is correct
11 Correct 52 ms 13356 KB Output is correct
12 Correct 14 ms 7004 KB Output is correct
13 Correct 27 ms 9180 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 2 ms 4536 KB Output is correct
16 Correct 113 ms 21020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4440 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4440 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 112 ms 21080 KB Output is correct
10 Correct 12 ms 6232 KB Output is correct
11 Correct 52 ms 13356 KB Output is correct
12 Correct 14 ms 7004 KB Output is correct
13 Correct 27 ms 9180 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 2 ms 4536 KB Output is correct
16 Correct 113 ms 21020 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 1 ms 4444 KB Output is correct
22 Correct 1 ms 4440 KB Output is correct
23 Correct 269 ms 39688 KB Output is correct
24 Correct 1 ms 4440 KB Output is correct
25 Correct 2 ms 4700 KB Output is correct
26 Correct 2 ms 4852 KB Output is correct
27 Correct 3 ms 4956 KB Output is correct
28 Correct 93 ms 18264 KB Output is correct
29 Correct 149 ms 24856 KB Output is correct
30 Correct 218 ms 32540 KB Output is correct
31 Correct 320 ms 39840 KB Output is correct
32 Correct 1 ms 4440 KB Output is correct
33 Correct 1 ms 4444 KB Output is correct
34 Correct 0 ms 4444 KB Output is correct
35 Correct 1 ms 4444 KB Output is correct
36 Correct 1 ms 4444 KB Output is correct
37 Correct 1 ms 4444 KB Output is correct
38 Correct 1 ms 4444 KB Output is correct
39 Correct 0 ms 4444 KB Output is correct
40 Correct 1 ms 4444 KB Output is correct
41 Correct 1 ms 4696 KB Output is correct
42 Correct 1 ms 4444 KB Output is correct
43 Correct 2 ms 4700 KB Output is correct
44 Correct 2 ms 4860 KB Output is correct
45 Correct 120 ms 21176 KB Output is correct
46 Correct 186 ms 29532 KB Output is correct
47 Correct 178 ms 29448 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4440 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4440 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 112 ms 21080 KB Output is correct
10 Correct 12 ms 6232 KB Output is correct
11 Correct 52 ms 13356 KB Output is correct
12 Correct 14 ms 7004 KB Output is correct
13 Correct 27 ms 9180 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 2 ms 4536 KB Output is correct
16 Correct 113 ms 21020 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 1 ms 4444 KB Output is correct
22 Correct 1 ms 4440 KB Output is correct
23 Correct 269 ms 39688 KB Output is correct
24 Correct 1 ms 4440 KB Output is correct
25 Correct 2 ms 4700 KB Output is correct
26 Correct 2 ms 4852 KB Output is correct
27 Correct 3 ms 4956 KB Output is correct
28 Correct 93 ms 18264 KB Output is correct
29 Correct 149 ms 24856 KB Output is correct
30 Correct 218 ms 32540 KB Output is correct
31 Correct 320 ms 39840 KB Output is correct
32 Correct 1 ms 4440 KB Output is correct
33 Correct 1 ms 4444 KB Output is correct
34 Correct 0 ms 4444 KB Output is correct
35 Correct 1 ms 4444 KB Output is correct
36 Correct 1 ms 4444 KB Output is correct
37 Correct 1 ms 4444 KB Output is correct
38 Correct 1 ms 4444 KB Output is correct
39 Correct 0 ms 4444 KB Output is correct
40 Correct 1 ms 4444 KB Output is correct
41 Correct 1 ms 4696 KB Output is correct
42 Correct 1 ms 4444 KB Output is correct
43 Correct 2 ms 4700 KB Output is correct
44 Correct 2 ms 4860 KB Output is correct
45 Correct 120 ms 21176 KB Output is correct
46 Correct 186 ms 29532 KB Output is correct
47 Correct 178 ms 29448 KB Output is correct
48 Correct 1 ms 4444 KB Output is correct
49 Correct 1 ms 4444 KB Output is correct
50 Correct 1 ms 4444 KB Output is correct
51 Correct 1 ms 4444 KB Output is correct
52 Correct 1 ms 4444 KB Output is correct
53 Correct 1 ms 4444 KB Output is correct
54 Correct 1 ms 4444 KB Output is correct
55 Correct 265 ms 39340 KB Output is correct
56 Correct 1 ms 4444 KB Output is correct
57 Correct 2 ms 4700 KB Output is correct
58 Correct 7 ms 5464 KB Output is correct
59 Correct 10 ms 5724 KB Output is correct
60 Correct 122 ms 21428 KB Output is correct
61 Correct 181 ms 28880 KB Output is correct
62 Correct 236 ms 33960 KB Output is correct
63 Correct 281 ms 39888 KB Output is correct
64 Correct 1 ms 4444 KB Output is correct
65 Correct 0 ms 4444 KB Output is correct
66 Correct 1 ms 4444 KB Output is correct
67 Correct 254 ms 37852 KB Output is correct
68 Correct 243 ms 37804 KB Output is correct
69 Correct 264 ms 37804 KB Output is correct
70 Correct 3 ms 4956 KB Output is correct
71 Correct 5 ms 5188 KB Output is correct
72 Correct 131 ms 21080 KB Output is correct
73 Correct 193 ms 30252 KB Output is correct
74 Correct 285 ms 37820 KB Output is correct
75 Correct 281 ms 38072 KB Output is correct
76 Correct 260 ms 37944 KB Output is correct
77 Correct 4 ms 4956 KB Output is correct
78 Correct 7 ms 5468 KB Output is correct
79 Correct 138 ms 20920 KB Output is correct
80 Correct 197 ms 30508 KB Output is correct
81 Correct 283 ms 38060 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4440 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4440 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 112 ms 21080 KB Output is correct
10 Correct 12 ms 6232 KB Output is correct
11 Correct 52 ms 13356 KB Output is correct
12 Correct 14 ms 7004 KB Output is correct
13 Correct 27 ms 9180 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 2 ms 4536 KB Output is correct
16 Correct 113 ms 21020 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4548 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 289 ms 40608 KB Output is correct
21 Correct 310 ms 39336 KB Output is correct
22 Correct 307 ms 39596 KB Output is correct
23 Correct 276 ms 33976 KB Output is correct
24 Correct 178 ms 23380 KB Output is correct
25 Correct 225 ms 25520 KB Output is correct
26 Correct 193 ms 25548 KB Output is correct
27 Correct 307 ms 37804 KB Output is correct
28 Correct 307 ms 37804 KB Output is correct
29 Correct 280 ms 37880 KB Output is correct
30 Correct 325 ms 37752 KB Output is correct
31 Correct 1 ms 4444 KB Output is correct
32 Correct 17 ms 7004 KB Output is correct
33 Correct 64 ms 14168 KB Output is correct
34 Correct 274 ms 39596 KB Output is correct
35 Correct 8 ms 5724 KB Output is correct
36 Correct 40 ms 9968 KB Output is correct
37 Correct 89 ms 15532 KB Output is correct
38 Correct 109 ms 18908 KB Output is correct
39 Correct 149 ms 23656 KB Output is correct
40 Correct 190 ms 30076 KB Output is correct
41 Correct 241 ms 35212 KB Output is correct
42 Correct 274 ms 40108 KB Output is correct
43 Correct 1 ms 4444 KB Output is correct
44 Correct 1 ms 4444 KB Output is correct
45 Correct 1 ms 4444 KB Output is correct
46 Correct 1 ms 4444 KB Output is correct
47 Correct 1 ms 4444 KB Output is correct
48 Correct 1 ms 4444 KB Output is correct
49 Correct 1 ms 4444 KB Output is correct
50 Correct 1 ms 4444 KB Output is correct
51 Correct 1 ms 4444 KB Output is correct
52 Correct 1 ms 4444 KB Output is correct
53 Correct 1 ms 4444 KB Output is correct
54 Correct 2 ms 4700 KB Output is correct
55 Correct 2 ms 4716 KB Output is correct
56 Correct 122 ms 21060 KB Output is correct
57 Correct 188 ms 29532 KB Output is correct
58 Correct 188 ms 29508 KB Output is correct
59 Correct 1 ms 4444 KB Output is correct
60 Correct 1 ms 4444 KB Output is correct
61 Correct 1 ms 4444 KB Output is correct
62 Correct 254 ms 38024 KB Output is correct
63 Correct 245 ms 38000 KB Output is correct
64 Correct 244 ms 37800 KB Output is correct
65 Correct 3 ms 4956 KB Output is correct
66 Correct 5 ms 5212 KB Output is correct
67 Correct 138 ms 21064 KB Output is correct
68 Correct 211 ms 30252 KB Output is correct
69 Correct 267 ms 38032 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4440 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4440 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 112 ms 21080 KB Output is correct
10 Correct 12 ms 6232 KB Output is correct
11 Correct 52 ms 13356 KB Output is correct
12 Correct 14 ms 7004 KB Output is correct
13 Correct 27 ms 9180 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 2 ms 4536 KB Output is correct
16 Correct 113 ms 21020 KB Output is correct
17 Correct 266 ms 38576 KB Output is correct
18 Correct 260 ms 39072 KB Output is correct
19 Correct 249 ms 39728 KB Output is correct
20 Correct 269 ms 37580 KB Output is correct
21 Correct 263 ms 34356 KB Output is correct
22 Correct 1 ms 4444 KB Output is correct
23 Correct 37 ms 9940 KB Output is correct
24 Correct 16 ms 6748 KB Output is correct
25 Correct 61 ms 12488 KB Output is correct
26 Correct 107 ms 18360 KB Output is correct
27 Correct 136 ms 22164 KB Output is correct
28 Correct 180 ms 26472 KB Output is correct
29 Correct 200 ms 32300 KB Output is correct
30 Correct 248 ms 35700 KB Output is correct
31 Correct 299 ms 40112 KB Output is correct
32 Correct 277 ms 38060 KB Output is correct
33 Correct 258 ms 37800 KB Output is correct
34 Correct 4 ms 4956 KB Output is correct
35 Correct 7 ms 5468 KB Output is correct
36 Correct 121 ms 21176 KB Output is correct
37 Correct 210 ms 30508 KB Output is correct
38 Correct 353 ms 38184 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4440 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4440 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 112 ms 21080 KB Output is correct
10 Correct 12 ms 6232 KB Output is correct
11 Correct 52 ms 13356 KB Output is correct
12 Correct 14 ms 7004 KB Output is correct
13 Correct 27 ms 9180 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 2 ms 4536 KB Output is correct
16 Correct 113 ms 21020 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 1 ms 4444 KB Output is correct
22 Correct 1 ms 4440 KB Output is correct
23 Correct 269 ms 39688 KB Output is correct
24 Correct 1 ms 4440 KB Output is correct
25 Correct 2 ms 4700 KB Output is correct
26 Correct 2 ms 4852 KB Output is correct
27 Correct 3 ms 4956 KB Output is correct
28 Correct 93 ms 18264 KB Output is correct
29 Correct 149 ms 24856 KB Output is correct
30 Correct 218 ms 32540 KB Output is correct
31 Correct 320 ms 39840 KB Output is correct
32 Correct 1 ms 4440 KB Output is correct
33 Correct 1 ms 4444 KB Output is correct
34 Correct 0 ms 4444 KB Output is correct
35 Correct 1 ms 4444 KB Output is correct
36 Correct 1 ms 4444 KB Output is correct
37 Correct 1 ms 4444 KB Output is correct
38 Correct 1 ms 4444 KB Output is correct
39 Correct 0 ms 4444 KB Output is correct
40 Correct 1 ms 4444 KB Output is correct
41 Correct 1 ms 4696 KB Output is correct
42 Correct 1 ms 4444 KB Output is correct
43 Correct 2 ms 4700 KB Output is correct
44 Correct 2 ms 4860 KB Output is correct
45 Correct 120 ms 21176 KB Output is correct
46 Correct 186 ms 29532 KB Output is correct
47 Correct 178 ms 29448 KB Output is correct
48 Correct 1 ms 4444 KB Output is correct
49 Correct 1 ms 4444 KB Output is correct
50 Correct 1 ms 4444 KB Output is correct
51 Correct 1 ms 4444 KB Output is correct
52 Correct 1 ms 4444 KB Output is correct
53 Correct 1 ms 4444 KB Output is correct
54 Correct 1 ms 4444 KB Output is correct
55 Correct 265 ms 39340 KB Output is correct
56 Correct 1 ms 4444 KB Output is correct
57 Correct 2 ms 4700 KB Output is correct
58 Correct 7 ms 5464 KB Output is correct
59 Correct 10 ms 5724 KB Output is correct
60 Correct 122 ms 21428 KB Output is correct
61 Correct 181 ms 28880 KB Output is correct
62 Correct 236 ms 33960 KB Output is correct
63 Correct 281 ms 39888 KB Output is correct
64 Correct 1 ms 4444 KB Output is correct
65 Correct 0 ms 4444 KB Output is correct
66 Correct 1 ms 4444 KB Output is correct
67 Correct 254 ms 37852 KB Output is correct
68 Correct 243 ms 37804 KB Output is correct
69 Correct 264 ms 37804 KB Output is correct
70 Correct 3 ms 4956 KB Output is correct
71 Correct 5 ms 5188 KB Output is correct
72 Correct 131 ms 21080 KB Output is correct
73 Correct 193 ms 30252 KB Output is correct
74 Correct 285 ms 37820 KB Output is correct
75 Correct 281 ms 38072 KB Output is correct
76 Correct 260 ms 37944 KB Output is correct
77 Correct 4 ms 4956 KB Output is correct
78 Correct 7 ms 5468 KB Output is correct
79 Correct 138 ms 20920 KB Output is correct
80 Correct 197 ms 30508 KB Output is correct
81 Correct 283 ms 38060 KB Output is correct
82 Correct 1 ms 4444 KB Output is correct
83 Correct 1 ms 4548 KB Output is correct
84 Correct 1 ms 4444 KB Output is correct
85 Correct 289 ms 40608 KB Output is correct
86 Correct 310 ms 39336 KB Output is correct
87 Correct 307 ms 39596 KB Output is correct
88 Correct 276 ms 33976 KB Output is correct
89 Correct 178 ms 23380 KB Output is correct
90 Correct 225 ms 25520 KB Output is correct
91 Correct 193 ms 25548 KB Output is correct
92 Correct 307 ms 37804 KB Output is correct
93 Correct 307 ms 37804 KB Output is correct
94 Correct 280 ms 37880 KB Output is correct
95 Correct 325 ms 37752 KB Output is correct
96 Correct 1 ms 4444 KB Output is correct
97 Correct 17 ms 7004 KB Output is correct
98 Correct 64 ms 14168 KB Output is correct
99 Correct 274 ms 39596 KB Output is correct
100 Correct 8 ms 5724 KB Output is correct
101 Correct 40 ms 9968 KB Output is correct
102 Correct 89 ms 15532 KB Output is correct
103 Correct 109 ms 18908 KB Output is correct
104 Correct 149 ms 23656 KB Output is correct
105 Correct 190 ms 30076 KB Output is correct
106 Correct 241 ms 35212 KB Output is correct
107 Correct 274 ms 40108 KB Output is correct
108 Correct 1 ms 4444 KB Output is correct
109 Correct 1 ms 4444 KB Output is correct
110 Correct 1 ms 4444 KB Output is correct
111 Correct 1 ms 4444 KB Output is correct
112 Correct 1 ms 4444 KB Output is correct
113 Correct 1 ms 4444 KB Output is correct
114 Correct 1 ms 4444 KB Output is correct
115 Correct 1 ms 4444 KB Output is correct
116 Correct 1 ms 4444 KB Output is correct
117 Correct 1 ms 4444 KB Output is correct
118 Correct 1 ms 4444 KB Output is correct
119 Correct 2 ms 4700 KB Output is correct
120 Correct 2 ms 4716 KB Output is correct
121 Correct 122 ms 21060 KB Output is correct
122 Correct 188 ms 29532 KB Output is correct
123 Correct 188 ms 29508 KB Output is correct
124 Correct 1 ms 4444 KB Output is correct
125 Correct 1 ms 4444 KB Output is correct
126 Correct 1 ms 4444 KB Output is correct
127 Correct 254 ms 38024 KB Output is correct
128 Correct 245 ms 38000 KB Output is correct
129 Correct 244 ms 37800 KB Output is correct
130 Correct 3 ms 4956 KB Output is correct
131 Correct 5 ms 5212 KB Output is correct
132 Correct 138 ms 21064 KB Output is correct
133 Correct 211 ms 30252 KB Output is correct
134 Correct 267 ms 38032 KB Output is correct
135 Correct 266 ms 38576 KB Output is correct
136 Correct 260 ms 39072 KB Output is correct
137 Correct 249 ms 39728 KB Output is correct
138 Correct 269 ms 37580 KB Output is correct
139 Correct 263 ms 34356 KB Output is correct
140 Correct 1 ms 4444 KB Output is correct
141 Correct 37 ms 9940 KB Output is correct
142 Correct 16 ms 6748 KB Output is correct
143 Correct 61 ms 12488 KB Output is correct
144 Correct 107 ms 18360 KB Output is correct
145 Correct 136 ms 22164 KB Output is correct
146 Correct 180 ms 26472 KB Output is correct
147 Correct 200 ms 32300 KB Output is correct
148 Correct 248 ms 35700 KB Output is correct
149 Correct 299 ms 40112 KB Output is correct
150 Correct 277 ms 38060 KB Output is correct
151 Correct 258 ms 37800 KB Output is correct
152 Correct 4 ms 4956 KB Output is correct
153 Correct 7 ms 5468 KB Output is correct
154 Correct 121 ms 21176 KB Output is correct
155 Correct 210 ms 30508 KB Output is correct
156 Correct 353 ms 38184 KB Output is correct
157 Correct 1 ms 4444 KB Output is correct
158 Correct 1 ms 4444 KB Output is correct
159 Correct 0 ms 4444 KB Output is correct
160 Correct 1 ms 4444 KB Output is correct
161 Correct 310 ms 40128 KB Output is correct
162 Correct 319 ms 39596 KB Output is correct
163 Correct 254 ms 40864 KB Output is correct
164 Correct 258 ms 41344 KB Output is correct
165 Correct 281 ms 41384 KB Output is correct
166 Correct 280 ms 40616 KB Output is correct
167 Correct 61 ms 12892 KB Output is correct
168 Correct 27 ms 8136 KB Output is correct
169 Correct 74 ms 14544 KB Output is correct
170 Correct 149 ms 25284 KB Output is correct
171 Correct 211 ms 28884 KB Output is correct
172 Correct 144 ms 22708 KB Output is correct
173 Correct 164 ms 26136 KB Output is correct
174 Correct 209 ms 32116 KB Output is correct
175 Correct 256 ms 34272 KB Output is correct
176 Correct 312 ms 39228 KB Output is correct
177 Correct 298 ms 41516 KB Output is correct