Submission #971717

# Submission time Handle Problem Language Result Execution time Memory
971717 2024-04-29T08:11:37 Z Szil Diversity (CEOI21_diversity) C++14
100 / 100
5399 ms 15444 KB
#include <bits/stdc++.h>
    
using namespace std;
using ll = long long;
    
const int MAXN = 300'001;
const int BLOCK = 650;
const int BLOCK2 = 1300;
    
struct Query {
    int l, r, idx;
    
    bool operator<(Query x) const {
        if (l / BLOCK == x.l / BLOCK) return (l / BLOCK) & 1 ? r > x.r : r < x.r;
        return l < x.l;
    }
};
    
int a[MAXN], b[MAXN], c[BLOCK2];
map<int, int> act;
ll ans[MAXN], negyzet[MAXN];

void inc(int v) {
    if (b[v] < BLOCK2) {
        c[b[v]]++;
    } else {
        act[b[v]]++;
    }
}

void dec(int v) {
    if (b[v] < BLOCK2) {
        c[b[v]]--;
    } else {
        act[b[v]]--;
    }
}

void add(int i) {
    int v = a[i];
    dec(v);
    b[v]++;
    inc(v);
}
    
void remove(int i) {
    int v = a[i];
    dec(v);
    b[v]--;
    inc(v);
}
    
int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n, q; cin >> n >> q;
    for (ll i = 1; i <= n; i++) {
        negyzet[i] = negyzet[i-1] + i*i;
    }
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    vector<Query> qrys(q);
    for (int i = 0; i < q; i++) {
        cin >> qrys[i].l >> qrys[i].r;
        qrys[i].idx = i+1;
    }
    sort(qrys.begin(), qrys.end());
    int l = 1, r = 0;
    for (auto [nl, nr, idx] : qrys) {
        while (r < nr) add(++r);
        while (r > nr) remove(r--);
        while (l < nl) remove(l++);
        while (l > nl) add(--l);
    
        deque<pair<ll, ll>> dq;
        int d = 0;
    
        auto push = [&](int a, int b) {
            if (d) dq.emplace_back(a, b);
            else dq.emplace_front(a, b);
            d ^= 1;
        };
    
    
        for (auto it = act.rbegin(); it != act.rend(); it++) {
            auto [len, cnt] = *it;
            if (cnt == 0) continue;
            if (cnt & 1) {
                push(len, 1);
                cnt--;
            }
            push(len, cnt/2);
            push(len, cnt/2);
        }

        for (int i = BLOCK2-1; i >= 1; i--) {
            int len = i, cnt = c[i];
            if (cnt == 0) continue;
            if (cnt & 1) {
                push(len, 1);
                cnt--;
            }
            push(len, cnt/2);
            push(len, cnt/2);
        }
    
        for (auto it = act.begin(); it != act.end();) {
            auto [len, cnt] = *it;
            if (cnt == 0) {
                it = act.erase(it);
            } else {
                it++;
            }
        }
    
        auto sum_arit = [&](ll start, ll d, ll cnt) {
            return start*cnt + d * (cnt - 1) * cnt / 2;
        };
    
        ll pref = 0;
        int x = nr-nl+1;
        for (auto [len, cnt] : dq) {
            ans[idx] += cnt * (len*(len+1)/2);
            ans[idx] += cnt * (len*(x-len));
            ans[idx] += (x - len) * sum_arit(pref, len, cnt);
            ans[idx] -= pref * pref * cnt;
            ans[idx] -= pref * sum_arit(0, 2*len, cnt);
            ans[idx] -= len * len * negyzet[cnt-1];
            pref += len*cnt;
        }
    }
    
    for (int i = 1; i <= q; i++) {
        cout << ans[i] << "\n";
    }
    return 0;
}

Compilation message

diversity.cpp: In function 'int main()':
diversity.cpp:69:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   69 |     for (auto [nl, nr, idx] : qrys) {
      |               ^
diversity.cpp:86:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   86 |             auto [len, cnt] = *it;
      |                  ^
diversity.cpp:108:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
  108 |             auto [len, cnt] = *it;
      |                  ^
diversity.cpp:122:19: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
  122 |         for (auto [len, cnt] : dq) {
      |                   ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2476 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2520 KB Output is correct
8 Correct 1 ms 2392 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2512 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 2 ms 2648 KB Output is correct
4 Correct 18 ms 5948 KB Output is correct
5 Correct 46 ms 8872 KB Output is correct
6 Correct 64 ms 10548 KB Output is correct
7 Correct 79 ms 15444 KB Output is correct
8 Correct 62 ms 10328 KB Output is correct
9 Correct 68 ms 10580 KB Output is correct
10 Correct 66 ms 12624 KB Output is correct
11 Correct 62 ms 11092 KB Output is correct
12 Correct 64 ms 10316 KB Output is correct
13 Correct 62 ms 10064 KB Output is correct
14 Correct 70 ms 11928 KB Output is correct
15 Correct 63 ms 11040 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2512 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 2 ms 2648 KB Output is correct
4 Correct 18 ms 5948 KB Output is correct
5 Correct 46 ms 8872 KB Output is correct
6 Correct 64 ms 10548 KB Output is correct
7 Correct 79 ms 15444 KB Output is correct
8 Correct 62 ms 10328 KB Output is correct
9 Correct 68 ms 10580 KB Output is correct
10 Correct 66 ms 12624 KB Output is correct
11 Correct 62 ms 11092 KB Output is correct
12 Correct 64 ms 10316 KB Output is correct
13 Correct 62 ms 10064 KB Output is correct
14 Correct 70 ms 11928 KB Output is correct
15 Correct 63 ms 11040 KB Output is correct
16 Correct 1 ms 2392 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 16 ms 5740 KB Output is correct
20 Correct 36 ms 6852 KB Output is correct
21 Correct 60 ms 10768 KB Output is correct
22 Correct 61 ms 10068 KB Output is correct
23 Correct 61 ms 10496 KB Output is correct
24 Correct 69 ms 9808 KB Output is correct
25 Correct 57 ms 10152 KB Output is correct
26 Correct 57 ms 9556 KB Output is correct
27 Correct 61 ms 10324 KB Output is correct
28 Correct 71 ms 11768 KB Output is correct
29 Correct 60 ms 9812 KB Output is correct
30 Correct 57 ms 10120 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2512 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 2 ms 2648 KB Output is correct
4 Correct 18 ms 5948 KB Output is correct
5 Correct 46 ms 8872 KB Output is correct
6 Correct 64 ms 10548 KB Output is correct
7 Correct 79 ms 15444 KB Output is correct
8 Correct 62 ms 10328 KB Output is correct
9 Correct 68 ms 10580 KB Output is correct
10 Correct 66 ms 12624 KB Output is correct
11 Correct 62 ms 11092 KB Output is correct
12 Correct 64 ms 10316 KB Output is correct
13 Correct 62 ms 10064 KB Output is correct
14 Correct 70 ms 11928 KB Output is correct
15 Correct 63 ms 11040 KB Output is correct
16 Correct 1 ms 2392 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 16 ms 5740 KB Output is correct
20 Correct 36 ms 6852 KB Output is correct
21 Correct 60 ms 10768 KB Output is correct
22 Correct 61 ms 10068 KB Output is correct
23 Correct 61 ms 10496 KB Output is correct
24 Correct 69 ms 9808 KB Output is correct
25 Correct 57 ms 10152 KB Output is correct
26 Correct 57 ms 9556 KB Output is correct
27 Correct 61 ms 10324 KB Output is correct
28 Correct 71 ms 11768 KB Output is correct
29 Correct 60 ms 9812 KB Output is correct
30 Correct 57 ms 10120 KB Output is correct
31 Correct 1 ms 2396 KB Output is correct
32 Correct 1 ms 2396 KB Output is correct
33 Correct 1 ms 2396 KB Output is correct
34 Correct 1 ms 2396 KB Output is correct
35 Correct 2 ms 2396 KB Output is correct
36 Correct 1 ms 2396 KB Output is correct
37 Correct 4 ms 4700 KB Output is correct
38 Correct 4 ms 4700 KB Output is correct
39 Correct 6 ms 4952 KB Output is correct
40 Correct 12 ms 5464 KB Output is correct
41 Correct 19 ms 8284 KB Output is correct
42 Correct 18 ms 8276 KB Output is correct
43 Correct 19 ms 8276 KB Output is correct
44 Correct 22 ms 8104 KB Output is correct
45 Correct 19 ms 8076 KB Output is correct
46 Correct 18 ms 8284 KB Output is correct
47 Correct 18 ms 8160 KB Output is correct
48 Correct 18 ms 8288 KB Output is correct
49 Correct 17 ms 8120 KB Output is correct
50 Correct 20 ms 8232 KB Output is correct
51 Correct 18 ms 8272 KB Output is correct
52 Correct 18 ms 8284 KB Output is correct
53 Correct 18 ms 8276 KB Output is correct
54 Correct 19 ms 8276 KB Output is correct
55 Correct 18 ms 8200 KB Output is correct
56 Correct 18 ms 8284 KB Output is correct
57 Correct 17 ms 8276 KB Output is correct
58 Correct 18 ms 8276 KB Output is correct
59 Correct 21 ms 8284 KB Output is correct
60 Correct 18 ms 8284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2476 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2520 KB Output is correct
8 Correct 1 ms 2392 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2512 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 2 ms 2648 KB Output is correct
14 Correct 18 ms 5948 KB Output is correct
15 Correct 46 ms 8872 KB Output is correct
16 Correct 64 ms 10548 KB Output is correct
17 Correct 79 ms 15444 KB Output is correct
18 Correct 62 ms 10328 KB Output is correct
19 Correct 68 ms 10580 KB Output is correct
20 Correct 66 ms 12624 KB Output is correct
21 Correct 62 ms 11092 KB Output is correct
22 Correct 64 ms 10316 KB Output is correct
23 Correct 62 ms 10064 KB Output is correct
24 Correct 70 ms 11928 KB Output is correct
25 Correct 63 ms 11040 KB Output is correct
26 Correct 1 ms 2392 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 16 ms 5740 KB Output is correct
30 Correct 36 ms 6852 KB Output is correct
31 Correct 60 ms 10768 KB Output is correct
32 Correct 61 ms 10068 KB Output is correct
33 Correct 61 ms 10496 KB Output is correct
34 Correct 69 ms 9808 KB Output is correct
35 Correct 57 ms 10152 KB Output is correct
36 Correct 57 ms 9556 KB Output is correct
37 Correct 61 ms 10324 KB Output is correct
38 Correct 71 ms 11768 KB Output is correct
39 Correct 60 ms 9812 KB Output is correct
40 Correct 57 ms 10120 KB Output is correct
41 Correct 1 ms 2396 KB Output is correct
42 Correct 1 ms 2396 KB Output is correct
43 Correct 1 ms 2396 KB Output is correct
44 Correct 1 ms 2396 KB Output is correct
45 Correct 2 ms 2396 KB Output is correct
46 Correct 1 ms 2396 KB Output is correct
47 Correct 4 ms 4700 KB Output is correct
48 Correct 4 ms 4700 KB Output is correct
49 Correct 6 ms 4952 KB Output is correct
50 Correct 12 ms 5464 KB Output is correct
51 Correct 19 ms 8284 KB Output is correct
52 Correct 18 ms 8276 KB Output is correct
53 Correct 19 ms 8276 KB Output is correct
54 Correct 22 ms 8104 KB Output is correct
55 Correct 19 ms 8076 KB Output is correct
56 Correct 18 ms 8284 KB Output is correct
57 Correct 18 ms 8160 KB Output is correct
58 Correct 18 ms 8288 KB Output is correct
59 Correct 17 ms 8120 KB Output is correct
60 Correct 20 ms 8232 KB Output is correct
61 Correct 18 ms 8272 KB Output is correct
62 Correct 18 ms 8284 KB Output is correct
63 Correct 18 ms 8276 KB Output is correct
64 Correct 19 ms 8276 KB Output is correct
65 Correct 18 ms 8200 KB Output is correct
66 Correct 18 ms 8284 KB Output is correct
67 Correct 17 ms 8276 KB Output is correct
68 Correct 18 ms 8276 KB Output is correct
69 Correct 21 ms 8284 KB Output is correct
70 Correct 18 ms 8284 KB Output is correct
71 Correct 5 ms 4952 KB Output is correct
72 Correct 6 ms 4956 KB Output is correct
73 Correct 4 ms 4956 KB Output is correct
74 Correct 4 ms 4952 KB Output is correct
75 Correct 4 ms 4956 KB Output is correct
76 Correct 7 ms 5192 KB Output is correct
77 Correct 10 ms 5212 KB Output is correct
78 Correct 7 ms 5212 KB Output is correct
79 Correct 8 ms 5108 KB Output is correct
80 Correct 8 ms 5084 KB Output is correct
81 Correct 16 ms 5664 KB Output is correct
82 Correct 19 ms 5800 KB Output is correct
83 Correct 14 ms 5724 KB Output is correct
84 Correct 20 ms 5916 KB Output is correct
85 Correct 13 ms 5716 KB Output is correct
86 Correct 15 ms 5724 KB Output is correct
87 Correct 21 ms 5712 KB Output is correct
88 Correct 16 ms 5716 KB Output is correct
89 Correct 20 ms 5724 KB Output is correct
90 Correct 16 ms 5720 KB Output is correct
91 Correct 23 ms 8268 KB Output is correct
92 Correct 28 ms 8392 KB Output is correct
93 Correct 22 ms 8288 KB Output is correct
94 Correct 24 ms 8488 KB Output is correct
95 Correct 23 ms 8276 KB Output is correct
96 Correct 28 ms 8604 KB Output is correct
97 Correct 28 ms 8628 KB Output is correct
98 Correct 27 ms 8684 KB Output is correct
99 Correct 29 ms 8712 KB Output is correct
100 Correct 28 ms 8596 KB Output is correct
101 Correct 28 ms 8700 KB Output is correct
102 Correct 27 ms 8908 KB Output is correct
103 Correct 23 ms 8568 KB Output is correct
104 Correct 27 ms 8660 KB Output is correct
105 Correct 32 ms 8744 KB Output is correct
106 Correct 25 ms 8540 KB Output is correct
107 Correct 26 ms 8532 KB Output is correct
108 Correct 23 ms 8524 KB Output is correct
109 Correct 23 ms 8540 KB Output is correct
110 Correct 23 ms 8532 KB Output is correct
111 Correct 23 ms 8536 KB Output is correct
112 Correct 23 ms 8536 KB Output is correct
113 Correct 25 ms 8716 KB Output is correct
114 Correct 29 ms 8628 KB Output is correct
115 Correct 23 ms 8540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2476 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2520 KB Output is correct
8 Correct 1 ms 2392 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2512 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 2 ms 2648 KB Output is correct
14 Correct 18 ms 5948 KB Output is correct
15 Correct 46 ms 8872 KB Output is correct
16 Correct 64 ms 10548 KB Output is correct
17 Correct 79 ms 15444 KB Output is correct
18 Correct 62 ms 10328 KB Output is correct
19 Correct 68 ms 10580 KB Output is correct
20 Correct 66 ms 12624 KB Output is correct
21 Correct 62 ms 11092 KB Output is correct
22 Correct 64 ms 10316 KB Output is correct
23 Correct 62 ms 10064 KB Output is correct
24 Correct 70 ms 11928 KB Output is correct
25 Correct 63 ms 11040 KB Output is correct
26 Correct 1 ms 2392 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 16 ms 5740 KB Output is correct
30 Correct 36 ms 6852 KB Output is correct
31 Correct 60 ms 10768 KB Output is correct
32 Correct 61 ms 10068 KB Output is correct
33 Correct 61 ms 10496 KB Output is correct
34 Correct 69 ms 9808 KB Output is correct
35 Correct 57 ms 10152 KB Output is correct
36 Correct 57 ms 9556 KB Output is correct
37 Correct 61 ms 10324 KB Output is correct
38 Correct 71 ms 11768 KB Output is correct
39 Correct 60 ms 9812 KB Output is correct
40 Correct 57 ms 10120 KB Output is correct
41 Correct 1 ms 2396 KB Output is correct
42 Correct 1 ms 2396 KB Output is correct
43 Correct 1 ms 2396 KB Output is correct
44 Correct 1 ms 2396 KB Output is correct
45 Correct 2 ms 2396 KB Output is correct
46 Correct 1 ms 2396 KB Output is correct
47 Correct 4 ms 4700 KB Output is correct
48 Correct 4 ms 4700 KB Output is correct
49 Correct 6 ms 4952 KB Output is correct
50 Correct 12 ms 5464 KB Output is correct
51 Correct 19 ms 8284 KB Output is correct
52 Correct 18 ms 8276 KB Output is correct
53 Correct 19 ms 8276 KB Output is correct
54 Correct 22 ms 8104 KB Output is correct
55 Correct 19 ms 8076 KB Output is correct
56 Correct 18 ms 8284 KB Output is correct
57 Correct 18 ms 8160 KB Output is correct
58 Correct 18 ms 8288 KB Output is correct
59 Correct 17 ms 8120 KB Output is correct
60 Correct 20 ms 8232 KB Output is correct
61 Correct 18 ms 8272 KB Output is correct
62 Correct 18 ms 8284 KB Output is correct
63 Correct 18 ms 8276 KB Output is correct
64 Correct 19 ms 8276 KB Output is correct
65 Correct 18 ms 8200 KB Output is correct
66 Correct 18 ms 8284 KB Output is correct
67 Correct 17 ms 8276 KB Output is correct
68 Correct 18 ms 8276 KB Output is correct
69 Correct 21 ms 8284 KB Output is correct
70 Correct 18 ms 8284 KB Output is correct
71 Correct 5 ms 4952 KB Output is correct
72 Correct 6 ms 4956 KB Output is correct
73 Correct 4 ms 4956 KB Output is correct
74 Correct 4 ms 4952 KB Output is correct
75 Correct 4 ms 4956 KB Output is correct
76 Correct 7 ms 5192 KB Output is correct
77 Correct 10 ms 5212 KB Output is correct
78 Correct 7 ms 5212 KB Output is correct
79 Correct 8 ms 5108 KB Output is correct
80 Correct 8 ms 5084 KB Output is correct
81 Correct 16 ms 5664 KB Output is correct
82 Correct 19 ms 5800 KB Output is correct
83 Correct 14 ms 5724 KB Output is correct
84 Correct 20 ms 5916 KB Output is correct
85 Correct 13 ms 5716 KB Output is correct
86 Correct 15 ms 5724 KB Output is correct
87 Correct 21 ms 5712 KB Output is correct
88 Correct 16 ms 5716 KB Output is correct
89 Correct 20 ms 5724 KB Output is correct
90 Correct 16 ms 5720 KB Output is correct
91 Correct 23 ms 8268 KB Output is correct
92 Correct 28 ms 8392 KB Output is correct
93 Correct 22 ms 8288 KB Output is correct
94 Correct 24 ms 8488 KB Output is correct
95 Correct 23 ms 8276 KB Output is correct
96 Correct 28 ms 8604 KB Output is correct
97 Correct 28 ms 8628 KB Output is correct
98 Correct 27 ms 8684 KB Output is correct
99 Correct 29 ms 8712 KB Output is correct
100 Correct 28 ms 8596 KB Output is correct
101 Correct 28 ms 8700 KB Output is correct
102 Correct 27 ms 8908 KB Output is correct
103 Correct 23 ms 8568 KB Output is correct
104 Correct 27 ms 8660 KB Output is correct
105 Correct 32 ms 8744 KB Output is correct
106 Correct 25 ms 8540 KB Output is correct
107 Correct 26 ms 8532 KB Output is correct
108 Correct 23 ms 8524 KB Output is correct
109 Correct 23 ms 8540 KB Output is correct
110 Correct 23 ms 8532 KB Output is correct
111 Correct 23 ms 8536 KB Output is correct
112 Correct 23 ms 8536 KB Output is correct
113 Correct 25 ms 8716 KB Output is correct
114 Correct 29 ms 8628 KB Output is correct
115 Correct 23 ms 8540 KB Output is correct
116 Correct 131 ms 4328 KB Output is correct
117 Correct 135 ms 4436 KB Output is correct
118 Correct 230 ms 6740 KB Output is correct
119 Correct 216 ms 6736 KB Output is correct
120 Correct 178 ms 6756 KB Output is correct
121 Correct 259 ms 6996 KB Output is correct
122 Correct 194 ms 7008 KB Output is correct
123 Correct 406 ms 7664 KB Output is correct
124 Correct 235 ms 7508 KB Output is correct
125 Correct 230 ms 7724 KB Output is correct
126 Correct 2550 ms 9784 KB Output is correct
127 Correct 2300 ms 9780 KB Output is correct
128 Correct 2320 ms 9780 KB Output is correct
129 Correct 2426 ms 10024 KB Output is correct
130 Correct 2199 ms 9752 KB Output is correct
131 Correct 1050 ms 9696 KB Output is correct
132 Correct 1111 ms 9712 KB Output is correct
133 Correct 1339 ms 9768 KB Output is correct
134 Correct 1165 ms 9812 KB Output is correct
135 Correct 1198 ms 9708 KB Output is correct
136 Correct 1095 ms 9712 KB Output is correct
137 Correct 1202 ms 9708 KB Output is correct
138 Correct 1092 ms 9712 KB Output is correct
139 Correct 1106 ms 9808 KB Output is correct
140 Correct 1246 ms 9720 KB Output is correct
141 Correct 587 ms 9668 KB Output is correct
142 Correct 600 ms 9556 KB Output is correct
143 Correct 571 ms 9660 KB Output is correct
144 Correct 565 ms 9808 KB Output is correct
145 Correct 570 ms 9672 KB Output is correct
146 Correct 348 ms 10032 KB Output is correct
147 Correct 343 ms 9896 KB Output is correct
148 Correct 371 ms 9888 KB Output is correct
149 Correct 381 ms 10024 KB Output is correct
150 Correct 362 ms 10064 KB Output is correct
151 Correct 304 ms 9884 KB Output is correct
152 Correct 315 ms 9884 KB Output is correct
153 Correct 339 ms 9936 KB Output is correct
154 Correct 303 ms 10064 KB Output is correct
155 Correct 289 ms 10064 KB Output is correct
156 Correct 1717 ms 10236 KB Output is correct
157 Correct 1628 ms 10276 KB Output is correct
158 Correct 1839 ms 10244 KB Output is correct
159 Correct 1906 ms 10244 KB Output is correct
160 Correct 1702 ms 10220 KB Output is correct
161 Correct 3939 ms 10476 KB Output is correct
162 Correct 4083 ms 10648 KB Output is correct
163 Correct 3939 ms 10348 KB Output is correct
164 Correct 4051 ms 10396 KB Output is correct
165 Correct 4103 ms 10388 KB Output is correct
166 Correct 3735 ms 10072 KB Output is correct
167 Correct 3452 ms 10112 KB Output is correct
168 Correct 3392 ms 10096 KB Output is correct
169 Correct 3574 ms 8812 KB Output is correct
170 Correct 3676 ms 8904 KB Output is correct
171 Correct 4964 ms 8808 KB Output is correct
172 Correct 5277 ms 8752 KB Output is correct
173 Correct 5187 ms 8848 KB Output is correct
174 Correct 5399 ms 8860 KB Output is correct
175 Correct 4968 ms 8940 KB Output is correct