답안 #999455

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
999455 2024-06-15T14:03:36 Z mc061 Diversity (CEOI21_diversity) C++17
100 / 100
2248 ms 6944 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 = 600;
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 0 ms 348 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 1 ms 348 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 1 ms 348 KB Output is correct
4 Correct 4 ms 860 KB Output is correct
5 Correct 8 ms 1372 KB Output is correct
6 Correct 13 ms 1836 KB Output is correct
7 Correct 15 ms 2136 KB Output is correct
8 Correct 12 ms 1628 KB Output is correct
9 Correct 13 ms 1788 KB Output is correct
10 Correct 12 ms 1884 KB Output is correct
11 Correct 13 ms 1852 KB Output is correct
12 Correct 15 ms 1884 KB Output is correct
13 Correct 12 ms 1804 KB Output is correct
14 Correct 13 ms 1940 KB Output is correct
15 Correct 12 ms 1884 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 1 ms 348 KB Output is correct
4 Correct 4 ms 860 KB Output is correct
5 Correct 8 ms 1372 KB Output is correct
6 Correct 13 ms 1836 KB Output is correct
7 Correct 15 ms 2136 KB Output is correct
8 Correct 12 ms 1628 KB Output is correct
9 Correct 13 ms 1788 KB Output is correct
10 Correct 12 ms 1884 KB Output is correct
11 Correct 13 ms 1852 KB Output is correct
12 Correct 15 ms 1884 KB Output is correct
13 Correct 12 ms 1804 KB Output is correct
14 Correct 13 ms 1940 KB Output is correct
15 Correct 12 ms 1884 KB Output is correct
16 Correct 1 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 4 ms 860 KB Output is correct
20 Correct 9 ms 1168 KB Output is correct
21 Correct 13 ms 1676 KB Output is correct
22 Correct 13 ms 1692 KB Output is correct
23 Correct 13 ms 1628 KB Output is correct
24 Correct 13 ms 1628 KB Output is correct
25 Correct 13 ms 1604 KB Output is correct
26 Correct 14 ms 1628 KB Output is correct
27 Correct 13 ms 1628 KB Output is correct
28 Correct 14 ms 1820 KB Output is correct
29 Correct 14 ms 1740 KB Output is correct
30 Correct 14 ms 1624 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 1 ms 348 KB Output is correct
4 Correct 4 ms 860 KB Output is correct
5 Correct 8 ms 1372 KB Output is correct
6 Correct 13 ms 1836 KB Output is correct
7 Correct 15 ms 2136 KB Output is correct
8 Correct 12 ms 1628 KB Output is correct
9 Correct 13 ms 1788 KB Output is correct
10 Correct 12 ms 1884 KB Output is correct
11 Correct 13 ms 1852 KB Output is correct
12 Correct 15 ms 1884 KB Output is correct
13 Correct 12 ms 1804 KB Output is correct
14 Correct 13 ms 1940 KB Output is correct
15 Correct 12 ms 1884 KB Output is correct
16 Correct 1 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 4 ms 860 KB Output is correct
20 Correct 9 ms 1168 KB Output is correct
21 Correct 13 ms 1676 KB Output is correct
22 Correct 13 ms 1692 KB Output is correct
23 Correct 13 ms 1628 KB Output is correct
24 Correct 13 ms 1628 KB Output is correct
25 Correct 13 ms 1604 KB Output is correct
26 Correct 14 ms 1628 KB Output is correct
27 Correct 13 ms 1628 KB Output is correct
28 Correct 14 ms 1820 KB Output is correct
29 Correct 14 ms 1740 KB Output is correct
30 Correct 14 ms 1624 KB Output is correct
31 Correct 0 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 484 KB Output is correct
37 Correct 3 ms 604 KB Output is correct
38 Correct 3 ms 580 KB Output is correct
39 Correct 8 ms 860 KB Output is correct
40 Correct 10 ms 1272 KB Output is correct
41 Correct 17 ms 1668 KB Output is correct
42 Correct 20 ms 1628 KB Output is correct
43 Correct 16 ms 1624 KB Output is correct
44 Correct 16 ms 1484 KB Output is correct
45 Correct 16 ms 1628 KB Output is correct
46 Correct 15 ms 1556 KB Output is correct
47 Correct 15 ms 1624 KB Output is correct
48 Correct 16 ms 1644 KB Output is correct
49 Correct 15 ms 1628 KB Output is correct
50 Correct 25 ms 1576 KB Output is correct
51 Correct 15 ms 1628 KB Output is correct
52 Correct 15 ms 1628 KB Output is correct
53 Correct 17 ms 1628 KB Output is correct
54 Correct 16 ms 1440 KB Output is correct
55 Correct 17 ms 1628 KB Output is correct
56 Correct 16 ms 1624 KB Output is correct
57 Correct 15 ms 1628 KB Output is correct
58 Correct 15 ms 1660 KB Output is correct
59 Correct 15 ms 1624 KB Output is correct
60 Correct 16 ms 1628 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 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 1 ms 348 KB Output is correct
11 Correct 1 ms 344 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 860 KB Output is correct
15 Correct 8 ms 1372 KB Output is correct
16 Correct 13 ms 1836 KB Output is correct
17 Correct 15 ms 2136 KB Output is correct
18 Correct 12 ms 1628 KB Output is correct
19 Correct 13 ms 1788 KB Output is correct
20 Correct 12 ms 1884 KB Output is correct
21 Correct 13 ms 1852 KB Output is correct
22 Correct 15 ms 1884 KB Output is correct
23 Correct 12 ms 1804 KB Output is correct
24 Correct 13 ms 1940 KB Output is correct
25 Correct 12 ms 1884 KB Output is correct
26 Correct 1 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 4 ms 860 KB Output is correct
30 Correct 9 ms 1168 KB Output is correct
31 Correct 13 ms 1676 KB Output is correct
32 Correct 13 ms 1692 KB Output is correct
33 Correct 13 ms 1628 KB Output is correct
34 Correct 13 ms 1628 KB Output is correct
35 Correct 13 ms 1604 KB Output is correct
36 Correct 14 ms 1628 KB Output is correct
37 Correct 13 ms 1628 KB Output is correct
38 Correct 14 ms 1820 KB Output is correct
39 Correct 14 ms 1740 KB Output is correct
40 Correct 14 ms 1624 KB Output is correct
41 Correct 0 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 484 KB Output is correct
47 Correct 3 ms 604 KB Output is correct
48 Correct 3 ms 580 KB Output is correct
49 Correct 8 ms 860 KB Output is correct
50 Correct 10 ms 1272 KB Output is correct
51 Correct 17 ms 1668 KB Output is correct
52 Correct 20 ms 1628 KB Output is correct
53 Correct 16 ms 1624 KB Output is correct
54 Correct 16 ms 1484 KB Output is correct
55 Correct 16 ms 1628 KB Output is correct
56 Correct 15 ms 1556 KB Output is correct
57 Correct 15 ms 1624 KB Output is correct
58 Correct 16 ms 1644 KB Output is correct
59 Correct 15 ms 1628 KB Output is correct
60 Correct 25 ms 1576 KB Output is correct
61 Correct 15 ms 1628 KB Output is correct
62 Correct 15 ms 1628 KB Output is correct
63 Correct 17 ms 1628 KB Output is correct
64 Correct 16 ms 1440 KB Output is correct
65 Correct 17 ms 1628 KB Output is correct
66 Correct 16 ms 1624 KB Output is correct
67 Correct 15 ms 1628 KB Output is correct
68 Correct 15 ms 1660 KB Output is correct
69 Correct 15 ms 1624 KB Output is correct
70 Correct 16 ms 1628 KB Output is correct
71 Correct 3 ms 604 KB Output is correct
72 Correct 3 ms 604 KB Output is correct
73 Correct 3 ms 604 KB Output is correct
74 Correct 3 ms 604 KB Output is correct
75 Correct 3 ms 604 KB Output is correct
76 Correct 5 ms 860 KB Output is correct
77 Correct 5 ms 860 KB Output is correct
78 Correct 5 ms 660 KB Output is correct
79 Correct 5 ms 860 KB Output is correct
80 Correct 5 ms 872 KB Output is correct
81 Correct 10 ms 1116 KB Output is correct
82 Correct 10 ms 1212 KB Output is correct
83 Correct 10 ms 1112 KB Output is correct
84 Correct 10 ms 1116 KB Output is correct
85 Correct 10 ms 1116 KB Output is correct
86 Correct 11 ms 1116 KB Output is correct
87 Correct 13 ms 1116 KB Output is correct
88 Correct 11 ms 1264 KB Output is correct
89 Correct 11 ms 1116 KB Output is correct
90 Correct 11 ms 1116 KB Output is correct
91 Correct 17 ms 1884 KB Output is correct
92 Correct 17 ms 1976 KB Output is correct
93 Correct 17 ms 1884 KB Output is correct
94 Correct 17 ms 2024 KB Output is correct
95 Correct 18 ms 1880 KB Output is correct
96 Correct 23 ms 2340 KB Output is correct
97 Correct 21 ms 2392 KB Output is correct
98 Correct 19 ms 2328 KB Output is correct
99 Correct 19 ms 2396 KB Output is correct
100 Correct 19 ms 2396 KB Output is correct
101 Correct 19 ms 2396 KB Output is correct
102 Correct 19 ms 2396 KB Output is correct
103 Correct 19 ms 2396 KB Output is correct
104 Correct 26 ms 2396 KB Output is correct
105 Correct 22 ms 2392 KB Output is correct
106 Correct 18 ms 2396 KB Output is correct
107 Correct 19 ms 2392 KB Output is correct
108 Correct 19 ms 2616 KB Output is correct
109 Correct 19 ms 2396 KB Output is correct
110 Correct 18 ms 2596 KB Output is correct
111 Correct 19 ms 2392 KB Output is correct
112 Correct 19 ms 2620 KB Output is correct
113 Correct 25 ms 2388 KB Output is correct
114 Correct 28 ms 2388 KB Output is correct
115 Correct 18 ms 2592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 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 1 ms 348 KB Output is correct
11 Correct 1 ms 344 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 860 KB Output is correct
15 Correct 8 ms 1372 KB Output is correct
16 Correct 13 ms 1836 KB Output is correct
17 Correct 15 ms 2136 KB Output is correct
18 Correct 12 ms 1628 KB Output is correct
19 Correct 13 ms 1788 KB Output is correct
20 Correct 12 ms 1884 KB Output is correct
21 Correct 13 ms 1852 KB Output is correct
22 Correct 15 ms 1884 KB Output is correct
23 Correct 12 ms 1804 KB Output is correct
24 Correct 13 ms 1940 KB Output is correct
25 Correct 12 ms 1884 KB Output is correct
26 Correct 1 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 4 ms 860 KB Output is correct
30 Correct 9 ms 1168 KB Output is correct
31 Correct 13 ms 1676 KB Output is correct
32 Correct 13 ms 1692 KB Output is correct
33 Correct 13 ms 1628 KB Output is correct
34 Correct 13 ms 1628 KB Output is correct
35 Correct 13 ms 1604 KB Output is correct
36 Correct 14 ms 1628 KB Output is correct
37 Correct 13 ms 1628 KB Output is correct
38 Correct 14 ms 1820 KB Output is correct
39 Correct 14 ms 1740 KB Output is correct
40 Correct 14 ms 1624 KB Output is correct
41 Correct 0 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 484 KB Output is correct
47 Correct 3 ms 604 KB Output is correct
48 Correct 3 ms 580 KB Output is correct
49 Correct 8 ms 860 KB Output is correct
50 Correct 10 ms 1272 KB Output is correct
51 Correct 17 ms 1668 KB Output is correct
52 Correct 20 ms 1628 KB Output is correct
53 Correct 16 ms 1624 KB Output is correct
54 Correct 16 ms 1484 KB Output is correct
55 Correct 16 ms 1628 KB Output is correct
56 Correct 15 ms 1556 KB Output is correct
57 Correct 15 ms 1624 KB Output is correct
58 Correct 16 ms 1644 KB Output is correct
59 Correct 15 ms 1628 KB Output is correct
60 Correct 25 ms 1576 KB Output is correct
61 Correct 15 ms 1628 KB Output is correct
62 Correct 15 ms 1628 KB Output is correct
63 Correct 17 ms 1628 KB Output is correct
64 Correct 16 ms 1440 KB Output is correct
65 Correct 17 ms 1628 KB Output is correct
66 Correct 16 ms 1624 KB Output is correct
67 Correct 15 ms 1628 KB Output is correct
68 Correct 15 ms 1660 KB Output is correct
69 Correct 15 ms 1624 KB Output is correct
70 Correct 16 ms 1628 KB Output is correct
71 Correct 3 ms 604 KB Output is correct
72 Correct 3 ms 604 KB Output is correct
73 Correct 3 ms 604 KB Output is correct
74 Correct 3 ms 604 KB Output is correct
75 Correct 3 ms 604 KB Output is correct
76 Correct 5 ms 860 KB Output is correct
77 Correct 5 ms 860 KB Output is correct
78 Correct 5 ms 660 KB Output is correct
79 Correct 5 ms 860 KB Output is correct
80 Correct 5 ms 872 KB Output is correct
81 Correct 10 ms 1116 KB Output is correct
82 Correct 10 ms 1212 KB Output is correct
83 Correct 10 ms 1112 KB Output is correct
84 Correct 10 ms 1116 KB Output is correct
85 Correct 10 ms 1116 KB Output is correct
86 Correct 11 ms 1116 KB Output is correct
87 Correct 13 ms 1116 KB Output is correct
88 Correct 11 ms 1264 KB Output is correct
89 Correct 11 ms 1116 KB Output is correct
90 Correct 11 ms 1116 KB Output is correct
91 Correct 17 ms 1884 KB Output is correct
92 Correct 17 ms 1976 KB Output is correct
93 Correct 17 ms 1884 KB Output is correct
94 Correct 17 ms 2024 KB Output is correct
95 Correct 18 ms 1880 KB Output is correct
96 Correct 23 ms 2340 KB Output is correct
97 Correct 21 ms 2392 KB Output is correct
98 Correct 19 ms 2328 KB Output is correct
99 Correct 19 ms 2396 KB Output is correct
100 Correct 19 ms 2396 KB Output is correct
101 Correct 19 ms 2396 KB Output is correct
102 Correct 19 ms 2396 KB Output is correct
103 Correct 19 ms 2396 KB Output is correct
104 Correct 26 ms 2396 KB Output is correct
105 Correct 22 ms 2392 KB Output is correct
106 Correct 18 ms 2396 KB Output is correct
107 Correct 19 ms 2392 KB Output is correct
108 Correct 19 ms 2616 KB Output is correct
109 Correct 19 ms 2396 KB Output is correct
110 Correct 18 ms 2596 KB Output is correct
111 Correct 19 ms 2392 KB Output is correct
112 Correct 19 ms 2620 KB Output is correct
113 Correct 25 ms 2388 KB Output is correct
114 Correct 28 ms 2388 KB Output is correct
115 Correct 18 ms 2592 KB Output is correct
116 Correct 343 ms 3692 KB Output is correct
117 Correct 384 ms 3796 KB Output is correct
118 Correct 438 ms 4040 KB Output is correct
119 Correct 507 ms 4092 KB Output is correct
120 Correct 461 ms 4100 KB Output is correct
121 Correct 619 ms 4296 KB Output is correct
122 Correct 534 ms 4300 KB Output is correct
123 Correct 1151 ms 4692 KB Output is correct
124 Correct 747 ms 4808 KB Output is correct
125 Correct 745 ms 4724 KB Output is correct
126 Correct 1822 ms 5096 KB Output is correct
127 Correct 1801 ms 5092 KB Output is correct
128 Correct 1756 ms 5096 KB Output is correct
129 Correct 1821 ms 5064 KB Output is correct
130 Correct 1855 ms 5096 KB Output is correct
131 Correct 2176 ms 5156 KB Output is correct
132 Correct 2166 ms 5056 KB Output is correct
133 Correct 2093 ms 5084 KB Output is correct
134 Correct 2178 ms 5068 KB Output is correct
135 Correct 2174 ms 5084 KB Output is correct
136 Correct 2184 ms 5064 KB Output is correct
137 Correct 2153 ms 5172 KB Output is correct
138 Correct 2142 ms 5096 KB Output is correct
139 Correct 2117 ms 5076 KB Output is correct
140 Correct 2134 ms 5176 KB Output is correct
141 Correct 1940 ms 5084 KB Output is correct
142 Correct 2107 ms 5080 KB Output is correct
143 Correct 2119 ms 6108 KB Output is correct
144 Correct 2064 ms 6108 KB Output is correct
145 Correct 2092 ms 6104 KB Output is correct
146 Correct 1206 ms 6452 KB Output is correct
147 Correct 1269 ms 6340 KB Output is correct
148 Correct 1313 ms 6372 KB Output is correct
149 Correct 1241 ms 6368 KB Output is correct
150 Correct 1212 ms 6368 KB Output is correct
151 Correct 1175 ms 6388 KB Output is correct
152 Correct 1167 ms 6392 KB Output is correct
153 Correct 1181 ms 6392 KB Output is correct
154 Correct 1201 ms 6388 KB Output is correct
155 Correct 1139 ms 6392 KB Output is correct
156 Correct 2124 ms 6920 KB Output is correct
157 Correct 2174 ms 6944 KB Output is correct
158 Correct 2105 ms 6872 KB Output is correct
159 Correct 2069 ms 6876 KB Output is correct
160 Correct 2138 ms 6880 KB Output is correct
161 Correct 1913 ms 6920 KB Output is correct
162 Correct 1894 ms 6852 KB Output is correct
163 Correct 1893 ms 6828 KB Output is correct
164 Correct 1864 ms 6852 KB Output is correct
165 Correct 1902 ms 6856 KB Output is correct
166 Correct 2163 ms 6440 KB Output is correct
167 Correct 2248 ms 6396 KB Output is correct
168 Correct 2148 ms 6352 KB Output is correct
169 Correct 2115 ms 6432 KB Output is correct
170 Correct 2199 ms 6412 KB Output is correct
171 Correct 1942 ms 6676 KB Output is correct
172 Correct 1863 ms 6604 KB Output is correct
173 Correct 1740 ms 6604 KB Output is correct
174 Correct 1750 ms 6676 KB Output is correct
175 Correct 1728 ms 6696 KB Output is correct