Submission #858400

# Submission time Handle Problem Language Result Execution time Memory
858400 2023-10-08T11:13:46 Z danikoynov Diversity (CEOI21_diversity) C++14
100 / 100
2000 ms 22736 KB
/**
 ____ ____ ____ ____ ____ ____
||l |||e |||i |||n |||a |||d ||
||__|||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|/__\|

**/

#include<bits/stdc++.h>
#define endl '\n'

using namespace std;
typedef long long ll;

void speed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}


const int maxn = 3e5 + 10, maxq = 5e4 + 10;
const int block_size = sqrt(maxn);

struct query
{
    int l, r, idx;
} task[maxq];

bool cmp_mo(query t1, query t2)
{
    if (t1.l / block_size == t2.l / block_size)
        return t1.r < t2.r;
    return t1.l < t2.l;
}

int q, a[maxn], freq[maxn], comp[maxn];
ll n;
///unordered_map < int, int > act;
int act[maxn];
bitset < maxn > bt;
void update(int val, int c)
{

    ///cout << "update " << val << " " << c << endl;
    if (freq[val] != 0)
    {
        act[freq[val]] --;
        if (act[freq[val]] == 0)
            bt[freq[val]] = 0;
    }

    ///comp[freq[val]] --;
    freq[val] += c;
    ///comp[freq[val]] ++;
    if (freq[val] != 0)
    {
        act[freq[val]] ++;
        bt[freq[val]] = 1;
    }
}

int lf = 1, rf = 0;
ll ans[maxn];

void move_borders(int left, int right)
{
    while(rf < right)
    {
        rf ++;
        update(a[rf], 1);
    }

    while(lf > left)
    {
        lf --;
        update(a[lf], 1);
    }

    while(rf > right)
    {
        update(a[rf], -1);
        rf --;
    }

    while(lf < left)
    {
        update(a[lf], -1);
        lf ++;
    }
}

ll arr[maxn], bef[maxn], aft[maxn], prec[maxn];
ll calc_function(ll len)
{
    vector < pair < ll, ll >  > values;
    int bit = bt._Find_first();
    while(bit < maxn)
    {
        values.push_back({bit, act[bit]});
        bit = bt._Find_next(bit);
    }
    /**
    for (pair < int, int > cur : act)
    {
        values.push_back(cur);
    }
    sort(values.begin(), values.end());*/

    ll sz = values.size(), cp = 0;
    deque < pair < ll, ll > > dq;
    ll left_add = 0, right_add = 0;
    values.back().second --;
    cp ++;
    dq.push_back({values.back().first, 1});
    for (int i = sz - 1; i >= 0; i --)
    {
        ll p1 = (values[i].second + 1) / 2;
        ll p2 = (values[i].second) / 2;
        if (right_add > left_add)
            swap(p1, p2);
        if(p1 != 0)
            dq.push_back({values[i].first, p1});
        if (p2 != 0)
            dq.push_front({values[i].first, p2});

        cp += values[i].second;
        left_add += p2;
        right_add += p1;
    }


    ll tot = 0, pref = 0;
    for (int i = 0; i < dq.size(); i ++)
    {
        ll l = dq[i].second;
        tot = tot + l * pref * pref;
        tot = tot + l * (l + 1) * pref * dq[i].first;
        tot = tot + prec[l] * dq[i].first * dq[i].first;
        pref = pref + dq[i].first * l;
        ///cout << pref << " " << tot << " " << dq[i].first << " " << dq[i].second << endl;
    }
    tot = tot - pref * pref;

    ll suff = 0;
    for (int i = dq.size() - 1; i >= 0; i --)
    {
        ll l = dq[i].second;
        tot = tot + l * suff * suff;
        tot = tot + l * (l + 1) * suff * dq[i].first;
        tot = tot + prec[l] * dq[i].first * dq[i].first;
        suff = suff + dq[i].first * l;
    }
    tot = tot - suff * suff;

    tot = (cp * len * (len + 1) - len * (cp - 1) - tot) / 2;
    return tot;


}

void compress_data()
{
    int cur = 0;
    map < int, int > mp;
    for (int i = 1; i <= n; i ++)
    {
        if (mp[a[i]] == 0)
            mp[a[i]] = ++ cur;
        a[i] = mp[a[i]];
    }
}
void solve()
{
    cin >> n >> q;
    for (int i = 1; i <= n; i ++)
        cin >> a[i];
    for (int i = 1; i <= n; i ++)
    {
        prec[i] = prec[i - 1] + (ll)(i) * (ll)(i);
    }
    compress_data();
    for (int i = 1; i <= q; i ++)
    {
        cin >> task[i].l >> task[i].r;
        task[i].idx = i;
    }

    sort(task + 1, task + q + 1, cmp_mo);

    for (int i = 1; i <= q; i ++)
    {
        move_borders(task[i].l, task[i].r);
        ans[task[i].idx] = calc_function(task[i].r - task[i].l + 1);
    }

    for (int i = 1; i <= q; i ++)
        cout << ans[i] << endl;

}

int main()
{
    speed();
    ///freopen("test.txt", "r", stdin);
    solve();
    return 0;
}

Compilation message

diversity.cpp: In function 'll calc_function(ll)':
diversity.cpp:135:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  135 |     for (int i = 0; i < dq.size(); i ++)
      |                     ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 6492 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 2 ms 6492 KB Output is correct
4 Correct 7 ms 8796 KB Output is correct
5 Correct 13 ms 9052 KB Output is correct
6 Correct 21 ms 11148 KB Output is correct
7 Correct 18 ms 11356 KB Output is correct
8 Correct 21 ms 10972 KB Output is correct
9 Correct 20 ms 11000 KB Output is correct
10 Correct 20 ms 11352 KB Output is correct
11 Correct 20 ms 11100 KB Output is correct
12 Correct 21 ms 11092 KB Output is correct
13 Correct 20 ms 10836 KB Output is correct
14 Correct 20 ms 11092 KB Output is correct
15 Correct 21 ms 10960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 2 ms 6492 KB Output is correct
4 Correct 7 ms 8796 KB Output is correct
5 Correct 13 ms 9052 KB Output is correct
6 Correct 21 ms 11148 KB Output is correct
7 Correct 18 ms 11356 KB Output is correct
8 Correct 21 ms 10972 KB Output is correct
9 Correct 20 ms 11000 KB Output is correct
10 Correct 20 ms 11352 KB Output is correct
11 Correct 20 ms 11100 KB Output is correct
12 Correct 21 ms 11092 KB Output is correct
13 Correct 20 ms 10836 KB Output is correct
14 Correct 20 ms 11092 KB Output is correct
15 Correct 21 ms 10960 KB Output is correct
16 Correct 1 ms 6488 KB Output is correct
17 Correct 1 ms 6492 KB Output is correct
18 Correct 2 ms 6492 KB Output is correct
19 Correct 9 ms 8804 KB Output is correct
20 Correct 16 ms 8796 KB Output is correct
21 Correct 24 ms 11096 KB Output is correct
22 Correct 24 ms 10836 KB Output is correct
23 Correct 23 ms 11100 KB Output is correct
24 Correct 23 ms 10844 KB Output is correct
25 Correct 23 ms 10896 KB Output is correct
26 Correct 24 ms 10892 KB Output is correct
27 Correct 23 ms 10844 KB Output is correct
28 Correct 23 ms 11148 KB Output is correct
29 Correct 23 ms 10896 KB Output is correct
30 Correct 24 ms 10844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 2 ms 6492 KB Output is correct
4 Correct 7 ms 8796 KB Output is correct
5 Correct 13 ms 9052 KB Output is correct
6 Correct 21 ms 11148 KB Output is correct
7 Correct 18 ms 11356 KB Output is correct
8 Correct 21 ms 10972 KB Output is correct
9 Correct 20 ms 11000 KB Output is correct
10 Correct 20 ms 11352 KB Output is correct
11 Correct 20 ms 11100 KB Output is correct
12 Correct 21 ms 11092 KB Output is correct
13 Correct 20 ms 10836 KB Output is correct
14 Correct 20 ms 11092 KB Output is correct
15 Correct 21 ms 10960 KB Output is correct
16 Correct 1 ms 6488 KB Output is correct
17 Correct 1 ms 6492 KB Output is correct
18 Correct 2 ms 6492 KB Output is correct
19 Correct 9 ms 8804 KB Output is correct
20 Correct 16 ms 8796 KB Output is correct
21 Correct 24 ms 11096 KB Output is correct
22 Correct 24 ms 10836 KB Output is correct
23 Correct 23 ms 11100 KB Output is correct
24 Correct 23 ms 10844 KB Output is correct
25 Correct 23 ms 10896 KB Output is correct
26 Correct 24 ms 10892 KB Output is correct
27 Correct 23 ms 10844 KB Output is correct
28 Correct 23 ms 11148 KB Output is correct
29 Correct 23 ms 10896 KB Output is correct
30 Correct 24 ms 10844 KB Output is correct
31 Correct 1 ms 6488 KB Output is correct
32 Correct 1 ms 6492 KB Output is correct
33 Correct 1 ms 6492 KB Output is correct
34 Correct 2 ms 6492 KB Output is correct
35 Correct 2 ms 6744 KB Output is correct
36 Correct 3 ms 6748 KB Output is correct
37 Correct 8 ms 8796 KB Output is correct
38 Correct 11 ms 8880 KB Output is correct
39 Correct 16 ms 8796 KB Output is correct
40 Correct 31 ms 8788 KB Output is correct
41 Correct 45 ms 10936 KB Output is correct
42 Correct 44 ms 10840 KB Output is correct
43 Correct 49 ms 11088 KB Output is correct
44 Correct 44 ms 10836 KB Output is correct
45 Correct 44 ms 10836 KB Output is correct
46 Correct 45 ms 10836 KB Output is correct
47 Correct 45 ms 10928 KB Output is correct
48 Correct 44 ms 10844 KB Output is correct
49 Correct 45 ms 10704 KB Output is correct
50 Correct 46 ms 10912 KB Output is correct
51 Correct 43 ms 10832 KB Output is correct
52 Correct 46 ms 10928 KB Output is correct
53 Correct 45 ms 10836 KB Output is correct
54 Correct 45 ms 10916 KB Output is correct
55 Correct 42 ms 10836 KB Output is correct
56 Correct 43 ms 11188 KB Output is correct
57 Correct 45 ms 10912 KB Output is correct
58 Correct 45 ms 10836 KB Output is correct
59 Correct 45 ms 10836 KB Output is correct
60 Correct 44 ms 10916 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 6492 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Correct 1 ms 6492 KB Output is correct
12 Correct 1 ms 6492 KB Output is correct
13 Correct 2 ms 6492 KB Output is correct
14 Correct 7 ms 8796 KB Output is correct
15 Correct 13 ms 9052 KB Output is correct
16 Correct 21 ms 11148 KB Output is correct
17 Correct 18 ms 11356 KB Output is correct
18 Correct 21 ms 10972 KB Output is correct
19 Correct 20 ms 11000 KB Output is correct
20 Correct 20 ms 11352 KB Output is correct
21 Correct 20 ms 11100 KB Output is correct
22 Correct 21 ms 11092 KB Output is correct
23 Correct 20 ms 10836 KB Output is correct
24 Correct 20 ms 11092 KB Output is correct
25 Correct 21 ms 10960 KB Output is correct
26 Correct 1 ms 6488 KB Output is correct
27 Correct 1 ms 6492 KB Output is correct
28 Correct 2 ms 6492 KB Output is correct
29 Correct 9 ms 8804 KB Output is correct
30 Correct 16 ms 8796 KB Output is correct
31 Correct 24 ms 11096 KB Output is correct
32 Correct 24 ms 10836 KB Output is correct
33 Correct 23 ms 11100 KB Output is correct
34 Correct 23 ms 10844 KB Output is correct
35 Correct 23 ms 10896 KB Output is correct
36 Correct 24 ms 10892 KB Output is correct
37 Correct 23 ms 10844 KB Output is correct
38 Correct 23 ms 11148 KB Output is correct
39 Correct 23 ms 10896 KB Output is correct
40 Correct 24 ms 10844 KB Output is correct
41 Correct 1 ms 6488 KB Output is correct
42 Correct 1 ms 6492 KB Output is correct
43 Correct 1 ms 6492 KB Output is correct
44 Correct 2 ms 6492 KB Output is correct
45 Correct 2 ms 6744 KB Output is correct
46 Correct 3 ms 6748 KB Output is correct
47 Correct 8 ms 8796 KB Output is correct
48 Correct 11 ms 8880 KB Output is correct
49 Correct 16 ms 8796 KB Output is correct
50 Correct 31 ms 8788 KB Output is correct
51 Correct 45 ms 10936 KB Output is correct
52 Correct 44 ms 10840 KB Output is correct
53 Correct 49 ms 11088 KB Output is correct
54 Correct 44 ms 10836 KB Output is correct
55 Correct 44 ms 10836 KB Output is correct
56 Correct 45 ms 10836 KB Output is correct
57 Correct 45 ms 10928 KB Output is correct
58 Correct 44 ms 10844 KB Output is correct
59 Correct 45 ms 10704 KB Output is correct
60 Correct 46 ms 10912 KB Output is correct
61 Correct 43 ms 10832 KB Output is correct
62 Correct 46 ms 10928 KB Output is correct
63 Correct 45 ms 10836 KB Output is correct
64 Correct 45 ms 10916 KB Output is correct
65 Correct 42 ms 10836 KB Output is correct
66 Correct 43 ms 11188 KB Output is correct
67 Correct 45 ms 10912 KB Output is correct
68 Correct 45 ms 10836 KB Output is correct
69 Correct 45 ms 10836 KB Output is correct
70 Correct 44 ms 10916 KB Output is correct
71 Correct 10 ms 8796 KB Output is correct
72 Correct 10 ms 8796 KB Output is correct
73 Correct 10 ms 8900 KB Output is correct
74 Correct 10 ms 8796 KB Output is correct
75 Correct 10 ms 8936 KB Output is correct
76 Correct 21 ms 9064 KB Output is correct
77 Correct 23 ms 9064 KB Output is correct
78 Correct 21 ms 9072 KB Output is correct
79 Correct 21 ms 9072 KB Output is correct
80 Correct 20 ms 9052 KB Output is correct
81 Correct 44 ms 9280 KB Output is correct
82 Correct 43 ms 9308 KB Output is correct
83 Correct 43 ms 9296 KB Output is correct
84 Correct 44 ms 9576 KB Output is correct
85 Correct 44 ms 9236 KB Output is correct
86 Correct 52 ms 9716 KB Output is correct
87 Correct 52 ms 9552 KB Output is correct
88 Correct 52 ms 9560 KB Output is correct
89 Correct 53 ms 9552 KB Output is correct
90 Correct 53 ms 9724 KB Output is correct
91 Correct 108 ms 15516 KB Output is correct
92 Correct 109 ms 15584 KB Output is correct
93 Correct 108 ms 15456 KB Output is correct
94 Correct 108 ms 15416 KB Output is correct
95 Correct 114 ms 15440 KB Output is correct
96 Correct 142 ms 20052 KB Output is correct
97 Correct 143 ms 20052 KB Output is correct
98 Correct 142 ms 20048 KB Output is correct
99 Correct 143 ms 20052 KB Output is correct
100 Correct 142 ms 20208 KB Output is correct
101 Correct 141 ms 20088 KB Output is correct
102 Correct 141 ms 20048 KB Output is correct
103 Correct 143 ms 20048 KB Output is correct
104 Correct 146 ms 20148 KB Output is correct
105 Correct 150 ms 20052 KB Output is correct
106 Correct 156 ms 22612 KB Output is correct
107 Correct 157 ms 22608 KB Output is correct
108 Correct 155 ms 22400 KB Output is correct
109 Correct 165 ms 22668 KB Output is correct
110 Correct 160 ms 22608 KB Output is correct
111 Correct 157 ms 22608 KB Output is correct
112 Correct 169 ms 22736 KB Output is correct
113 Correct 158 ms 22428 KB Output is correct
114 Correct 160 ms 22464 KB Output is correct
115 Correct 157 ms 22612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 6492 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Correct 1 ms 6492 KB Output is correct
12 Correct 1 ms 6492 KB Output is correct
13 Correct 2 ms 6492 KB Output is correct
14 Correct 7 ms 8796 KB Output is correct
15 Correct 13 ms 9052 KB Output is correct
16 Correct 21 ms 11148 KB Output is correct
17 Correct 18 ms 11356 KB Output is correct
18 Correct 21 ms 10972 KB Output is correct
19 Correct 20 ms 11000 KB Output is correct
20 Correct 20 ms 11352 KB Output is correct
21 Correct 20 ms 11100 KB Output is correct
22 Correct 21 ms 11092 KB Output is correct
23 Correct 20 ms 10836 KB Output is correct
24 Correct 20 ms 11092 KB Output is correct
25 Correct 21 ms 10960 KB Output is correct
26 Correct 1 ms 6488 KB Output is correct
27 Correct 1 ms 6492 KB Output is correct
28 Correct 2 ms 6492 KB Output is correct
29 Correct 9 ms 8804 KB Output is correct
30 Correct 16 ms 8796 KB Output is correct
31 Correct 24 ms 11096 KB Output is correct
32 Correct 24 ms 10836 KB Output is correct
33 Correct 23 ms 11100 KB Output is correct
34 Correct 23 ms 10844 KB Output is correct
35 Correct 23 ms 10896 KB Output is correct
36 Correct 24 ms 10892 KB Output is correct
37 Correct 23 ms 10844 KB Output is correct
38 Correct 23 ms 11148 KB Output is correct
39 Correct 23 ms 10896 KB Output is correct
40 Correct 24 ms 10844 KB Output is correct
41 Correct 1 ms 6488 KB Output is correct
42 Correct 1 ms 6492 KB Output is correct
43 Correct 1 ms 6492 KB Output is correct
44 Correct 2 ms 6492 KB Output is correct
45 Correct 2 ms 6744 KB Output is correct
46 Correct 3 ms 6748 KB Output is correct
47 Correct 8 ms 8796 KB Output is correct
48 Correct 11 ms 8880 KB Output is correct
49 Correct 16 ms 8796 KB Output is correct
50 Correct 31 ms 8788 KB Output is correct
51 Correct 45 ms 10936 KB Output is correct
52 Correct 44 ms 10840 KB Output is correct
53 Correct 49 ms 11088 KB Output is correct
54 Correct 44 ms 10836 KB Output is correct
55 Correct 44 ms 10836 KB Output is correct
56 Correct 45 ms 10836 KB Output is correct
57 Correct 45 ms 10928 KB Output is correct
58 Correct 44 ms 10844 KB Output is correct
59 Correct 45 ms 10704 KB Output is correct
60 Correct 46 ms 10912 KB Output is correct
61 Correct 43 ms 10832 KB Output is correct
62 Correct 46 ms 10928 KB Output is correct
63 Correct 45 ms 10836 KB Output is correct
64 Correct 45 ms 10916 KB Output is correct
65 Correct 42 ms 10836 KB Output is correct
66 Correct 43 ms 11188 KB Output is correct
67 Correct 45 ms 10912 KB Output is correct
68 Correct 45 ms 10836 KB Output is correct
69 Correct 45 ms 10836 KB Output is correct
70 Correct 44 ms 10916 KB Output is correct
71 Correct 10 ms 8796 KB Output is correct
72 Correct 10 ms 8796 KB Output is correct
73 Correct 10 ms 8900 KB Output is correct
74 Correct 10 ms 8796 KB Output is correct
75 Correct 10 ms 8936 KB Output is correct
76 Correct 21 ms 9064 KB Output is correct
77 Correct 23 ms 9064 KB Output is correct
78 Correct 21 ms 9072 KB Output is correct
79 Correct 21 ms 9072 KB Output is correct
80 Correct 20 ms 9052 KB Output is correct
81 Correct 44 ms 9280 KB Output is correct
82 Correct 43 ms 9308 KB Output is correct
83 Correct 43 ms 9296 KB Output is correct
84 Correct 44 ms 9576 KB Output is correct
85 Correct 44 ms 9236 KB Output is correct
86 Correct 52 ms 9716 KB Output is correct
87 Correct 52 ms 9552 KB Output is correct
88 Correct 52 ms 9560 KB Output is correct
89 Correct 53 ms 9552 KB Output is correct
90 Correct 53 ms 9724 KB Output is correct
91 Correct 108 ms 15516 KB Output is correct
92 Correct 109 ms 15584 KB Output is correct
93 Correct 108 ms 15456 KB Output is correct
94 Correct 108 ms 15416 KB Output is correct
95 Correct 114 ms 15440 KB Output is correct
96 Correct 142 ms 20052 KB Output is correct
97 Correct 143 ms 20052 KB Output is correct
98 Correct 142 ms 20048 KB Output is correct
99 Correct 143 ms 20052 KB Output is correct
100 Correct 142 ms 20208 KB Output is correct
101 Correct 141 ms 20088 KB Output is correct
102 Correct 141 ms 20048 KB Output is correct
103 Correct 143 ms 20048 KB Output is correct
104 Correct 146 ms 20148 KB Output is correct
105 Correct 150 ms 20052 KB Output is correct
106 Correct 156 ms 22612 KB Output is correct
107 Correct 157 ms 22608 KB Output is correct
108 Correct 155 ms 22400 KB Output is correct
109 Correct 165 ms 22668 KB Output is correct
110 Correct 160 ms 22608 KB Output is correct
111 Correct 157 ms 22608 KB Output is correct
112 Correct 169 ms 22736 KB Output is correct
113 Correct 158 ms 22428 KB Output is correct
114 Correct 160 ms 22464 KB Output is correct
115 Correct 157 ms 22612 KB Output is correct
116 Correct 212 ms 7508 KB Output is correct
117 Correct 244 ms 7508 KB Output is correct
118 Correct 290 ms 9828 KB Output is correct
119 Correct 354 ms 9844 KB Output is correct
120 Correct 292 ms 9700 KB Output is correct
121 Correct 467 ms 9808 KB Output is correct
122 Correct 385 ms 10064 KB Output is correct
123 Correct 958 ms 10064 KB Output is correct
124 Correct 597 ms 10068 KB Output is correct
125 Correct 560 ms 10572 KB Output is correct
126 Correct 1501 ms 11924 KB Output is correct
127 Correct 1492 ms 13652 KB Output is correct
128 Correct 1509 ms 13644 KB Output is correct
129 Correct 1496 ms 13636 KB Output is correct
130 Correct 1508 ms 13632 KB Output is correct
131 Correct 1806 ms 13676 KB Output is correct
132 Correct 1818 ms 13692 KB Output is correct
133 Correct 1775 ms 13908 KB Output is correct
134 Correct 1799 ms 13668 KB Output is correct
135 Correct 1820 ms 13684 KB Output is correct
136 Correct 1843 ms 13904 KB Output is correct
137 Correct 1809 ms 13648 KB Output is correct
138 Correct 1817 ms 13908 KB Output is correct
139 Correct 1799 ms 13908 KB Output is correct
140 Correct 1820 ms 13676 KB Output is correct
141 Correct 1688 ms 13744 KB Output is correct
142 Correct 1722 ms 13720 KB Output is correct
143 Correct 1704 ms 13732 KB Output is correct
144 Correct 1683 ms 13648 KB Output is correct
145 Correct 1691 ms 13724 KB Output is correct
146 Correct 997 ms 14164 KB Output is correct
147 Correct 1024 ms 14156 KB Output is correct
148 Correct 1002 ms 14164 KB Output is correct
149 Correct 1004 ms 14416 KB Output is correct
150 Correct 1010 ms 14152 KB Output is correct
151 Correct 937 ms 14416 KB Output is correct
152 Correct 947 ms 14672 KB Output is correct
153 Correct 953 ms 14676 KB Output is correct
154 Correct 942 ms 14424 KB Output is correct
155 Correct 946 ms 14672 KB Output is correct
156 Correct 1996 ms 16720 KB Output is correct
157 Correct 1983 ms 16740 KB Output is correct
158 Correct 1987 ms 16724 KB Output is correct
159 Correct 1970 ms 16936 KB Output is correct
160 Correct 1967 ms 16724 KB Output is correct
161 Correct 1873 ms 16012 KB Output is correct
162 Correct 1873 ms 16052 KB Output is correct
163 Correct 1865 ms 15956 KB Output is correct
164 Correct 1868 ms 15956 KB Output is correct
165 Correct 1868 ms 15952 KB Output is correct
166 Correct 1981 ms 14164 KB Output is correct
167 Correct 1996 ms 14212 KB Output is correct
168 Correct 2000 ms 14220 KB Output is correct
169 Correct 1968 ms 14252 KB Output is correct
170 Correct 1998 ms 14476 KB Output is correct
171 Correct 1551 ms 14372 KB Output is correct
172 Correct 1574 ms 14280 KB Output is correct
173 Correct 1546 ms 14280 KB Output is correct
174 Correct 1545 ms 14332 KB Output is correct
175 Correct 1582 ms 14316 KB Output is correct