답안 #576886

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
576886 2022-06-13T17:16:35 Z talant117408 Diversity (CEOI21_diversity) C++17
100 / 100
4867 ms 5912 KB
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

#define long                unsigned long 
#define pb                  push_back
#define mp                  make_pair
#define all(v)              (v).begin(),(v).end()
#define rall(v)             (v).rbegin(),(v).rend()
#define lb                  lower_bound
#define ub                  upper_bound
#define sz(v)               int((v).size())
#define do_not_disturb      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl                '\n'

const int MAXN = 3e5+7;

int64_t calc(int64_t n) {
    return (n*(n+1)) >> 1;
}

int64_t calc2(int64_t n) {
    return n*(n+1)*(2*n+1)/6;
}

struct MO {
    vector <int> freq, cfreq, comp;
    vector <bool> used;
    int N;
    
    MO() {
        N = 0;
        freq.resize(MAXN);
        cfreq.resize(MAXN);
        used.resize(MAXN);
    }
    void add(int n) {
        cfreq[freq[n]]--;
        freq[n]++;
        if (++cfreq[freq[n]] == 1 && !used[freq[n]]) {
            comp.pb(freq[n]);
            used[freq[n]] = 1;
        }
        N++;
    }
    void remove(int n) {
        cfreq[freq[n]]--;
        freq[n]--;
        if (++cfreq[freq[n]] == 1 && !used[freq[n]] && freq[n] > 0) {
            comp.pb(freq[n]);
            used[freq[n]] = 1;
        }
        N--;
    }
    int64_t get() {
        int saizu = 0;  
        vector <pii> options;
        vector <int> comp1;
        for (auto x : comp) {
            if (cfreq[x] > 0) {
                options.pb(mp(x, cfreq[x]));
                comp1.pb(x);
            }
            else {
                used[x] = 0;
            }
        }
        comp = comp1;
        sort(rall(options));
        deque <pii> dq;
        for (auto x : options) {
            if (saizu % 2 == 0) {
                dq.push_front(mp(x.first, (x.second+1) >> 1));
                if (x.second > 1)
                    dq.push_back(mp(x.first, x.second >> 1));
            }
            else {
                if (x.second > 1) 
                    dq.push_front(mp(x.first, x.second >> 1));
                dq.push_back(mp(x.first, (x.second+1) >> 1));
            }
            saizu += x.second;
        }
        int64_t pref = 0, suff;
        int64_t ans = 0;
        for (auto p : dq) {
            int x = p.first, k = p.second;
            suff = N - pref - x;
            int64_t a = k*calc(x);
            int64_t b = k*pref + x*calc(k-1);
            int64_t c = k*suff - x*calc(k-1);
            int64_t d = k*pref*suff + x*(suff*calc(k-1) - pref*calc(k-1) - x*calc2(k-1));
            ans += a + b*x + c*x + d;
            pref += k*x;
        }
        return ans;
    }
};

void solve() {
    int n, q;
    //~ cin >> n >> q;
    scanf("%d%d", &n, &q);
    
    int BLOCK = 350;
    vector <int> v(n);
    vector <int64_t> ans(q);
    vector <pair <pii, int>> queries(q);
    
    for (int i = 0; i < n; i++) {
        scanf("%d", &v[i]);
    }
    for (int i = 0; i < q; i++) {
        //~ cin >> queries[i].first.first >> queries[i].first.second;
        scanf("%d%d", &queries[i].first.first, &queries[i].first.second);
        queries[i].first.first--;
        queries[i].first.second--;
        queries[i].second = i;
    }
    sort(all(queries), [&](pair <pii, int> a, pair <pii, int> b) {
        if (a.first.first/BLOCK == b.first.first/BLOCK) {
            return a.first.second < b.first.second;
        }
        return a.first.first/BLOCK < b.first.first/BLOCK;
    }); 
    
    int l = 0, r = -1;
    MO mo;
    for (auto to : queries) {
        auto ql = to.first.first, qr = to.first.second, ind = to.second;
        while (r < qr) {
            r++;
            mo.add(v[r]);
        }
        while (l > ql) {
            l--;
            mo.add(v[l]);
        }
        while (r > qr) {
            mo.remove(v[r]);
            r--;
        }
        while (l < ql) {
            mo.remove(v[l]);
            l++;
        }
        ans[ind] = mo.get();
    }
    for (auto to : ans) printf("%lld\n", to);
}

int main() {
    do_not_disturb
    
    int t = 1;
    //~ cin >> t;
    while (t--) {
        solve();
    }
    
    return 0;
}

Compilation message

diversity.cpp: In function 'void solve()':
diversity.cpp:153:36: warning: format '%lld' expects argument of type 'long long int', but argument 2 has type 'long int' [-Wformat=]
  153 |     for (auto to : ans) printf("%lld\n", to);
      |                                 ~~~^     ~~
      |                                    |     |
      |                                    |     long int
      |                                    long long int
      |                                 %ld
diversity.cpp:107:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  107 |     scanf("%d%d", &n, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~
diversity.cpp:115:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  115 |         scanf("%d", &v[i]);
      |         ~~~~~^~~~~~~~~~~~~
diversity.cpp:119:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  119 |         scanf("%d%d", &queries[i].first.first, &queries[i].first.second);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2664 KB Output is correct
2 Correct 1 ms 2644 KB Output is correct
3 Correct 2 ms 2716 KB Output is correct
4 Correct 1 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 1 ms 2696 KB Output is correct
8 Correct 1 ms 2644 KB Output is correct
9 Correct 2 ms 2644 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 1 ms 2644 KB Output is correct
3 Correct 2 ms 2772 KB Output is correct
4 Correct 10 ms 3284 KB Output is correct
5 Correct 18 ms 4048 KB Output is correct
6 Correct 25 ms 4184 KB Output is correct
7 Correct 31 ms 4944 KB Output is correct
8 Correct 26 ms 4192 KB Output is correct
9 Correct 32 ms 4180 KB Output is correct
10 Correct 26 ms 4444 KB Output is correct
11 Correct 26 ms 4436 KB Output is correct
12 Correct 24 ms 4200 KB Output is correct
13 Correct 28 ms 4252 KB Output is correct
14 Correct 26 ms 4440 KB Output is correct
15 Correct 26 ms 4424 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 1 ms 2644 KB Output is correct
3 Correct 2 ms 2772 KB Output is correct
4 Correct 10 ms 3284 KB Output is correct
5 Correct 18 ms 4048 KB Output is correct
6 Correct 25 ms 4184 KB Output is correct
7 Correct 31 ms 4944 KB Output is correct
8 Correct 26 ms 4192 KB Output is correct
9 Correct 32 ms 4180 KB Output is correct
10 Correct 26 ms 4444 KB Output is correct
11 Correct 26 ms 4436 KB Output is correct
12 Correct 24 ms 4200 KB Output is correct
13 Correct 28 ms 4252 KB Output is correct
14 Correct 26 ms 4440 KB Output is correct
15 Correct 26 ms 4424 KB Output is correct
16 Correct 1 ms 2644 KB Output is correct
17 Correct 2 ms 2644 KB Output is correct
18 Correct 2 ms 2644 KB Output is correct
19 Correct 11 ms 3280 KB Output is correct
20 Correct 17 ms 3668 KB Output is correct
21 Correct 24 ms 4192 KB Output is correct
22 Correct 26 ms 4180 KB Output is correct
23 Correct 24 ms 4264 KB Output is correct
24 Correct 26 ms 4188 KB Output is correct
25 Correct 24 ms 4280 KB Output is correct
26 Correct 28 ms 4184 KB Output is correct
27 Correct 25 ms 4184 KB Output is correct
28 Correct 25 ms 4444 KB Output is correct
29 Correct 25 ms 4192 KB Output is correct
30 Correct 25 ms 4196 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 1 ms 2644 KB Output is correct
3 Correct 2 ms 2772 KB Output is correct
4 Correct 10 ms 3284 KB Output is correct
5 Correct 18 ms 4048 KB Output is correct
6 Correct 25 ms 4184 KB Output is correct
7 Correct 31 ms 4944 KB Output is correct
8 Correct 26 ms 4192 KB Output is correct
9 Correct 32 ms 4180 KB Output is correct
10 Correct 26 ms 4444 KB Output is correct
11 Correct 26 ms 4436 KB Output is correct
12 Correct 24 ms 4200 KB Output is correct
13 Correct 28 ms 4252 KB Output is correct
14 Correct 26 ms 4440 KB Output is correct
15 Correct 26 ms 4424 KB Output is correct
16 Correct 1 ms 2644 KB Output is correct
17 Correct 2 ms 2644 KB Output is correct
18 Correct 2 ms 2644 KB Output is correct
19 Correct 11 ms 3280 KB Output is correct
20 Correct 17 ms 3668 KB Output is correct
21 Correct 24 ms 4192 KB Output is correct
22 Correct 26 ms 4180 KB Output is correct
23 Correct 24 ms 4264 KB Output is correct
24 Correct 26 ms 4188 KB Output is correct
25 Correct 24 ms 4280 KB Output is correct
26 Correct 28 ms 4184 KB Output is correct
27 Correct 25 ms 4184 KB Output is correct
28 Correct 25 ms 4444 KB Output is correct
29 Correct 25 ms 4192 KB Output is correct
30 Correct 25 ms 4196 KB Output is correct
31 Correct 1 ms 2644 KB Output is correct
32 Correct 2 ms 2644 KB Output is correct
33 Correct 1 ms 2644 KB Output is correct
34 Correct 2 ms 2644 KB Output is correct
35 Correct 2 ms 2644 KB Output is correct
36 Correct 2 ms 2644 KB Output is correct
37 Correct 5 ms 2900 KB Output is correct
38 Correct 5 ms 2900 KB Output is correct
39 Correct 9 ms 3052 KB Output is correct
40 Correct 17 ms 3412 KB Output is correct
41 Correct 25 ms 3924 KB Output is correct
42 Correct 25 ms 3804 KB Output is correct
43 Correct 25 ms 3804 KB Output is correct
44 Correct 25 ms 3808 KB Output is correct
45 Correct 25 ms 3796 KB Output is correct
46 Correct 25 ms 3852 KB Output is correct
47 Correct 26 ms 3788 KB Output is correct
48 Correct 25 ms 3812 KB Output is correct
49 Correct 26 ms 3812 KB Output is correct
50 Correct 26 ms 3796 KB Output is correct
51 Correct 25 ms 3796 KB Output is correct
52 Correct 25 ms 3820 KB Output is correct
53 Correct 25 ms 3808 KB Output is correct
54 Correct 27 ms 3808 KB Output is correct
55 Correct 25 ms 3892 KB Output is correct
56 Correct 26 ms 3804 KB Output is correct
57 Correct 27 ms 3924 KB Output is correct
58 Correct 25 ms 3804 KB Output is correct
59 Correct 26 ms 3924 KB Output is correct
60 Correct 27 ms 3924 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2664 KB Output is correct
2 Correct 1 ms 2644 KB Output is correct
3 Correct 2 ms 2716 KB Output is correct
4 Correct 1 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 1 ms 2696 KB Output is correct
8 Correct 1 ms 2644 KB Output is correct
9 Correct 2 ms 2644 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 2 ms 2644 KB Output is correct
12 Correct 1 ms 2644 KB Output is correct
13 Correct 2 ms 2772 KB Output is correct
14 Correct 10 ms 3284 KB Output is correct
15 Correct 18 ms 4048 KB Output is correct
16 Correct 25 ms 4184 KB Output is correct
17 Correct 31 ms 4944 KB Output is correct
18 Correct 26 ms 4192 KB Output is correct
19 Correct 32 ms 4180 KB Output is correct
20 Correct 26 ms 4444 KB Output is correct
21 Correct 26 ms 4436 KB Output is correct
22 Correct 24 ms 4200 KB Output is correct
23 Correct 28 ms 4252 KB Output is correct
24 Correct 26 ms 4440 KB Output is correct
25 Correct 26 ms 4424 KB Output is correct
26 Correct 1 ms 2644 KB Output is correct
27 Correct 2 ms 2644 KB Output is correct
28 Correct 2 ms 2644 KB Output is correct
29 Correct 11 ms 3280 KB Output is correct
30 Correct 17 ms 3668 KB Output is correct
31 Correct 24 ms 4192 KB Output is correct
32 Correct 26 ms 4180 KB Output is correct
33 Correct 24 ms 4264 KB Output is correct
34 Correct 26 ms 4188 KB Output is correct
35 Correct 24 ms 4280 KB Output is correct
36 Correct 28 ms 4184 KB Output is correct
37 Correct 25 ms 4184 KB Output is correct
38 Correct 25 ms 4444 KB Output is correct
39 Correct 25 ms 4192 KB Output is correct
40 Correct 25 ms 4196 KB Output is correct
41 Correct 1 ms 2644 KB Output is correct
42 Correct 2 ms 2644 KB Output is correct
43 Correct 1 ms 2644 KB Output is correct
44 Correct 2 ms 2644 KB Output is correct
45 Correct 2 ms 2644 KB Output is correct
46 Correct 2 ms 2644 KB Output is correct
47 Correct 5 ms 2900 KB Output is correct
48 Correct 5 ms 2900 KB Output is correct
49 Correct 9 ms 3052 KB Output is correct
50 Correct 17 ms 3412 KB Output is correct
51 Correct 25 ms 3924 KB Output is correct
52 Correct 25 ms 3804 KB Output is correct
53 Correct 25 ms 3804 KB Output is correct
54 Correct 25 ms 3808 KB Output is correct
55 Correct 25 ms 3796 KB Output is correct
56 Correct 25 ms 3852 KB Output is correct
57 Correct 26 ms 3788 KB Output is correct
58 Correct 25 ms 3812 KB Output is correct
59 Correct 26 ms 3812 KB Output is correct
60 Correct 26 ms 3796 KB Output is correct
61 Correct 25 ms 3796 KB Output is correct
62 Correct 25 ms 3820 KB Output is correct
63 Correct 25 ms 3808 KB Output is correct
64 Correct 27 ms 3808 KB Output is correct
65 Correct 25 ms 3892 KB Output is correct
66 Correct 26 ms 3804 KB Output is correct
67 Correct 27 ms 3924 KB Output is correct
68 Correct 25 ms 3804 KB Output is correct
69 Correct 26 ms 3924 KB Output is correct
70 Correct 27 ms 3924 KB Output is correct
71 Correct 5 ms 2900 KB Output is correct
72 Correct 7 ms 2900 KB Output is correct
73 Correct 6 ms 2832 KB Output is correct
74 Correct 6 ms 2900 KB Output is correct
75 Correct 6 ms 2900 KB Output is correct
76 Correct 11 ms 3028 KB Output is correct
77 Correct 11 ms 3028 KB Output is correct
78 Correct 10 ms 3028 KB Output is correct
79 Correct 9 ms 3032 KB Output is correct
80 Correct 9 ms 3112 KB Output is correct
81 Correct 20 ms 3416 KB Output is correct
82 Correct 17 ms 3412 KB Output is correct
83 Correct 17 ms 3420 KB Output is correct
84 Correct 18 ms 3420 KB Output is correct
85 Correct 17 ms 3416 KB Output is correct
86 Correct 19 ms 3412 KB Output is correct
87 Correct 21 ms 3424 KB Output is correct
88 Correct 21 ms 3428 KB Output is correct
89 Correct 20 ms 3504 KB Output is correct
90 Correct 25 ms 3420 KB Output is correct
91 Correct 30 ms 3808 KB Output is correct
92 Correct 34 ms 3808 KB Output is correct
93 Correct 27 ms 3796 KB Output is correct
94 Correct 28 ms 3796 KB Output is correct
95 Correct 28 ms 3784 KB Output is correct
96 Correct 33 ms 3808 KB Output is correct
97 Correct 32 ms 3916 KB Output is correct
98 Correct 32 ms 3788 KB Output is correct
99 Correct 32 ms 3792 KB Output is correct
100 Correct 33 ms 3812 KB Output is correct
101 Correct 32 ms 3816 KB Output is correct
102 Correct 34 ms 3888 KB Output is correct
103 Correct 32 ms 3808 KB Output is correct
104 Correct 32 ms 3804 KB Output is correct
105 Correct 33 ms 3788 KB Output is correct
106 Correct 32 ms 3800 KB Output is correct
107 Correct 32 ms 3812 KB Output is correct
108 Correct 33 ms 3804 KB Output is correct
109 Correct 32 ms 3796 KB Output is correct
110 Correct 38 ms 3916 KB Output is correct
111 Correct 33 ms 3808 KB Output is correct
112 Correct 34 ms 3796 KB Output is correct
113 Correct 32 ms 3796 KB Output is correct
114 Correct 33 ms 3808 KB Output is correct
115 Correct 34 ms 3812 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2664 KB Output is correct
2 Correct 1 ms 2644 KB Output is correct
3 Correct 2 ms 2716 KB Output is correct
4 Correct 1 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 1 ms 2696 KB Output is correct
8 Correct 1 ms 2644 KB Output is correct
9 Correct 2 ms 2644 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 2 ms 2644 KB Output is correct
12 Correct 1 ms 2644 KB Output is correct
13 Correct 2 ms 2772 KB Output is correct
14 Correct 10 ms 3284 KB Output is correct
15 Correct 18 ms 4048 KB Output is correct
16 Correct 25 ms 4184 KB Output is correct
17 Correct 31 ms 4944 KB Output is correct
18 Correct 26 ms 4192 KB Output is correct
19 Correct 32 ms 4180 KB Output is correct
20 Correct 26 ms 4444 KB Output is correct
21 Correct 26 ms 4436 KB Output is correct
22 Correct 24 ms 4200 KB Output is correct
23 Correct 28 ms 4252 KB Output is correct
24 Correct 26 ms 4440 KB Output is correct
25 Correct 26 ms 4424 KB Output is correct
26 Correct 1 ms 2644 KB Output is correct
27 Correct 2 ms 2644 KB Output is correct
28 Correct 2 ms 2644 KB Output is correct
29 Correct 11 ms 3280 KB Output is correct
30 Correct 17 ms 3668 KB Output is correct
31 Correct 24 ms 4192 KB Output is correct
32 Correct 26 ms 4180 KB Output is correct
33 Correct 24 ms 4264 KB Output is correct
34 Correct 26 ms 4188 KB Output is correct
35 Correct 24 ms 4280 KB Output is correct
36 Correct 28 ms 4184 KB Output is correct
37 Correct 25 ms 4184 KB Output is correct
38 Correct 25 ms 4444 KB Output is correct
39 Correct 25 ms 4192 KB Output is correct
40 Correct 25 ms 4196 KB Output is correct
41 Correct 1 ms 2644 KB Output is correct
42 Correct 2 ms 2644 KB Output is correct
43 Correct 1 ms 2644 KB Output is correct
44 Correct 2 ms 2644 KB Output is correct
45 Correct 2 ms 2644 KB Output is correct
46 Correct 2 ms 2644 KB Output is correct
47 Correct 5 ms 2900 KB Output is correct
48 Correct 5 ms 2900 KB Output is correct
49 Correct 9 ms 3052 KB Output is correct
50 Correct 17 ms 3412 KB Output is correct
51 Correct 25 ms 3924 KB Output is correct
52 Correct 25 ms 3804 KB Output is correct
53 Correct 25 ms 3804 KB Output is correct
54 Correct 25 ms 3808 KB Output is correct
55 Correct 25 ms 3796 KB Output is correct
56 Correct 25 ms 3852 KB Output is correct
57 Correct 26 ms 3788 KB Output is correct
58 Correct 25 ms 3812 KB Output is correct
59 Correct 26 ms 3812 KB Output is correct
60 Correct 26 ms 3796 KB Output is correct
61 Correct 25 ms 3796 KB Output is correct
62 Correct 25 ms 3820 KB Output is correct
63 Correct 25 ms 3808 KB Output is correct
64 Correct 27 ms 3808 KB Output is correct
65 Correct 25 ms 3892 KB Output is correct
66 Correct 26 ms 3804 KB Output is correct
67 Correct 27 ms 3924 KB Output is correct
68 Correct 25 ms 3804 KB Output is correct
69 Correct 26 ms 3924 KB Output is correct
70 Correct 27 ms 3924 KB Output is correct
71 Correct 5 ms 2900 KB Output is correct
72 Correct 7 ms 2900 KB Output is correct
73 Correct 6 ms 2832 KB Output is correct
74 Correct 6 ms 2900 KB Output is correct
75 Correct 6 ms 2900 KB Output is correct
76 Correct 11 ms 3028 KB Output is correct
77 Correct 11 ms 3028 KB Output is correct
78 Correct 10 ms 3028 KB Output is correct
79 Correct 9 ms 3032 KB Output is correct
80 Correct 9 ms 3112 KB Output is correct
81 Correct 20 ms 3416 KB Output is correct
82 Correct 17 ms 3412 KB Output is correct
83 Correct 17 ms 3420 KB Output is correct
84 Correct 18 ms 3420 KB Output is correct
85 Correct 17 ms 3416 KB Output is correct
86 Correct 19 ms 3412 KB Output is correct
87 Correct 21 ms 3424 KB Output is correct
88 Correct 21 ms 3428 KB Output is correct
89 Correct 20 ms 3504 KB Output is correct
90 Correct 25 ms 3420 KB Output is correct
91 Correct 30 ms 3808 KB Output is correct
92 Correct 34 ms 3808 KB Output is correct
93 Correct 27 ms 3796 KB Output is correct
94 Correct 28 ms 3796 KB Output is correct
95 Correct 28 ms 3784 KB Output is correct
96 Correct 33 ms 3808 KB Output is correct
97 Correct 32 ms 3916 KB Output is correct
98 Correct 32 ms 3788 KB Output is correct
99 Correct 32 ms 3792 KB Output is correct
100 Correct 33 ms 3812 KB Output is correct
101 Correct 32 ms 3816 KB Output is correct
102 Correct 34 ms 3888 KB Output is correct
103 Correct 32 ms 3808 KB Output is correct
104 Correct 32 ms 3804 KB Output is correct
105 Correct 33 ms 3788 KB Output is correct
106 Correct 32 ms 3800 KB Output is correct
107 Correct 32 ms 3812 KB Output is correct
108 Correct 33 ms 3804 KB Output is correct
109 Correct 32 ms 3796 KB Output is correct
110 Correct 38 ms 3916 KB Output is correct
111 Correct 33 ms 3808 KB Output is correct
112 Correct 34 ms 3796 KB Output is correct
113 Correct 32 ms 3796 KB Output is correct
114 Correct 33 ms 3808 KB Output is correct
115 Correct 34 ms 3812 KB Output is correct
116 Correct 260 ms 4112 KB Output is correct
117 Correct 300 ms 4160 KB Output is correct
118 Correct 503 ms 4448 KB Output is correct
119 Correct 519 ms 4400 KB Output is correct
120 Correct 392 ms 4412 KB Output is correct
121 Correct 830 ms 4648 KB Output is correct
122 Correct 656 ms 4596 KB Output is correct
123 Correct 2189 ms 5008 KB Output is correct
124 Correct 1439 ms 5160 KB Output is correct
125 Correct 1370 ms 5160 KB Output is correct
126 Correct 4443 ms 5432 KB Output is correct
127 Correct 4415 ms 5432 KB Output is correct
128 Correct 4458 ms 5472 KB Output is correct
129 Correct 4352 ms 5428 KB Output is correct
130 Correct 4415 ms 5432 KB Output is correct
131 Correct 4521 ms 5528 KB Output is correct
132 Correct 4578 ms 5408 KB Output is correct
133 Correct 4581 ms 5536 KB Output is correct
134 Correct 4593 ms 5540 KB Output is correct
135 Correct 4564 ms 5552 KB Output is correct
136 Correct 4635 ms 5564 KB Output is correct
137 Correct 4581 ms 5536 KB Output is correct
138 Correct 4639 ms 5564 KB Output is correct
139 Correct 4588 ms 5532 KB Output is correct
140 Correct 4667 ms 5552 KB Output is correct
141 Correct 4332 ms 5532 KB Output is correct
142 Correct 4195 ms 5532 KB Output is correct
143 Correct 4200 ms 5540 KB Output is correct
144 Correct 4139 ms 5540 KB Output is correct
145 Correct 4151 ms 5544 KB Output is correct
146 Correct 2897 ms 5516 KB Output is correct
147 Correct 2865 ms 5516 KB Output is correct
148 Correct 2879 ms 5516 KB Output is correct
149 Correct 2840 ms 5520 KB Output is correct
150 Correct 2890 ms 5516 KB Output is correct
151 Correct 2856 ms 5496 KB Output is correct
152 Correct 2544 ms 5504 KB Output is correct
153 Correct 2829 ms 5504 KB Output is correct
154 Correct 2788 ms 5504 KB Output is correct
155 Correct 2813 ms 5500 KB Output is correct
156 Correct 4766 ms 5732 KB Output is correct
157 Correct 4532 ms 5760 KB Output is correct
158 Correct 4393 ms 5680 KB Output is correct
159 Correct 4435 ms 5696 KB Output is correct
160 Correct 4444 ms 5684 KB Output is correct
161 Correct 4498 ms 5912 KB Output is correct
162 Correct 4432 ms 5836 KB Output is correct
163 Correct 4422 ms 5720 KB Output is correct
164 Correct 4400 ms 5748 KB Output is correct
165 Correct 4372 ms 5716 KB Output is correct
166 Correct 4846 ms 5700 KB Output is correct
167 Correct 4732 ms 5600 KB Output is correct
168 Correct 4801 ms 5608 KB Output is correct
169 Correct 4867 ms 5688 KB Output is correct
170 Correct 4813 ms 5620 KB Output is correct
171 Correct 4646 ms 5492 KB Output is correct
172 Correct 4592 ms 5496 KB Output is correct
173 Correct 4652 ms 5492 KB Output is correct
174 Correct 4673 ms 5496 KB Output is correct
175 Correct 4758 ms 5580 KB Output is correct