답안 #999459

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
999459 2024-06-15T14:06:04 Z mc061 Diversity (CEOI21_diversity) C++17
100 / 100
1444 ms 6348 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 = 1500;
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 0 ms 344 KB Output is correct
2 Correct 1 ms 356 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 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 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 456 KB Output is correct
2 Correct 0 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 1872 KB Output is correct
6 Correct 19 ms 2396 KB Output is correct
7 Correct 12 ms 2652 KB Output is correct
8 Correct 13 ms 2216 KB Output is correct
9 Correct 12 ms 2396 KB Output is correct
10 Correct 15 ms 2340 KB Output is correct
11 Correct 13 ms 2396 KB Output is correct
12 Correct 13 ms 2268 KB Output is correct
13 Correct 12 ms 2140 KB Output is correct
14 Correct 14 ms 2392 KB Output is correct
15 Correct 12 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 456 KB Output is correct
2 Correct 0 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 1872 KB Output is correct
6 Correct 19 ms 2396 KB Output is correct
7 Correct 12 ms 2652 KB Output is correct
8 Correct 13 ms 2216 KB Output is correct
9 Correct 12 ms 2396 KB Output is correct
10 Correct 15 ms 2340 KB Output is correct
11 Correct 13 ms 2396 KB Output is correct
12 Correct 13 ms 2268 KB Output is correct
13 Correct 12 ms 2140 KB Output is correct
14 Correct 14 ms 2392 KB Output is correct
15 Correct 12 ms 2396 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 5 ms 1116 KB Output is correct
20 Correct 9 ms 1688 KB Output is correct
21 Correct 13 ms 2524 KB Output is correct
22 Correct 13 ms 2396 KB Output is correct
23 Correct 14 ms 2396 KB Output is correct
24 Correct 13 ms 2396 KB Output is correct
25 Correct 13 ms 2544 KB Output is correct
26 Correct 13 ms 2200 KB Output is correct
27 Correct 13 ms 2396 KB Output is correct
28 Correct 13 ms 2396 KB Output is correct
29 Correct 13 ms 2320 KB Output is correct
30 Correct 14 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 456 KB Output is correct
2 Correct 0 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 1872 KB Output is correct
6 Correct 19 ms 2396 KB Output is correct
7 Correct 12 ms 2652 KB Output is correct
8 Correct 13 ms 2216 KB Output is correct
9 Correct 12 ms 2396 KB Output is correct
10 Correct 15 ms 2340 KB Output is correct
11 Correct 13 ms 2396 KB Output is correct
12 Correct 13 ms 2268 KB Output is correct
13 Correct 12 ms 2140 KB Output is correct
14 Correct 14 ms 2392 KB Output is correct
15 Correct 12 ms 2396 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 5 ms 1116 KB Output is correct
20 Correct 9 ms 1688 KB Output is correct
21 Correct 13 ms 2524 KB Output is correct
22 Correct 13 ms 2396 KB Output is correct
23 Correct 14 ms 2396 KB Output is correct
24 Correct 13 ms 2396 KB Output is correct
25 Correct 13 ms 2544 KB Output is correct
26 Correct 13 ms 2200 KB Output is correct
27 Correct 13 ms 2396 KB Output is correct
28 Correct 13 ms 2396 KB Output is correct
29 Correct 13 ms 2320 KB Output is correct
30 Correct 14 ms 2396 KB Output is correct
31 Correct 1 ms 348 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 348 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 860 KB Output is correct
39 Correct 6 ms 1168 KB Output is correct
40 Correct 12 ms 1628 KB Output is correct
41 Correct 15 ms 2396 KB Output is correct
42 Correct 15 ms 2396 KB Output is correct
43 Correct 16 ms 2396 KB Output is correct
44 Correct 16 ms 2396 KB Output is correct
45 Correct 16 ms 2396 KB Output is correct
46 Correct 16 ms 2396 KB Output is correct
47 Correct 16 ms 2396 KB Output is correct
48 Correct 16 ms 2388 KB Output is correct
49 Correct 16 ms 2396 KB Output is correct
50 Correct 15 ms 2384 KB Output is correct
51 Correct 16 ms 2396 KB Output is correct
52 Correct 16 ms 2392 KB Output is correct
53 Correct 18 ms 2392 KB Output is correct
54 Correct 16 ms 2212 KB Output is correct
55 Correct 16 ms 2392 KB Output is correct
56 Correct 16 ms 2384 KB Output is correct
57 Correct 19 ms 2392 KB Output is correct
58 Correct 16 ms 2648 KB Output is correct
59 Correct 16 ms 2396 KB Output is correct
60 Correct 16 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 356 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 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 344 KB Output is correct
11 Correct 0 ms 456 KB Output is correct
12 Correct 0 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 1872 KB Output is correct
16 Correct 19 ms 2396 KB Output is correct
17 Correct 12 ms 2652 KB Output is correct
18 Correct 13 ms 2216 KB Output is correct
19 Correct 12 ms 2396 KB Output is correct
20 Correct 15 ms 2340 KB Output is correct
21 Correct 13 ms 2396 KB Output is correct
22 Correct 13 ms 2268 KB Output is correct
23 Correct 12 ms 2140 KB Output is correct
24 Correct 14 ms 2392 KB Output is correct
25 Correct 12 ms 2396 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 344 KB Output is correct
29 Correct 5 ms 1116 KB Output is correct
30 Correct 9 ms 1688 KB Output is correct
31 Correct 13 ms 2524 KB Output is correct
32 Correct 13 ms 2396 KB Output is correct
33 Correct 14 ms 2396 KB Output is correct
34 Correct 13 ms 2396 KB Output is correct
35 Correct 13 ms 2544 KB Output is correct
36 Correct 13 ms 2200 KB Output is correct
37 Correct 13 ms 2396 KB Output is correct
38 Correct 13 ms 2396 KB Output is correct
39 Correct 13 ms 2320 KB Output is correct
40 Correct 14 ms 2396 KB Output is correct
41 Correct 1 ms 348 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 348 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 860 KB Output is correct
49 Correct 6 ms 1168 KB Output is correct
50 Correct 12 ms 1628 KB Output is correct
51 Correct 15 ms 2396 KB Output is correct
52 Correct 15 ms 2396 KB Output is correct
53 Correct 16 ms 2396 KB Output is correct
54 Correct 16 ms 2396 KB Output is correct
55 Correct 16 ms 2396 KB Output is correct
56 Correct 16 ms 2396 KB Output is correct
57 Correct 16 ms 2396 KB Output is correct
58 Correct 16 ms 2388 KB Output is correct
59 Correct 16 ms 2396 KB Output is correct
60 Correct 15 ms 2384 KB Output is correct
61 Correct 16 ms 2396 KB Output is correct
62 Correct 16 ms 2392 KB Output is correct
63 Correct 18 ms 2392 KB Output is correct
64 Correct 16 ms 2212 KB Output is correct
65 Correct 16 ms 2392 KB Output is correct
66 Correct 16 ms 2384 KB Output is correct
67 Correct 19 ms 2392 KB Output is correct
68 Correct 16 ms 2648 KB Output is correct
69 Correct 16 ms 2396 KB Output is correct
70 Correct 16 ms 2392 KB Output is correct
71 Correct 3 ms 860 KB Output is correct
72 Correct 3 ms 860 KB Output is correct
73 Correct 3 ms 844 KB Output is correct
74 Correct 3 ms 860 KB Output is correct
75 Correct 4 ms 860 KB Output is correct
76 Correct 5 ms 1356 KB Output is correct
77 Correct 5 ms 1372 KB Output is correct
78 Correct 6 ms 1376 KB Output is correct
79 Correct 6 ms 1252 KB Output is correct
80 Correct 5 ms 1372 KB Output is correct
81 Correct 11 ms 1940 KB Output is correct
82 Correct 11 ms 1884 KB Output is correct
83 Correct 11 ms 2036 KB Output is correct
84 Correct 13 ms 1872 KB Output is correct
85 Correct 11 ms 1964 KB Output is correct
86 Correct 11 ms 1880 KB Output is correct
87 Correct 11 ms 1976 KB Output is correct
88 Correct 12 ms 2028 KB Output is correct
89 Correct 12 ms 1924 KB Output is correct
90 Correct 12 ms 1880 KB Output is correct
91 Correct 18 ms 2908 KB Output is correct
92 Correct 18 ms 2952 KB Output is correct
93 Correct 19 ms 3052 KB Output is correct
94 Correct 18 ms 2896 KB Output is correct
95 Correct 17 ms 2904 KB Output is correct
96 Correct 20 ms 3668 KB Output is correct
97 Correct 24 ms 3664 KB Output is correct
98 Correct 20 ms 3672 KB Output is correct
99 Correct 25 ms 3508 KB Output is correct
100 Correct 20 ms 3676 KB Output is correct
101 Correct 20 ms 3476 KB Output is correct
102 Correct 20 ms 3664 KB Output is correct
103 Correct 20 ms 3676 KB Output is correct
104 Correct 26 ms 3668 KB Output is correct
105 Correct 19 ms 3676 KB Output is correct
106 Correct 20 ms 3676 KB Output is correct
107 Correct 21 ms 3716 KB Output is correct
108 Correct 19 ms 3748 KB Output is correct
109 Correct 27 ms 3672 KB Output is correct
110 Correct 23 ms 3676 KB Output is correct
111 Correct 21 ms 3676 KB Output is correct
112 Correct 20 ms 3804 KB Output is correct
113 Correct 19 ms 3676 KB Output is correct
114 Correct 21 ms 3832 KB Output is correct
115 Correct 21 ms 3756 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 356 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 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 344 KB Output is correct
11 Correct 0 ms 456 KB Output is correct
12 Correct 0 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 1872 KB Output is correct
16 Correct 19 ms 2396 KB Output is correct
17 Correct 12 ms 2652 KB Output is correct
18 Correct 13 ms 2216 KB Output is correct
19 Correct 12 ms 2396 KB Output is correct
20 Correct 15 ms 2340 KB Output is correct
21 Correct 13 ms 2396 KB Output is correct
22 Correct 13 ms 2268 KB Output is correct
23 Correct 12 ms 2140 KB Output is correct
24 Correct 14 ms 2392 KB Output is correct
25 Correct 12 ms 2396 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 344 KB Output is correct
29 Correct 5 ms 1116 KB Output is correct
30 Correct 9 ms 1688 KB Output is correct
31 Correct 13 ms 2524 KB Output is correct
32 Correct 13 ms 2396 KB Output is correct
33 Correct 14 ms 2396 KB Output is correct
34 Correct 13 ms 2396 KB Output is correct
35 Correct 13 ms 2544 KB Output is correct
36 Correct 13 ms 2200 KB Output is correct
37 Correct 13 ms 2396 KB Output is correct
38 Correct 13 ms 2396 KB Output is correct
39 Correct 13 ms 2320 KB Output is correct
40 Correct 14 ms 2396 KB Output is correct
41 Correct 1 ms 348 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 348 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 860 KB Output is correct
49 Correct 6 ms 1168 KB Output is correct
50 Correct 12 ms 1628 KB Output is correct
51 Correct 15 ms 2396 KB Output is correct
52 Correct 15 ms 2396 KB Output is correct
53 Correct 16 ms 2396 KB Output is correct
54 Correct 16 ms 2396 KB Output is correct
55 Correct 16 ms 2396 KB Output is correct
56 Correct 16 ms 2396 KB Output is correct
57 Correct 16 ms 2396 KB Output is correct
58 Correct 16 ms 2388 KB Output is correct
59 Correct 16 ms 2396 KB Output is correct
60 Correct 15 ms 2384 KB Output is correct
61 Correct 16 ms 2396 KB Output is correct
62 Correct 16 ms 2392 KB Output is correct
63 Correct 18 ms 2392 KB Output is correct
64 Correct 16 ms 2212 KB Output is correct
65 Correct 16 ms 2392 KB Output is correct
66 Correct 16 ms 2384 KB Output is correct
67 Correct 19 ms 2392 KB Output is correct
68 Correct 16 ms 2648 KB Output is correct
69 Correct 16 ms 2396 KB Output is correct
70 Correct 16 ms 2392 KB Output is correct
71 Correct 3 ms 860 KB Output is correct
72 Correct 3 ms 860 KB Output is correct
73 Correct 3 ms 844 KB Output is correct
74 Correct 3 ms 860 KB Output is correct
75 Correct 4 ms 860 KB Output is correct
76 Correct 5 ms 1356 KB Output is correct
77 Correct 5 ms 1372 KB Output is correct
78 Correct 6 ms 1376 KB Output is correct
79 Correct 6 ms 1252 KB Output is correct
80 Correct 5 ms 1372 KB Output is correct
81 Correct 11 ms 1940 KB Output is correct
82 Correct 11 ms 1884 KB Output is correct
83 Correct 11 ms 2036 KB Output is correct
84 Correct 13 ms 1872 KB Output is correct
85 Correct 11 ms 1964 KB Output is correct
86 Correct 11 ms 1880 KB Output is correct
87 Correct 11 ms 1976 KB Output is correct
88 Correct 12 ms 2028 KB Output is correct
89 Correct 12 ms 1924 KB Output is correct
90 Correct 12 ms 1880 KB Output is correct
91 Correct 18 ms 2908 KB Output is correct
92 Correct 18 ms 2952 KB Output is correct
93 Correct 19 ms 3052 KB Output is correct
94 Correct 18 ms 2896 KB Output is correct
95 Correct 17 ms 2904 KB Output is correct
96 Correct 20 ms 3668 KB Output is correct
97 Correct 24 ms 3664 KB Output is correct
98 Correct 20 ms 3672 KB Output is correct
99 Correct 25 ms 3508 KB Output is correct
100 Correct 20 ms 3676 KB Output is correct
101 Correct 20 ms 3476 KB Output is correct
102 Correct 20 ms 3664 KB Output is correct
103 Correct 20 ms 3676 KB Output is correct
104 Correct 26 ms 3668 KB Output is correct
105 Correct 19 ms 3676 KB Output is correct
106 Correct 20 ms 3676 KB Output is correct
107 Correct 21 ms 3716 KB Output is correct
108 Correct 19 ms 3748 KB Output is correct
109 Correct 27 ms 3672 KB Output is correct
110 Correct 23 ms 3676 KB Output is correct
111 Correct 21 ms 3676 KB Output is correct
112 Correct 20 ms 3804 KB Output is correct
113 Correct 19 ms 3676 KB Output is correct
114 Correct 21 ms 3832 KB Output is correct
115 Correct 21 ms 3756 KB Output is correct
116 Correct 472 ms 4296 KB Output is correct
117 Correct 490 ms 4204 KB Output is correct
118 Correct 509 ms 4808 KB Output is correct
119 Correct 586 ms 4620 KB Output is correct
120 Correct 486 ms 4552 KB Output is correct
121 Correct 647 ms 5060 KB Output is correct
122 Correct 556 ms 5060 KB Output is correct
123 Correct 940 ms 5728 KB Output is correct
124 Correct 743 ms 5736 KB Output is correct
125 Correct 612 ms 5832 KB Output is correct
126 Correct 1158 ms 6008 KB Output is correct
127 Correct 1180 ms 6136 KB Output is correct
128 Correct 1201 ms 6348 KB Output is correct
129 Correct 1206 ms 6116 KB Output is correct
130 Correct 1255 ms 6120 KB Output is correct
131 Correct 1444 ms 6112 KB Output is correct
132 Correct 1438 ms 6124 KB Output is correct
133 Correct 1383 ms 6104 KB Output is correct
134 Correct 1441 ms 6116 KB Output is correct
135 Correct 1402 ms 6116 KB Output is correct
136 Correct 1423 ms 6092 KB Output is correct
137 Correct 1419 ms 6092 KB Output is correct
138 Correct 1414 ms 6092 KB Output is correct
139 Correct 1432 ms 6064 KB Output is correct
140 Correct 1411 ms 6088 KB Output is correct
141 Correct 1341 ms 6092 KB Output is correct
142 Correct 1354 ms 6180 KB Output is correct
143 Correct 1332 ms 5084 KB Output is correct
144 Correct 1372 ms 5064 KB Output is correct
145 Correct 1328 ms 5080 KB Output is correct
146 Correct 865 ms 5088 KB Output is correct
147 Correct 850 ms 5060 KB Output is correct
148 Correct 867 ms 5320 KB Output is correct
149 Correct 862 ms 5088 KB Output is correct
150 Correct 854 ms 5068 KB Output is correct
151 Correct 790 ms 5064 KB Output is correct
152 Correct 781 ms 5104 KB Output is correct
153 Correct 779 ms 5112 KB Output is correct
154 Correct 765 ms 5112 KB Output is correct
155 Correct 796 ms 5128 KB Output is correct
156 Correct 1287 ms 5392 KB Output is correct
157 Correct 1336 ms 5408 KB Output is correct
158 Correct 1298 ms 5336 KB Output is correct
159 Correct 1300 ms 5340 KB Output is correct
160 Correct 1260 ms 5324 KB Output is correct
161 Correct 1037 ms 5580 KB Output is correct
162 Correct 1037 ms 5312 KB Output is correct
163 Correct 1037 ms 5296 KB Output is correct
164 Correct 1038 ms 5312 KB Output is correct
165 Correct 1042 ms 5284 KB Output is correct
166 Correct 1363 ms 5120 KB Output is correct
167 Correct 1376 ms 5168 KB Output is correct
168 Correct 1341 ms 5068 KB Output is correct
169 Correct 1334 ms 5172 KB Output is correct
170 Correct 1326 ms 5136 KB Output is correct
171 Correct 1176 ms 5128 KB Output is correct
172 Correct 1177 ms 5064 KB Output is correct
173 Correct 1210 ms 5064 KB Output is correct
174 Correct 1173 ms 5148 KB Output is correct
175 Correct 1185 ms 5156 KB Output is correct