답안 #789765

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
789765 2023-07-22T01:46:36 Z math_rabbit_1028 Diversity (CEOI21_diversity) C++14
100 / 100
6200 ms 6000 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n, q, b;
int arr[303030];
ll cnt[303030], cnt2[303030], sum[303030], xsum[303030], ans[50505];
pair<ll, ll> reord[303030];
unordered_set<int> S;

const int m = 300000;

struct query{
    int idx, lt, rt;
} Q[50505];

bool compare(query p, query q) {
    if (p.lt/b == q.lt/b) return p.rt < q.rt;
    return (p.lt/b) < (q.lt/b);
}

void add(int i, int diff) {
    if (cnt2[cnt[i]] == 1) S.erase(cnt[i]);
    cnt2[cnt[i]]--;
    cnt[i] += diff;
    if (cnt2[cnt[i]] == 0) S.insert(cnt[i]);
    cnt2[cnt[i]]++;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> q; b = (int)sqrt(n);
    for (int i = 1; i <= n; i++) cin >> arr[i];

    for (int i = 1; i <= q; i++) cin >> Q[i].lt >> Q[i].rt;
    for (int i = 1; i <= q; i++) Q[i].idx = i;

    sort(Q + 1, Q + q + 1, compare);

    Q[0].lt = 1; Q[0].rt = 0;
    for (int i = 1; i <= q; i++) {
        if (Q[i - 1].rt < Q[i].rt) for (int j = Q[i - 1].rt + 1; j <= Q[i].rt; j++) add(arr[j], 1);
        else for (int j = Q[i].rt + 1; j <= Q[i - 1].rt; j++) add(arr[j], -1);

        if (Q[i - 1].lt > Q[i].lt) for (int j = Q[i].lt; j < Q[i - 1].lt; j++) add(arr[j], 1);
        else for (int j = Q[i - 1].lt; j < Q[i].lt; j++) add(arr[j], -1);

        vector< pair<int, ll> > v;
        for (auto iter = S.begin(); iter != S.end(); iter++) {
            v.emplace_back(*iter, cnt2[*iter]);
        }

        sort(v.begin(), v.end());

        int sz = v.size(), tot = 0;
        for (int i = sz - 1; i >= 0; i--) {
            ll sm = (v[i].second)/2, la = v[i].second - sm;
            if (tot & 1) {
                reord[i + 1] = make_pair(v[i].first, sm);
                reord[sz * 2 - i] = make_pair(v[i].first, la);
            }
            else {
                reord[i + 1] = make_pair(v[i].first, la);
                reord[sz * 2 - i] = make_pair(v[i].first, sm);
            }
            tot += v[i].second;
        }

        ll res = 0, sum = 0, xsum = 0, s = 0;
        for (int i = 1; i <= sz * 2; i++) {
            ll a = reord[i].first, k = reord[i].second;
            res = res
                + k * a * (a + 1) / 2
                + a * a * k * (k + 1) * (k + 2) / 6 - a * a * k
                + a * k * (2 * s + k + 3) / 2 * sum
                - a * k * xsum;
            sum = sum + a * k;
            xsum = xsum + a * k * (2 * s + k + 1) / 2;
            s = s + k;
        }
        ans[Q[i].idx] = res;
    }

    for (int i = 1; i <= q; i++) cout << ans[i] << "\n";

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 428 KB Output is correct
4 Correct 10 ms 1108 KB Output is correct
5 Correct 20 ms 1972 KB Output is correct
6 Correct 30 ms 2304 KB Output is correct
7 Correct 29 ms 3152 KB Output is correct
8 Correct 29 ms 2272 KB Output is correct
9 Correct 30 ms 2268 KB Output is correct
10 Correct 30 ms 2636 KB Output is correct
11 Correct 30 ms 2432 KB Output is correct
12 Correct 31 ms 2324 KB Output is correct
13 Correct 30 ms 2188 KB Output is correct
14 Correct 35 ms 2532 KB Output is correct
15 Correct 29 ms 2364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 428 KB Output is correct
4 Correct 10 ms 1108 KB Output is correct
5 Correct 20 ms 1972 KB Output is correct
6 Correct 30 ms 2304 KB Output is correct
7 Correct 29 ms 3152 KB Output is correct
8 Correct 29 ms 2272 KB Output is correct
9 Correct 30 ms 2268 KB Output is correct
10 Correct 30 ms 2636 KB Output is correct
11 Correct 30 ms 2432 KB Output is correct
12 Correct 31 ms 2324 KB Output is correct
13 Correct 30 ms 2188 KB Output is correct
14 Correct 35 ms 2532 KB Output is correct
15 Correct 29 ms 2364 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 2 ms 348 KB Output is correct
19 Correct 10 ms 1092 KB Output is correct
20 Correct 20 ms 1712 KB Output is correct
21 Correct 30 ms 2364 KB Output is correct
22 Correct 31 ms 2104 KB Output is correct
23 Correct 31 ms 2252 KB Output is correct
24 Correct 30 ms 2108 KB Output is correct
25 Correct 30 ms 2212 KB Output is correct
26 Correct 31 ms 2124 KB Output is correct
27 Correct 31 ms 2192 KB Output is correct
28 Correct 31 ms 2432 KB Output is correct
29 Correct 31 ms 2180 KB Output is correct
30 Correct 30 ms 2184 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 428 KB Output is correct
4 Correct 10 ms 1108 KB Output is correct
5 Correct 20 ms 1972 KB Output is correct
6 Correct 30 ms 2304 KB Output is correct
7 Correct 29 ms 3152 KB Output is correct
8 Correct 29 ms 2272 KB Output is correct
9 Correct 30 ms 2268 KB Output is correct
10 Correct 30 ms 2636 KB Output is correct
11 Correct 30 ms 2432 KB Output is correct
12 Correct 31 ms 2324 KB Output is correct
13 Correct 30 ms 2188 KB Output is correct
14 Correct 35 ms 2532 KB Output is correct
15 Correct 29 ms 2364 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 2 ms 348 KB Output is correct
19 Correct 10 ms 1092 KB Output is correct
20 Correct 20 ms 1712 KB Output is correct
21 Correct 30 ms 2364 KB Output is correct
22 Correct 31 ms 2104 KB Output is correct
23 Correct 31 ms 2252 KB Output is correct
24 Correct 30 ms 2108 KB Output is correct
25 Correct 30 ms 2212 KB Output is correct
26 Correct 31 ms 2124 KB Output is correct
27 Correct 31 ms 2192 KB Output is correct
28 Correct 31 ms 2432 KB Output is correct
29 Correct 31 ms 2180 KB Output is correct
30 Correct 30 ms 2184 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 0 ms 336 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 4 ms 724 KB Output is correct
38 Correct 3 ms 696 KB Output is correct
39 Correct 7 ms 1008 KB Output is correct
40 Correct 14 ms 1548 KB Output is correct
41 Correct 22 ms 2000 KB Output is correct
42 Correct 24 ms 1996 KB Output is correct
43 Correct 22 ms 2008 KB Output is correct
44 Correct 22 ms 1984 KB Output is correct
45 Correct 22 ms 1932 KB Output is correct
46 Correct 22 ms 2004 KB Output is correct
47 Correct 22 ms 1948 KB Output is correct
48 Correct 23 ms 1884 KB Output is correct
49 Correct 22 ms 1956 KB Output is correct
50 Correct 22 ms 1968 KB Output is correct
51 Correct 22 ms 1892 KB Output is correct
52 Correct 22 ms 1900 KB Output is correct
53 Correct 22 ms 1920 KB Output is correct
54 Correct 22 ms 1996 KB Output is correct
55 Correct 22 ms 1932 KB Output is correct
56 Correct 22 ms 1936 KB Output is correct
57 Correct 21 ms 1944 KB Output is correct
58 Correct 22 ms 1996 KB Output is correct
59 Correct 22 ms 2072 KB Output is correct
60 Correct 22 ms 1944 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 428 KB Output is correct
14 Correct 10 ms 1108 KB Output is correct
15 Correct 20 ms 1972 KB Output is correct
16 Correct 30 ms 2304 KB Output is correct
17 Correct 29 ms 3152 KB Output is correct
18 Correct 29 ms 2272 KB Output is correct
19 Correct 30 ms 2268 KB Output is correct
20 Correct 30 ms 2636 KB Output is correct
21 Correct 30 ms 2432 KB Output is correct
22 Correct 31 ms 2324 KB Output is correct
23 Correct 30 ms 2188 KB Output is correct
24 Correct 35 ms 2532 KB Output is correct
25 Correct 29 ms 2364 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 2 ms 348 KB Output is correct
29 Correct 10 ms 1092 KB Output is correct
30 Correct 20 ms 1712 KB Output is correct
31 Correct 30 ms 2364 KB Output is correct
32 Correct 31 ms 2104 KB Output is correct
33 Correct 31 ms 2252 KB Output is correct
34 Correct 30 ms 2108 KB Output is correct
35 Correct 30 ms 2212 KB Output is correct
36 Correct 31 ms 2124 KB Output is correct
37 Correct 31 ms 2192 KB Output is correct
38 Correct 31 ms 2432 KB Output is correct
39 Correct 31 ms 2180 KB Output is correct
40 Correct 30 ms 2184 KB Output is correct
41 Correct 1 ms 340 KB Output is correct
42 Correct 0 ms 336 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 1 ms 340 KB Output is correct
45 Correct 1 ms 340 KB Output is correct
46 Correct 1 ms 340 KB Output is correct
47 Correct 4 ms 724 KB Output is correct
48 Correct 3 ms 696 KB Output is correct
49 Correct 7 ms 1008 KB Output is correct
50 Correct 14 ms 1548 KB Output is correct
51 Correct 22 ms 2000 KB Output is correct
52 Correct 24 ms 1996 KB Output is correct
53 Correct 22 ms 2008 KB Output is correct
54 Correct 22 ms 1984 KB Output is correct
55 Correct 22 ms 1932 KB Output is correct
56 Correct 22 ms 2004 KB Output is correct
57 Correct 22 ms 1948 KB Output is correct
58 Correct 23 ms 1884 KB Output is correct
59 Correct 22 ms 1956 KB Output is correct
60 Correct 22 ms 1968 KB Output is correct
61 Correct 22 ms 1892 KB Output is correct
62 Correct 22 ms 1900 KB Output is correct
63 Correct 22 ms 1920 KB Output is correct
64 Correct 22 ms 1996 KB Output is correct
65 Correct 22 ms 1932 KB Output is correct
66 Correct 22 ms 1936 KB Output is correct
67 Correct 21 ms 1944 KB Output is correct
68 Correct 22 ms 1996 KB Output is correct
69 Correct 22 ms 2072 KB Output is correct
70 Correct 22 ms 1944 KB Output is correct
71 Correct 4 ms 732 KB Output is correct
72 Correct 3 ms 724 KB Output is correct
73 Correct 4 ms 708 KB Output is correct
74 Correct 4 ms 736 KB Output is correct
75 Correct 3 ms 784 KB Output is correct
76 Correct 8 ms 1108 KB Output is correct
77 Correct 10 ms 1228 KB Output is correct
78 Correct 6 ms 1108 KB Output is correct
79 Correct 6 ms 1108 KB Output is correct
80 Correct 7 ms 1116 KB Output is correct
81 Correct 12 ms 1628 KB Output is correct
82 Correct 12 ms 1512 KB Output is correct
83 Correct 13 ms 1556 KB Output is correct
84 Correct 12 ms 1588 KB Output is correct
85 Correct 13 ms 1516 KB Output is correct
86 Correct 17 ms 1640 KB Output is correct
87 Correct 14 ms 1612 KB Output is correct
88 Correct 14 ms 1636 KB Output is correct
89 Correct 14 ms 1608 KB Output is correct
90 Correct 14 ms 1568 KB Output is correct
91 Correct 22 ms 2764 KB Output is correct
92 Correct 20 ms 2556 KB Output is correct
93 Correct 20 ms 2588 KB Output is correct
94 Correct 20 ms 2684 KB Output is correct
95 Correct 20 ms 2644 KB Output is correct
96 Correct 23 ms 3440 KB Output is correct
97 Correct 23 ms 3360 KB Output is correct
98 Correct 23 ms 3352 KB Output is correct
99 Correct 23 ms 3356 KB Output is correct
100 Correct 23 ms 3336 KB Output is correct
101 Correct 29 ms 3596 KB Output is correct
102 Correct 24 ms 3408 KB Output is correct
103 Correct 23 ms 3440 KB Output is correct
104 Correct 23 ms 3376 KB Output is correct
105 Correct 22 ms 3348 KB Output is correct
106 Correct 23 ms 3836 KB Output is correct
107 Correct 23 ms 3844 KB Output is correct
108 Correct 23 ms 3788 KB Output is correct
109 Correct 27 ms 3812 KB Output is correct
110 Correct 23 ms 3800 KB Output is correct
111 Correct 24 ms 3728 KB Output is correct
112 Correct 25 ms 3832 KB Output is correct
113 Correct 23 ms 3760 KB Output is correct
114 Correct 26 ms 3788 KB Output is correct
115 Correct 23 ms 3740 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 428 KB Output is correct
14 Correct 10 ms 1108 KB Output is correct
15 Correct 20 ms 1972 KB Output is correct
16 Correct 30 ms 2304 KB Output is correct
17 Correct 29 ms 3152 KB Output is correct
18 Correct 29 ms 2272 KB Output is correct
19 Correct 30 ms 2268 KB Output is correct
20 Correct 30 ms 2636 KB Output is correct
21 Correct 30 ms 2432 KB Output is correct
22 Correct 31 ms 2324 KB Output is correct
23 Correct 30 ms 2188 KB Output is correct
24 Correct 35 ms 2532 KB Output is correct
25 Correct 29 ms 2364 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 2 ms 348 KB Output is correct
29 Correct 10 ms 1092 KB Output is correct
30 Correct 20 ms 1712 KB Output is correct
31 Correct 30 ms 2364 KB Output is correct
32 Correct 31 ms 2104 KB Output is correct
33 Correct 31 ms 2252 KB Output is correct
34 Correct 30 ms 2108 KB Output is correct
35 Correct 30 ms 2212 KB Output is correct
36 Correct 31 ms 2124 KB Output is correct
37 Correct 31 ms 2192 KB Output is correct
38 Correct 31 ms 2432 KB Output is correct
39 Correct 31 ms 2180 KB Output is correct
40 Correct 30 ms 2184 KB Output is correct
41 Correct 1 ms 340 KB Output is correct
42 Correct 0 ms 336 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 1 ms 340 KB Output is correct
45 Correct 1 ms 340 KB Output is correct
46 Correct 1 ms 340 KB Output is correct
47 Correct 4 ms 724 KB Output is correct
48 Correct 3 ms 696 KB Output is correct
49 Correct 7 ms 1008 KB Output is correct
50 Correct 14 ms 1548 KB Output is correct
51 Correct 22 ms 2000 KB Output is correct
52 Correct 24 ms 1996 KB Output is correct
53 Correct 22 ms 2008 KB Output is correct
54 Correct 22 ms 1984 KB Output is correct
55 Correct 22 ms 1932 KB Output is correct
56 Correct 22 ms 2004 KB Output is correct
57 Correct 22 ms 1948 KB Output is correct
58 Correct 23 ms 1884 KB Output is correct
59 Correct 22 ms 1956 KB Output is correct
60 Correct 22 ms 1968 KB Output is correct
61 Correct 22 ms 1892 KB Output is correct
62 Correct 22 ms 1900 KB Output is correct
63 Correct 22 ms 1920 KB Output is correct
64 Correct 22 ms 1996 KB Output is correct
65 Correct 22 ms 1932 KB Output is correct
66 Correct 22 ms 1936 KB Output is correct
67 Correct 21 ms 1944 KB Output is correct
68 Correct 22 ms 1996 KB Output is correct
69 Correct 22 ms 2072 KB Output is correct
70 Correct 22 ms 1944 KB Output is correct
71 Correct 4 ms 732 KB Output is correct
72 Correct 3 ms 724 KB Output is correct
73 Correct 4 ms 708 KB Output is correct
74 Correct 4 ms 736 KB Output is correct
75 Correct 3 ms 784 KB Output is correct
76 Correct 8 ms 1108 KB Output is correct
77 Correct 10 ms 1228 KB Output is correct
78 Correct 6 ms 1108 KB Output is correct
79 Correct 6 ms 1108 KB Output is correct
80 Correct 7 ms 1116 KB Output is correct
81 Correct 12 ms 1628 KB Output is correct
82 Correct 12 ms 1512 KB Output is correct
83 Correct 13 ms 1556 KB Output is correct
84 Correct 12 ms 1588 KB Output is correct
85 Correct 13 ms 1516 KB Output is correct
86 Correct 17 ms 1640 KB Output is correct
87 Correct 14 ms 1612 KB Output is correct
88 Correct 14 ms 1636 KB Output is correct
89 Correct 14 ms 1608 KB Output is correct
90 Correct 14 ms 1568 KB Output is correct
91 Correct 22 ms 2764 KB Output is correct
92 Correct 20 ms 2556 KB Output is correct
93 Correct 20 ms 2588 KB Output is correct
94 Correct 20 ms 2684 KB Output is correct
95 Correct 20 ms 2644 KB Output is correct
96 Correct 23 ms 3440 KB Output is correct
97 Correct 23 ms 3360 KB Output is correct
98 Correct 23 ms 3352 KB Output is correct
99 Correct 23 ms 3356 KB Output is correct
100 Correct 23 ms 3336 KB Output is correct
101 Correct 29 ms 3596 KB Output is correct
102 Correct 24 ms 3408 KB Output is correct
103 Correct 23 ms 3440 KB Output is correct
104 Correct 23 ms 3376 KB Output is correct
105 Correct 22 ms 3348 KB Output is correct
106 Correct 23 ms 3836 KB Output is correct
107 Correct 23 ms 3844 KB Output is correct
108 Correct 23 ms 3788 KB Output is correct
109 Correct 27 ms 3812 KB Output is correct
110 Correct 23 ms 3800 KB Output is correct
111 Correct 24 ms 3728 KB Output is correct
112 Correct 25 ms 3832 KB Output is correct
113 Correct 23 ms 3760 KB Output is correct
114 Correct 26 ms 3788 KB Output is correct
115 Correct 23 ms 3740 KB Output is correct
116 Correct 192 ms 2136 KB Output is correct
117 Correct 183 ms 2128 KB Output is correct
118 Correct 756 ms 2436 KB Output is correct
119 Correct 409 ms 2380 KB Output is correct
120 Correct 255 ms 2384 KB Output is correct
121 Correct 634 ms 2704 KB Output is correct
122 Correct 411 ms 2388 KB Output is correct
123 Correct 1775 ms 2932 KB Output is correct
124 Correct 654 ms 4300 KB Output is correct
125 Correct 515 ms 4420 KB Output is correct
126 Correct 6065 ms 4752 KB Output is correct
127 Correct 6107 ms 4820 KB Output is correct
128 Correct 6039 ms 4820 KB Output is correct
129 Correct 6059 ms 4800 KB Output is correct
130 Correct 5997 ms 4792 KB Output is correct
131 Correct 5438 ms 4964 KB Output is correct
132 Correct 5432 ms 4972 KB Output is correct
133 Correct 5750 ms 4952 KB Output is correct
134 Correct 5426 ms 4956 KB Output is correct
135 Correct 5461 ms 4972 KB Output is correct
136 Correct 5235 ms 4980 KB Output is correct
137 Correct 5483 ms 4992 KB Output is correct
138 Correct 5231 ms 4980 KB Output is correct
139 Correct 5419 ms 4908 KB Output is correct
140 Correct 5334 ms 4976 KB Output is correct
141 Correct 3198 ms 5008 KB Output is correct
142 Correct 3347 ms 5008 KB Output is correct
143 Correct 3396 ms 4960 KB Output is correct
144 Correct 3251 ms 5028 KB Output is correct
145 Correct 3267 ms 5020 KB Output is correct
146 Correct 1156 ms 5272 KB Output is correct
147 Correct 1113 ms 5260 KB Output is correct
148 Correct 1183 ms 5376 KB Output is correct
149 Correct 1155 ms 5324 KB Output is correct
150 Correct 1136 ms 5264 KB Output is correct
151 Correct 931 ms 5308 KB Output is correct
152 Correct 926 ms 5308 KB Output is correct
153 Correct 946 ms 5308 KB Output is correct
154 Correct 941 ms 5308 KB Output is correct
155 Correct 910 ms 5308 KB Output is correct
156 Correct 3306 ms 5956 KB Output is correct
157 Correct 3223 ms 6000 KB Output is correct
158 Correct 3235 ms 5860 KB Output is correct
159 Correct 3156 ms 5872 KB Output is correct
160 Correct 3191 ms 5876 KB Output is correct
161 Correct 3910 ms 5924 KB Output is correct
162 Correct 3863 ms 5792 KB Output is correct
163 Correct 4059 ms 5740 KB Output is correct
164 Correct 3813 ms 5784 KB Output is correct
165 Correct 3770 ms 5724 KB Output is correct
166 Correct 5156 ms 5500 KB Output is correct
167 Correct 5110 ms 5448 KB Output is correct
168 Correct 5099 ms 5456 KB Output is correct
169 Correct 5169 ms 5504 KB Output is correct
170 Correct 5137 ms 5476 KB Output is correct
171 Correct 6171 ms 5340 KB Output is correct
172 Correct 6153 ms 5340 KB Output is correct
173 Correct 6156 ms 3672 KB Output is correct
174 Correct 6124 ms 3788 KB Output is correct
175 Correct 6200 ms 3732 KB Output is correct