답안 #999452

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
999452 2024-06-15T13:58:52 Z mc061 Diversity (CEOI21_diversity) C++17
100 / 100
1646 ms 7888 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
#ifndef ONLINE_JUDGE
    // #include "debug.h"
#else
    #define dbg(...) 42
    template<typename T>ostream&operator<<(ostream&os,vector<T>&vec){for(int i=0;i+1<vec.size();++i){os<<vec[i]<<" ";}if(vec.size()>0)os<<vec.back();return os;}
#endif

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

template<typename T>istream&operator>>(istream&is,vector<T>&vec){for(T&element:vec){is>>element;}return is;}
template<typename T>void chmin(T&x,T y){x=min(x,y);}
template<typename T>void chmax(T&x,T y){x=max(x,y);}

const int N = 3e5+6;
const int Qn = 1337;
const int block = 1000;
int ar[N];
int qu_lengths[Qn];
int qu_cnt[Qn];
int cnt[N];
int mp[N];
int64_t qAns[N];
bitset<N> bs;

set<int> lengths;

void rem_c(int c) {
    mp[c]--;
    if (mp[c] == 0) bs[c] = 0;
}

void add(int val) {
    if (cnt[val] != 0)
        rem_c(cnt[val]);
    cnt[val]++;
    mp[cnt[val]]++;
    if (mp[cnt[val]] == 1) bs[cnt[val]] = 1;
}

void rem(int val) {
    rem_c(cnt[val]);
    cnt[val]--;
    if (cnt[val] != 0) {
        mp[cnt[val]]++;
        if (mp[cnt[val]] == 1) bs[cnt[val]] = 1;
    }
}

struct segment {
    int length;
    int diffs;
    int64_t ans;
    int64_t ans_left;
    int64_t ans_right;
};

segment merge_two(segment A, segment B) {
    if (A.length == 0) return B;
    if (B.length == 0) return A;
    segment res;
    res.diffs = A.diffs + B.diffs;
    res.length = A.length + B.length;
    res.ans_right = B.ans_right + 1ll*A.ans_right + 1ll*(B.diffs)*A.length;
    res.ans_left = A.ans_left + 1ll*B.ans_left + 1ll*(A.diffs)*B.length;
    res.ans = A.ans + B.ans + 1ll*A.ans_right*B.length + 1ll*B.ans_left*A.length;
    return res;
}

segment form_one(int length, int cnt) {
    segment cur = segment{length, 1, 1ll*length*(length+1)/2, length, length};
    segment res = {0, 0, 0, 0, 0};
    for (; cnt > 0; cnt >>= 1) {
        if (cnt & 1) {
            res = merge_two(res, cur);
        }
        cur = merge_two(cur, cur);
    }
    return res;
}

void go(int ind) {
    vector<int> lengths;
    for (int i = bs._Find_first(); i < bs.size(); i = bs._Find_next(i)) lengths.push_back(i);
    memset(qu_lengths, 0, sizeof(qu_lengths));
    memset(qu_cnt, 0, sizeof(qu_cnt));
    bool odd_to_left = true;
    int ptr = 0;
    for (int le : lengths) {
        int c = mp[le];
        int to_left = c / 2;
        int to_right = c / 2;
        if (c % 2 != 0) {
            if (odd_to_left) {
                to_left++;
            }
            else {
                to_right++;
            }
            odd_to_left ^= 1;
        }
        qu_lengths[ptr] = le;
        qu_lengths[Qn - ptr - 1] = le;
        qu_cnt[ptr] = to_left;
        qu_cnt[Qn - ptr - 1] = to_right;
        ++ptr;
    }
    segment res{0, 0, 0, 0, 0};
    for (int i = 0; i < Qn; ++i) {
        if (qu_cnt[i] == 0) continue;
        segment now = form_one(qu_lengths[i], qu_cnt[i]);
        res = merge_two(res, now);
    }
    qAns[ind] = res.ans;
}

void test_case(signed num) {
    int n, q;
    cin >> n >> q;
    for (int i = 0; i < n; ++i) {
        cin >> ar[i];
    }
    vector<array<int, 3>> queries;
    for (int i = 0; i < q; ++i) {
        int l, r;
        cin >> l >> r;
        --l, --r;
        queries.push_back({l, r, i});
    }
    sort(queries.begin(), queries.end(), [&] (const array<int, 3>& a, const array<int, 3>& b) {
        return make_pair(a[0] / block, a[1]) < make_pair(b[0] / block, b[1]); 
    });

    int ql = 0, qr = -1;

    for (int i = 0; i < queries.size(); ++i) {
        while (ql > queries[i][0]) {
            --ql;
            add(ar[ql]);
        }
        while (qr < queries[i][1]) {
            ++qr;
            add(ar[qr]);
        }
        while (ql < queries[i][0]) {
            rem(ar[ql]);
            ++ql;
        }
        while (qr > queries[i][1]) {
            rem(ar[qr]);
            --qr;
        }

        go(queries[i][2]);
    }
    for (int i = 0; i < q; ++i) {
        cout << qAns[i] << "\n";
    }
}

signed main(void) {
    cin.tie(0)->sync_with_stdio(false);

    test_case(69420);
}

Compilation message

diversity.cpp: In function 'void go(int)':
diversity.cpp:87:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'long unsigned int'} [-Wsign-compare]
   87 |     for (int i = bs._Find_first(); i < bs.size(); i = bs._Find_next(i)) lengths.push_back(i);
      |                                    ~~^~~~~~~~~~~
diversity.cpp: In function 'void test_case(int)':
diversity.cpp:139:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<int, 3> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  139 |     for (int i = 0; i < queries.size(); ++i) {
      |                     ~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 4 ms 1116 KB Output is correct
5 Correct 8 ms 1884 KB Output is correct
6 Correct 14 ms 2396 KB Output is correct
7 Correct 14 ms 2908 KB Output is correct
8 Correct 12 ms 2396 KB Output is correct
9 Correct 13 ms 2396 KB Output is correct
10 Correct 13 ms 2652 KB Output is correct
11 Correct 13 ms 2444 KB Output is correct
12 Correct 13 ms 2396 KB Output is correct
13 Correct 13 ms 2468 KB Output is correct
14 Correct 13 ms 2396 KB Output is correct
15 Correct 16 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 4 ms 1116 KB Output is correct
5 Correct 8 ms 1884 KB Output is correct
6 Correct 14 ms 2396 KB Output is correct
7 Correct 14 ms 2908 KB Output is correct
8 Correct 12 ms 2396 KB Output is correct
9 Correct 13 ms 2396 KB Output is correct
10 Correct 13 ms 2652 KB Output is correct
11 Correct 13 ms 2444 KB Output is correct
12 Correct 13 ms 2396 KB Output is correct
13 Correct 13 ms 2468 KB Output is correct
14 Correct 13 ms 2396 KB Output is correct
15 Correct 16 ms 2392 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 5 ms 1116 KB Output is correct
20 Correct 9 ms 1924 KB Output is correct
21 Correct 14 ms 2652 KB Output is correct
22 Correct 14 ms 2560 KB Output is correct
23 Correct 15 ms 2652 KB Output is correct
24 Correct 15 ms 2616 KB Output is correct
25 Correct 13 ms 2392 KB Output is correct
26 Correct 13 ms 2396 KB Output is correct
27 Correct 13 ms 2652 KB Output is correct
28 Correct 14 ms 2460 KB Output is correct
29 Correct 14 ms 2452 KB Output is correct
30 Correct 14 ms 2500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 4 ms 1116 KB Output is correct
5 Correct 8 ms 1884 KB Output is correct
6 Correct 14 ms 2396 KB Output is correct
7 Correct 14 ms 2908 KB Output is correct
8 Correct 12 ms 2396 KB Output is correct
9 Correct 13 ms 2396 KB Output is correct
10 Correct 13 ms 2652 KB Output is correct
11 Correct 13 ms 2444 KB Output is correct
12 Correct 13 ms 2396 KB Output is correct
13 Correct 13 ms 2468 KB Output is correct
14 Correct 13 ms 2396 KB Output is correct
15 Correct 16 ms 2392 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 5 ms 1116 KB Output is correct
20 Correct 9 ms 1924 KB Output is correct
21 Correct 14 ms 2652 KB Output is correct
22 Correct 14 ms 2560 KB Output is correct
23 Correct 15 ms 2652 KB Output is correct
24 Correct 15 ms 2616 KB Output is correct
25 Correct 13 ms 2392 KB Output is correct
26 Correct 13 ms 2396 KB Output is correct
27 Correct 13 ms 2652 KB Output is correct
28 Correct 14 ms 2460 KB Output is correct
29 Correct 14 ms 2452 KB Output is correct
30 Correct 14 ms 2500 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 3 ms 860 KB Output is correct
38 Correct 3 ms 768 KB Output is correct
39 Correct 5 ms 1208 KB Output is correct
40 Correct 10 ms 2044 KB Output is correct
41 Correct 15 ms 2808 KB Output is correct
42 Correct 16 ms 2652 KB Output is correct
43 Correct 16 ms 2904 KB Output is correct
44 Correct 17 ms 2648 KB Output is correct
45 Correct 16 ms 2652 KB Output is correct
46 Correct 16 ms 2648 KB Output is correct
47 Correct 17 ms 2648 KB Output is correct
48 Correct 16 ms 2648 KB Output is correct
49 Correct 15 ms 2652 KB Output is correct
50 Correct 17 ms 2800 KB Output is correct
51 Correct 19 ms 2652 KB Output is correct
52 Correct 16 ms 2652 KB Output is correct
53 Correct 17 ms 2572 KB Output is correct
54 Correct 17 ms 2768 KB Output is correct
55 Correct 16 ms 2652 KB Output is correct
56 Correct 16 ms 2788 KB Output is correct
57 Correct 16 ms 2652 KB Output is correct
58 Correct 16 ms 2652 KB Output is correct
59 Correct 16 ms 2652 KB Output is correct
60 Correct 16 ms 2620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 4 ms 1116 KB Output is correct
15 Correct 8 ms 1884 KB Output is correct
16 Correct 14 ms 2396 KB Output is correct
17 Correct 14 ms 2908 KB Output is correct
18 Correct 12 ms 2396 KB Output is correct
19 Correct 13 ms 2396 KB Output is correct
20 Correct 13 ms 2652 KB Output is correct
21 Correct 13 ms 2444 KB Output is correct
22 Correct 13 ms 2396 KB Output is correct
23 Correct 13 ms 2468 KB Output is correct
24 Correct 13 ms 2396 KB Output is correct
25 Correct 16 ms 2392 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 5 ms 1116 KB Output is correct
30 Correct 9 ms 1924 KB Output is correct
31 Correct 14 ms 2652 KB Output is correct
32 Correct 14 ms 2560 KB Output is correct
33 Correct 15 ms 2652 KB Output is correct
34 Correct 15 ms 2616 KB Output is correct
35 Correct 13 ms 2392 KB Output is correct
36 Correct 13 ms 2396 KB Output is correct
37 Correct 13 ms 2652 KB Output is correct
38 Correct 14 ms 2460 KB Output is correct
39 Correct 14 ms 2452 KB Output is correct
40 Correct 14 ms 2500 KB Output is correct
41 Correct 0 ms 344 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 1 ms 348 KB Output is correct
45 Correct 1 ms 344 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 3 ms 860 KB Output is correct
48 Correct 3 ms 768 KB Output is correct
49 Correct 5 ms 1208 KB Output is correct
50 Correct 10 ms 2044 KB Output is correct
51 Correct 15 ms 2808 KB Output is correct
52 Correct 16 ms 2652 KB Output is correct
53 Correct 16 ms 2904 KB Output is correct
54 Correct 17 ms 2648 KB Output is correct
55 Correct 16 ms 2652 KB Output is correct
56 Correct 16 ms 2648 KB Output is correct
57 Correct 17 ms 2648 KB Output is correct
58 Correct 16 ms 2648 KB Output is correct
59 Correct 15 ms 2652 KB Output is correct
60 Correct 17 ms 2800 KB Output is correct
61 Correct 19 ms 2652 KB Output is correct
62 Correct 16 ms 2652 KB Output is correct
63 Correct 17 ms 2572 KB Output is correct
64 Correct 17 ms 2768 KB Output is correct
65 Correct 16 ms 2652 KB Output is correct
66 Correct 16 ms 2788 KB Output is correct
67 Correct 16 ms 2652 KB Output is correct
68 Correct 16 ms 2652 KB Output is correct
69 Correct 16 ms 2652 KB Output is correct
70 Correct 16 ms 2620 KB Output is correct
71 Correct 3 ms 856 KB Output is correct
72 Correct 3 ms 860 KB Output is correct
73 Correct 6 ms 664 KB Output is correct
74 Correct 3 ms 860 KB Output is correct
75 Correct 3 ms 728 KB Output is correct
76 Correct 5 ms 1116 KB Output is correct
77 Correct 6 ms 1372 KB Output is correct
78 Correct 5 ms 1372 KB Output is correct
79 Correct 5 ms 1116 KB Output is correct
80 Correct 6 ms 1372 KB Output is correct
81 Correct 11 ms 2192 KB Output is correct
82 Correct 10 ms 2212 KB Output is correct
83 Correct 10 ms 2260 KB Output is correct
84 Correct 10 ms 2140 KB Output is correct
85 Correct 11 ms 2136 KB Output is correct
86 Correct 11 ms 2396 KB Output is correct
87 Correct 12 ms 2300 KB Output is correct
88 Correct 12 ms 2284 KB Output is correct
89 Correct 12 ms 2284 KB Output is correct
90 Correct 12 ms 2396 KB Output is correct
91 Correct 19 ms 3540 KB Output is correct
92 Correct 17 ms 3672 KB Output is correct
93 Correct 19 ms 3676 KB Output is correct
94 Correct 24 ms 3612 KB Output is correct
95 Correct 19 ms 3660 KB Output is correct
96 Correct 21 ms 4188 KB Output is correct
97 Correct 20 ms 4092 KB Output is correct
98 Correct 20 ms 4224 KB Output is correct
99 Correct 20 ms 4324 KB Output is correct
100 Correct 22 ms 4184 KB Output is correct
101 Correct 20 ms 4296 KB Output is correct
102 Correct 20 ms 4180 KB Output is correct
103 Correct 19 ms 4184 KB Output is correct
104 Correct 21 ms 4188 KB Output is correct
105 Correct 21 ms 4188 KB Output is correct
106 Correct 20 ms 4432 KB Output is correct
107 Correct 20 ms 4436 KB Output is correct
108 Correct 19 ms 4432 KB Output is correct
109 Correct 19 ms 4432 KB Output is correct
110 Correct 19 ms 4440 KB Output is correct
111 Correct 19 ms 4440 KB Output is correct
112 Correct 19 ms 4444 KB Output is correct
113 Correct 19 ms 4352 KB Output is correct
114 Correct 21 ms 4428 KB Output is correct
115 Correct 22 ms 4432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 4 ms 1116 KB Output is correct
15 Correct 8 ms 1884 KB Output is correct
16 Correct 14 ms 2396 KB Output is correct
17 Correct 14 ms 2908 KB Output is correct
18 Correct 12 ms 2396 KB Output is correct
19 Correct 13 ms 2396 KB Output is correct
20 Correct 13 ms 2652 KB Output is correct
21 Correct 13 ms 2444 KB Output is correct
22 Correct 13 ms 2396 KB Output is correct
23 Correct 13 ms 2468 KB Output is correct
24 Correct 13 ms 2396 KB Output is correct
25 Correct 16 ms 2392 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 5 ms 1116 KB Output is correct
30 Correct 9 ms 1924 KB Output is correct
31 Correct 14 ms 2652 KB Output is correct
32 Correct 14 ms 2560 KB Output is correct
33 Correct 15 ms 2652 KB Output is correct
34 Correct 15 ms 2616 KB Output is correct
35 Correct 13 ms 2392 KB Output is correct
36 Correct 13 ms 2396 KB Output is correct
37 Correct 13 ms 2652 KB Output is correct
38 Correct 14 ms 2460 KB Output is correct
39 Correct 14 ms 2452 KB Output is correct
40 Correct 14 ms 2500 KB Output is correct
41 Correct 0 ms 344 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 1 ms 348 KB Output is correct
45 Correct 1 ms 344 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 3 ms 860 KB Output is correct
48 Correct 3 ms 768 KB Output is correct
49 Correct 5 ms 1208 KB Output is correct
50 Correct 10 ms 2044 KB Output is correct
51 Correct 15 ms 2808 KB Output is correct
52 Correct 16 ms 2652 KB Output is correct
53 Correct 16 ms 2904 KB Output is correct
54 Correct 17 ms 2648 KB Output is correct
55 Correct 16 ms 2652 KB Output is correct
56 Correct 16 ms 2648 KB Output is correct
57 Correct 17 ms 2648 KB Output is correct
58 Correct 16 ms 2648 KB Output is correct
59 Correct 15 ms 2652 KB Output is correct
60 Correct 17 ms 2800 KB Output is correct
61 Correct 19 ms 2652 KB Output is correct
62 Correct 16 ms 2652 KB Output is correct
63 Correct 17 ms 2572 KB Output is correct
64 Correct 17 ms 2768 KB Output is correct
65 Correct 16 ms 2652 KB Output is correct
66 Correct 16 ms 2788 KB Output is correct
67 Correct 16 ms 2652 KB Output is correct
68 Correct 16 ms 2652 KB Output is correct
69 Correct 16 ms 2652 KB Output is correct
70 Correct 16 ms 2620 KB Output is correct
71 Correct 3 ms 856 KB Output is correct
72 Correct 3 ms 860 KB Output is correct
73 Correct 6 ms 664 KB Output is correct
74 Correct 3 ms 860 KB Output is correct
75 Correct 3 ms 728 KB Output is correct
76 Correct 5 ms 1116 KB Output is correct
77 Correct 6 ms 1372 KB Output is correct
78 Correct 5 ms 1372 KB Output is correct
79 Correct 5 ms 1116 KB Output is correct
80 Correct 6 ms 1372 KB Output is correct
81 Correct 11 ms 2192 KB Output is correct
82 Correct 10 ms 2212 KB Output is correct
83 Correct 10 ms 2260 KB Output is correct
84 Correct 10 ms 2140 KB Output is correct
85 Correct 11 ms 2136 KB Output is correct
86 Correct 11 ms 2396 KB Output is correct
87 Correct 12 ms 2300 KB Output is correct
88 Correct 12 ms 2284 KB Output is correct
89 Correct 12 ms 2284 KB Output is correct
90 Correct 12 ms 2396 KB Output is correct
91 Correct 19 ms 3540 KB Output is correct
92 Correct 17 ms 3672 KB Output is correct
93 Correct 19 ms 3676 KB Output is correct
94 Correct 24 ms 3612 KB Output is correct
95 Correct 19 ms 3660 KB Output is correct
96 Correct 21 ms 4188 KB Output is correct
97 Correct 20 ms 4092 KB Output is correct
98 Correct 20 ms 4224 KB Output is correct
99 Correct 20 ms 4324 KB Output is correct
100 Correct 22 ms 4184 KB Output is correct
101 Correct 20 ms 4296 KB Output is correct
102 Correct 20 ms 4180 KB Output is correct
103 Correct 19 ms 4184 KB Output is correct
104 Correct 21 ms 4188 KB Output is correct
105 Correct 21 ms 4188 KB Output is correct
106 Correct 20 ms 4432 KB Output is correct
107 Correct 20 ms 4436 KB Output is correct
108 Correct 19 ms 4432 KB Output is correct
109 Correct 19 ms 4432 KB Output is correct
110 Correct 19 ms 4440 KB Output is correct
111 Correct 19 ms 4440 KB Output is correct
112 Correct 19 ms 4444 KB Output is correct
113 Correct 19 ms 4352 KB Output is correct
114 Correct 21 ms 4428 KB Output is correct
115 Correct 22 ms 4432 KB Output is correct
116 Correct 385 ms 4296 KB Output is correct
117 Correct 415 ms 4300 KB Output is correct
118 Correct 445 ms 4808 KB Output is correct
119 Correct 565 ms 5060 KB Output is correct
120 Correct 451 ms 4808 KB Output is correct
121 Correct 605 ms 5316 KB Output is correct
122 Correct 532 ms 5404 KB Output is correct
123 Correct 968 ms 6080 KB Output is correct
124 Correct 709 ms 6348 KB Output is correct
125 Correct 602 ms 6344 KB Output is correct
126 Correct 1380 ms 6856 KB Output is correct
127 Correct 1353 ms 6860 KB Output is correct
128 Correct 1307 ms 6860 KB Output is correct
129 Correct 1391 ms 6864 KB Output is correct
130 Correct 1357 ms 6800 KB Output is correct
131 Correct 1546 ms 6836 KB Output is correct
132 Correct 1567 ms 6856 KB Output is correct
133 Correct 1533 ms 6832 KB Output is correct
134 Correct 1646 ms 6856 KB Output is correct
135 Correct 1629 ms 6844 KB Output is correct
136 Correct 1632 ms 6852 KB Output is correct
137 Correct 1543 ms 7112 KB Output is correct
138 Correct 1604 ms 6860 KB Output is correct
139 Correct 1608 ms 6828 KB Output is correct
140 Correct 1597 ms 6860 KB Output is correct
141 Correct 1463 ms 6872 KB Output is correct
142 Correct 1512 ms 6856 KB Output is correct
143 Correct 1496 ms 6868 KB Output is correct
144 Correct 1449 ms 6872 KB Output is correct
145 Correct 1453 ms 6856 KB Output is correct
146 Correct 948 ms 7144 KB Output is correct
147 Correct 918 ms 7140 KB Output is correct
148 Correct 972 ms 7136 KB Output is correct
149 Correct 1018 ms 7144 KB Output is correct
150 Correct 931 ms 7140 KB Output is correct
151 Correct 862 ms 7192 KB Output is correct
152 Correct 862 ms 7192 KB Output is correct
153 Correct 913 ms 7188 KB Output is correct
154 Correct 880 ms 7188 KB Output is correct
155 Correct 858 ms 7368 KB Output is correct
156 Correct 1511 ms 7880 KB Output is correct
157 Correct 1499 ms 7780 KB Output is correct
158 Correct 1441 ms 7692 KB Output is correct
159 Correct 1449 ms 7888 KB Output is correct
160 Correct 1435 ms 7876 KB Output is correct
161 Correct 1211 ms 7880 KB Output is correct
162 Correct 1291 ms 7776 KB Output is correct
163 Correct 1254 ms 7880 KB Output is correct
164 Correct 1291 ms 7772 KB Output is correct
165 Correct 1266 ms 7884 KB Output is correct
166 Correct 1462 ms 7368 KB Output is correct
167 Correct 1505 ms 7364 KB Output is correct
168 Correct 1547 ms 7372 KB Output is correct
169 Correct 1518 ms 7368 KB Output is correct
170 Correct 1543 ms 7376 KB Output is correct
171 Correct 1361 ms 7440 KB Output is correct
172 Correct 1362 ms 7368 KB Output is correct
173 Correct 1314 ms 7372 KB Output is correct
174 Correct 1366 ms 7452 KB Output is correct
175 Correct 1284 ms 7372 KB Output is correct