Submission #784109

# Submission time Handle Problem Language Result Execution time Memory
784109 2023-07-15T17:00:08 Z Lobo Diversity (CEOI21_diversity) C++17
64 / 100
7000 ms 33000 KB
#include<bits/stdc++.h>
using namespace std;
const long long inf = (long long) 1e18 + 10;
const int inf1 = (int) 1e9 + 10;
#define int long long
#define dbl long double
#define endl '\n'
#define sc second
#define fr first
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
const int maxn = 3e5+10;

int n, q, a[maxn], ansq[maxn], pre[maxn];

int cost(vector<int> v) {
    int ans = 0;
    int sum_all = 0;
    for(auto x : v) sum_all+= x;
    int sr = sum_all;
    int sl = 0;
    for(int i = 0; i < v.size(); i++) {
        sr-= v[i];
        ans+= sl*sr + v[i]*(sum_all-v[i]) + v[i]*(v[i]+1)/2;
        sl+= v[i];
    }
    return ans;
}

vector<pair<int,int>> vtof(vector<int> v) {
    vector<pair<int,int>> ans;
    if(v.size() == 0) return ans;
    ans.pb(mp(v[0],1));
    for(int i = 1; i < v.size(); i++) {
        if(v[i] == v[i-1]) {
            ans.back().sc++;
        }
        else {
            ans.pb(mp(v[i],1));
        }
    }
    return ans;
}

// val, freq
int costf(vector<pair<int,int>> v) {
    int ans = 0;
    int sum_all = 0;
    for(auto x : v) sum_all+= x.fr*x.sc;
    int sr = sum_all;
    int sl = 0;
    for(int i = 0; i < v.size(); i++) {
        int val = v[i].fr;
        int frq = v[i].sc;
        sr-= val*frq;
        ans+= sl*sr*frq + (frq*(frq+1)/2)*val*(sl+sr) + frq*(val*(val+1)/2);

        if(frq >= 2) {
            ans+= val*val*(frq-1)*(frq);
            ans+= val*val*frq*(frq-2)*(frq-1)/2;
            ans-= pre[frq-2]*val*val;
            // for(int j = 1; j <= frq-2; j++) {
            //     ans-= val*val*j*(j+1);
            // }
        }
        sl+= val*frq;
    }
    return ans;
}
const int B = 1300;
vector<pair<pair<int,int>,int>> bls[maxn];
void solve() {

    // vector<pair<int,int>> wtf = {{2,3}};
    // // vector<pair<int,int>> wtf = {{2,1},{2,1},{2,1}};
    // cout << costf(wtf) << endl;
    // exit(0);
    cin >> n >> q;
    vector<int> cc;

    for(int i = 1; i <= n; i++) {
        pre[i] = pre[i-1]+i*(i+1);
        cin >> a[i];
        cc.pb(a[i]);
    }
    sort(all(cc));
    cc.erase(unique(all(cc)),cc.end());
    for(int i = 1; i <= n; i++) a[i] = upper_bound(all(cc),a[i])-cc.begin();

    for(int i = 1; i <= q; i++) {
        int l,r; cin >> l >> r;
        bls[l/B].pb(mp(mp(r,l),i));
    }

    for(int b = 0; b*B <= n; b++) {
        sort(all(bls[b]));

        int l = b*B;
        int r = b*B-1;
        map<int,int> fq, fq1;
        for(auto X : bls[b]) {
            int l1 = X.fr.sc;
            int r1 = X.fr.fr;

            while(r < r1) {
                fq1[fq[a[r+1]]]--;
                fq[a[r+1]]++;
                fq1[fq[a[r+1]]]++;
                r++;
            }

            while(l < l1) {
                fq1[fq[a[l]]]--;
                fq[a[l]]--;
                fq1[fq[a[l]]]++;
                l++;
            }

            while(l > l1) {
                fq1[fq[a[l-1]]]--;
                fq[a[l-1]]++;
                fq1[fq[a[l-1]]]++;
                l--;
            }

            vector<pair<int,int>> v1;
            deque<pair<int,int>> v;
            for(auto x : fq1) {
                if(x.fr != 0) v1.pb(x);
            }

            sort(all(v1),greater<pair<int,int>>());

            int cnt = 0;
            for(auto x : v1) {
                int x1 = x.sc/2;
                int x2 = x.sc-x1;

                if(x1 != x2) {
                    if(cnt == 0 && x1 > x2) swap(x1,x2);
                    else if(cnt == 1 && x1 < x2) swap(x1,x2);
                    cnt^=1;
                }
                v.pb(mp(x.fr,x1));
                v.push_front(mp(x.fr,x2));
            }

            vector<pair<int,int>> vv;
            for(auto x : v) {
                if(x.sc != 0) vv.pb(x);
            }

            // cout << X.sc << " " << l << " " << r << endl;
            // for(auto x : fq) cout << " " << x.fr << " " << x.sc << endl;
            // for(auto x : vv) cout << "  " << x.fr << " " << x.sc << endl;
            ansq[X.sc] = costf(vv);

            // cout << costf(vv) << endl;
            // vector<int> vvv;
            // for(auto x : vv) {
            //     for(int i = 0; i < x.sc; i++) {
            //         vvv.pb(x.fr);
            //     }
            // }
            // for(auto x : vvv) cout << " " << x << endl;
            // cout << cost(vvv) << endl;
            // assert(cost(vvv) == costf(vv));
        }
    }

    for(int i = 1; i <= q; i++) {
        cout << ansq[i] << endl;
    }
}

int32_t main() {
    ios::sync_with_stdio(false); cin.tie(0);

    // freopen("in.in", "r", stdin);
    // freopen("out.out", "w", stdout);
    int tt = 1;
    // cin >> tt;
    while(tt--) {
        solve();
    }

}

Compilation message

diversity.cpp: In function 'long long int cost(std::vector<long long int>)':
diversity.cpp:23:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for(int i = 0; i < v.size(); i++) {
      |                    ~~^~~~~~~~~~
diversity.cpp: In function 'std::vector<std::pair<long long int, long long int> > vtof(std::vector<long long int>)':
diversity.cpp:35:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     for(int i = 1; i < v.size(); i++) {
      |                    ~~^~~~~~~~~~
diversity.cpp: In function 'long long int costf(std::vector<std::pair<long long int, long long int> >)':
diversity.cpp:53:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |     for(int i = 0; i < v.size(); i++) {
      |                    ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7380 KB Output is correct
2 Correct 6 ms 7372 KB Output is correct
3 Correct 4 ms 7336 KB Output is correct
4 Correct 4 ms 7380 KB Output is correct
5 Correct 4 ms 7372 KB Output is correct
6 Correct 4 ms 7376 KB Output is correct
7 Correct 4 ms 7380 KB Output is correct
8 Correct 4 ms 7396 KB Output is correct
9 Correct 4 ms 7372 KB Output is correct
10 Correct 3 ms 7376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7380 KB Output is correct
2 Correct 4 ms 7380 KB Output is correct
3 Correct 6 ms 7892 KB Output is correct
4 Correct 31 ms 12892 KB Output is correct
5 Correct 65 ms 20836 KB Output is correct
6 Correct 91 ms 21588 KB Output is correct
7 Correct 112 ms 33000 KB Output is correct
8 Correct 102 ms 20656 KB Output is correct
9 Correct 90 ms 21068 KB Output is correct
10 Correct 97 ms 26204 KB Output is correct
11 Correct 101 ms 23060 KB Output is correct
12 Correct 92 ms 21004 KB Output is correct
13 Correct 96 ms 20660 KB Output is correct
14 Correct 93 ms 23684 KB Output is correct
15 Correct 93 ms 22772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7380 KB Output is correct
2 Correct 4 ms 7380 KB Output is correct
3 Correct 6 ms 7892 KB Output is correct
4 Correct 31 ms 12892 KB Output is correct
5 Correct 65 ms 20836 KB Output is correct
6 Correct 91 ms 21588 KB Output is correct
7 Correct 112 ms 33000 KB Output is correct
8 Correct 102 ms 20656 KB Output is correct
9 Correct 90 ms 21068 KB Output is correct
10 Correct 97 ms 26204 KB Output is correct
11 Correct 101 ms 23060 KB Output is correct
12 Correct 92 ms 21004 KB Output is correct
13 Correct 96 ms 20660 KB Output is correct
14 Correct 93 ms 23684 KB Output is correct
15 Correct 93 ms 22772 KB Output is correct
16 Correct 4 ms 7380 KB Output is correct
17 Correct 3 ms 7380 KB Output is correct
18 Correct 6 ms 7764 KB Output is correct
19 Correct 31 ms 11928 KB Output is correct
20 Correct 62 ms 15892 KB Output is correct
21 Correct 98 ms 21816 KB Output is correct
22 Correct 99 ms 19640 KB Output is correct
23 Correct 98 ms 20856 KB Output is correct
24 Correct 102 ms 19284 KB Output is correct
25 Correct 98 ms 19932 KB Output is correct
26 Correct 97 ms 19668 KB Output is correct
27 Correct 96 ms 20268 KB Output is correct
28 Correct 101 ms 23772 KB Output is correct
29 Correct 93 ms 19864 KB Output is correct
30 Correct 99 ms 20148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7380 KB Output is correct
2 Correct 4 ms 7380 KB Output is correct
3 Correct 6 ms 7892 KB Output is correct
4 Correct 31 ms 12892 KB Output is correct
5 Correct 65 ms 20836 KB Output is correct
6 Correct 91 ms 21588 KB Output is correct
7 Correct 112 ms 33000 KB Output is correct
8 Correct 102 ms 20656 KB Output is correct
9 Correct 90 ms 21068 KB Output is correct
10 Correct 97 ms 26204 KB Output is correct
11 Correct 101 ms 23060 KB Output is correct
12 Correct 92 ms 21004 KB Output is correct
13 Correct 96 ms 20660 KB Output is correct
14 Correct 93 ms 23684 KB Output is correct
15 Correct 93 ms 22772 KB Output is correct
16 Correct 4 ms 7380 KB Output is correct
17 Correct 3 ms 7380 KB Output is correct
18 Correct 6 ms 7764 KB Output is correct
19 Correct 31 ms 11928 KB Output is correct
20 Correct 62 ms 15892 KB Output is correct
21 Correct 98 ms 21816 KB Output is correct
22 Correct 99 ms 19640 KB Output is correct
23 Correct 98 ms 20856 KB Output is correct
24 Correct 102 ms 19284 KB Output is correct
25 Correct 98 ms 19932 KB Output is correct
26 Correct 97 ms 19668 KB Output is correct
27 Correct 96 ms 20268 KB Output is correct
28 Correct 101 ms 23772 KB Output is correct
29 Correct 93 ms 19864 KB Output is correct
30 Correct 99 ms 20148 KB Output is correct
31 Correct 5 ms 7380 KB Output is correct
32 Correct 4 ms 7380 KB Output is correct
33 Correct 3 ms 7380 KB Output is correct
34 Correct 6 ms 7764 KB Output is correct
35 Correct 7 ms 7764 KB Output is correct
36 Correct 8 ms 7772 KB Output is correct
37 Correct 22 ms 8892 KB Output is correct
38 Correct 23 ms 8788 KB Output is correct
39 Correct 42 ms 10240 KB Output is correct
40 Correct 83 ms 13104 KB Output is correct
41 Correct 125 ms 16828 KB Output is correct
42 Correct 125 ms 16828 KB Output is correct
43 Correct 123 ms 16768 KB Output is correct
44 Correct 123 ms 16768 KB Output is correct
45 Correct 120 ms 16848 KB Output is correct
46 Correct 130 ms 16876 KB Output is correct
47 Correct 123 ms 16828 KB Output is correct
48 Correct 125 ms 16824 KB Output is correct
49 Correct 123 ms 16848 KB Output is correct
50 Correct 125 ms 16848 KB Output is correct
51 Correct 121 ms 16788 KB Output is correct
52 Correct 122 ms 16844 KB Output is correct
53 Correct 125 ms 16812 KB Output is correct
54 Correct 129 ms 16840 KB Output is correct
55 Correct 124 ms 16796 KB Output is correct
56 Correct 123 ms 16844 KB Output is correct
57 Correct 122 ms 16756 KB Output is correct
58 Correct 131 ms 16864 KB Output is correct
59 Correct 125 ms 16820 KB Output is correct
60 Correct 124 ms 16848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7380 KB Output is correct
2 Correct 6 ms 7372 KB Output is correct
3 Correct 4 ms 7336 KB Output is correct
4 Correct 4 ms 7380 KB Output is correct
5 Correct 4 ms 7372 KB Output is correct
6 Correct 4 ms 7376 KB Output is correct
7 Correct 4 ms 7380 KB Output is correct
8 Correct 4 ms 7396 KB Output is correct
9 Correct 4 ms 7372 KB Output is correct
10 Correct 3 ms 7376 KB Output is correct
11 Correct 4 ms 7380 KB Output is correct
12 Correct 4 ms 7380 KB Output is correct
13 Correct 6 ms 7892 KB Output is correct
14 Correct 31 ms 12892 KB Output is correct
15 Correct 65 ms 20836 KB Output is correct
16 Correct 91 ms 21588 KB Output is correct
17 Correct 112 ms 33000 KB Output is correct
18 Correct 102 ms 20656 KB Output is correct
19 Correct 90 ms 21068 KB Output is correct
20 Correct 97 ms 26204 KB Output is correct
21 Correct 101 ms 23060 KB Output is correct
22 Correct 92 ms 21004 KB Output is correct
23 Correct 96 ms 20660 KB Output is correct
24 Correct 93 ms 23684 KB Output is correct
25 Correct 93 ms 22772 KB Output is correct
26 Correct 4 ms 7380 KB Output is correct
27 Correct 3 ms 7380 KB Output is correct
28 Correct 6 ms 7764 KB Output is correct
29 Correct 31 ms 11928 KB Output is correct
30 Correct 62 ms 15892 KB Output is correct
31 Correct 98 ms 21816 KB Output is correct
32 Correct 99 ms 19640 KB Output is correct
33 Correct 98 ms 20856 KB Output is correct
34 Correct 102 ms 19284 KB Output is correct
35 Correct 98 ms 19932 KB Output is correct
36 Correct 97 ms 19668 KB Output is correct
37 Correct 96 ms 20268 KB Output is correct
38 Correct 101 ms 23772 KB Output is correct
39 Correct 93 ms 19864 KB Output is correct
40 Correct 99 ms 20148 KB Output is correct
41 Correct 5 ms 7380 KB Output is correct
42 Correct 4 ms 7380 KB Output is correct
43 Correct 3 ms 7380 KB Output is correct
44 Correct 6 ms 7764 KB Output is correct
45 Correct 7 ms 7764 KB Output is correct
46 Correct 8 ms 7772 KB Output is correct
47 Correct 22 ms 8892 KB Output is correct
48 Correct 23 ms 8788 KB Output is correct
49 Correct 42 ms 10240 KB Output is correct
50 Correct 83 ms 13104 KB Output is correct
51 Correct 125 ms 16828 KB Output is correct
52 Correct 125 ms 16828 KB Output is correct
53 Correct 123 ms 16768 KB Output is correct
54 Correct 123 ms 16768 KB Output is correct
55 Correct 120 ms 16848 KB Output is correct
56 Correct 130 ms 16876 KB Output is correct
57 Correct 123 ms 16828 KB Output is correct
58 Correct 125 ms 16824 KB Output is correct
59 Correct 123 ms 16848 KB Output is correct
60 Correct 125 ms 16848 KB Output is correct
61 Correct 121 ms 16788 KB Output is correct
62 Correct 122 ms 16844 KB Output is correct
63 Correct 125 ms 16812 KB Output is correct
64 Correct 129 ms 16840 KB Output is correct
65 Correct 124 ms 16796 KB Output is correct
66 Correct 123 ms 16844 KB Output is correct
67 Correct 122 ms 16756 KB Output is correct
68 Correct 131 ms 16864 KB Output is correct
69 Correct 125 ms 16820 KB Output is correct
70 Correct 124 ms 16848 KB Output is correct
71 Correct 25 ms 8916 KB Output is correct
72 Correct 24 ms 8924 KB Output is correct
73 Correct 24 ms 8920 KB Output is correct
74 Correct 23 ms 8916 KB Output is correct
75 Correct 24 ms 8824 KB Output is correct
76 Correct 47 ms 10452 KB Output is correct
77 Correct 48 ms 10428 KB Output is correct
78 Correct 47 ms 10492 KB Output is correct
79 Correct 48 ms 10468 KB Output is correct
80 Correct 47 ms 10452 KB Output is correct
81 Correct 99 ms 13668 KB Output is correct
82 Correct 99 ms 13680 KB Output is correct
83 Correct 108 ms 13660 KB Output is correct
84 Correct 101 ms 13664 KB Output is correct
85 Correct 101 ms 13672 KB Output is correct
86 Correct 109 ms 14336 KB Output is correct
87 Correct 110 ms 14292 KB Output is correct
88 Correct 110 ms 14324 KB Output is correct
89 Correct 110 ms 14364 KB Output is correct
90 Correct 108 ms 14336 KB Output is correct
91 Correct 191 ms 22308 KB Output is correct
92 Correct 199 ms 22372 KB Output is correct
93 Correct 194 ms 22324 KB Output is correct
94 Correct 212 ms 22288 KB Output is correct
95 Correct 199 ms 22404 KB Output is correct
96 Correct 222 ms 28808 KB Output is correct
97 Correct 223 ms 28728 KB Output is correct
98 Correct 236 ms 28760 KB Output is correct
99 Correct 223 ms 28724 KB Output is correct
100 Correct 231 ms 28728 KB Output is correct
101 Correct 257 ms 28728 KB Output is correct
102 Correct 222 ms 28760 KB Output is correct
103 Correct 231 ms 28756 KB Output is correct
104 Correct 237 ms 28800 KB Output is correct
105 Correct 226 ms 28724 KB Output is correct
106 Correct 238 ms 31900 KB Output is correct
107 Correct 250 ms 31972 KB Output is correct
108 Correct 242 ms 31928 KB Output is correct
109 Correct 269 ms 31928 KB Output is correct
110 Correct 256 ms 31896 KB Output is correct
111 Correct 237 ms 31908 KB Output is correct
112 Correct 268 ms 31916 KB Output is correct
113 Correct 232 ms 31904 KB Output is correct
114 Correct 256 ms 31888 KB Output is correct
115 Correct 256 ms 31924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7380 KB Output is correct
2 Correct 6 ms 7372 KB Output is correct
3 Correct 4 ms 7336 KB Output is correct
4 Correct 4 ms 7380 KB Output is correct
5 Correct 4 ms 7372 KB Output is correct
6 Correct 4 ms 7376 KB Output is correct
7 Correct 4 ms 7380 KB Output is correct
8 Correct 4 ms 7396 KB Output is correct
9 Correct 4 ms 7372 KB Output is correct
10 Correct 3 ms 7376 KB Output is correct
11 Correct 4 ms 7380 KB Output is correct
12 Correct 4 ms 7380 KB Output is correct
13 Correct 6 ms 7892 KB Output is correct
14 Correct 31 ms 12892 KB Output is correct
15 Correct 65 ms 20836 KB Output is correct
16 Correct 91 ms 21588 KB Output is correct
17 Correct 112 ms 33000 KB Output is correct
18 Correct 102 ms 20656 KB Output is correct
19 Correct 90 ms 21068 KB Output is correct
20 Correct 97 ms 26204 KB Output is correct
21 Correct 101 ms 23060 KB Output is correct
22 Correct 92 ms 21004 KB Output is correct
23 Correct 96 ms 20660 KB Output is correct
24 Correct 93 ms 23684 KB Output is correct
25 Correct 93 ms 22772 KB Output is correct
26 Correct 4 ms 7380 KB Output is correct
27 Correct 3 ms 7380 KB Output is correct
28 Correct 6 ms 7764 KB Output is correct
29 Correct 31 ms 11928 KB Output is correct
30 Correct 62 ms 15892 KB Output is correct
31 Correct 98 ms 21816 KB Output is correct
32 Correct 99 ms 19640 KB Output is correct
33 Correct 98 ms 20856 KB Output is correct
34 Correct 102 ms 19284 KB Output is correct
35 Correct 98 ms 19932 KB Output is correct
36 Correct 97 ms 19668 KB Output is correct
37 Correct 96 ms 20268 KB Output is correct
38 Correct 101 ms 23772 KB Output is correct
39 Correct 93 ms 19864 KB Output is correct
40 Correct 99 ms 20148 KB Output is correct
41 Correct 5 ms 7380 KB Output is correct
42 Correct 4 ms 7380 KB Output is correct
43 Correct 3 ms 7380 KB Output is correct
44 Correct 6 ms 7764 KB Output is correct
45 Correct 7 ms 7764 KB Output is correct
46 Correct 8 ms 7772 KB Output is correct
47 Correct 22 ms 8892 KB Output is correct
48 Correct 23 ms 8788 KB Output is correct
49 Correct 42 ms 10240 KB Output is correct
50 Correct 83 ms 13104 KB Output is correct
51 Correct 125 ms 16828 KB Output is correct
52 Correct 125 ms 16828 KB Output is correct
53 Correct 123 ms 16768 KB Output is correct
54 Correct 123 ms 16768 KB Output is correct
55 Correct 120 ms 16848 KB Output is correct
56 Correct 130 ms 16876 KB Output is correct
57 Correct 123 ms 16828 KB Output is correct
58 Correct 125 ms 16824 KB Output is correct
59 Correct 123 ms 16848 KB Output is correct
60 Correct 125 ms 16848 KB Output is correct
61 Correct 121 ms 16788 KB Output is correct
62 Correct 122 ms 16844 KB Output is correct
63 Correct 125 ms 16812 KB Output is correct
64 Correct 129 ms 16840 KB Output is correct
65 Correct 124 ms 16796 KB Output is correct
66 Correct 123 ms 16844 KB Output is correct
67 Correct 122 ms 16756 KB Output is correct
68 Correct 131 ms 16864 KB Output is correct
69 Correct 125 ms 16820 KB Output is correct
70 Correct 124 ms 16848 KB Output is correct
71 Correct 25 ms 8916 KB Output is correct
72 Correct 24 ms 8924 KB Output is correct
73 Correct 24 ms 8920 KB Output is correct
74 Correct 23 ms 8916 KB Output is correct
75 Correct 24 ms 8824 KB Output is correct
76 Correct 47 ms 10452 KB Output is correct
77 Correct 48 ms 10428 KB Output is correct
78 Correct 47 ms 10492 KB Output is correct
79 Correct 48 ms 10468 KB Output is correct
80 Correct 47 ms 10452 KB Output is correct
81 Correct 99 ms 13668 KB Output is correct
82 Correct 99 ms 13680 KB Output is correct
83 Correct 108 ms 13660 KB Output is correct
84 Correct 101 ms 13664 KB Output is correct
85 Correct 101 ms 13672 KB Output is correct
86 Correct 109 ms 14336 KB Output is correct
87 Correct 110 ms 14292 KB Output is correct
88 Correct 110 ms 14324 KB Output is correct
89 Correct 110 ms 14364 KB Output is correct
90 Correct 108 ms 14336 KB Output is correct
91 Correct 191 ms 22308 KB Output is correct
92 Correct 199 ms 22372 KB Output is correct
93 Correct 194 ms 22324 KB Output is correct
94 Correct 212 ms 22288 KB Output is correct
95 Correct 199 ms 22404 KB Output is correct
96 Correct 222 ms 28808 KB Output is correct
97 Correct 223 ms 28728 KB Output is correct
98 Correct 236 ms 28760 KB Output is correct
99 Correct 223 ms 28724 KB Output is correct
100 Correct 231 ms 28728 KB Output is correct
101 Correct 257 ms 28728 KB Output is correct
102 Correct 222 ms 28760 KB Output is correct
103 Correct 231 ms 28756 KB Output is correct
104 Correct 237 ms 28800 KB Output is correct
105 Correct 226 ms 28724 KB Output is correct
106 Correct 238 ms 31900 KB Output is correct
107 Correct 250 ms 31972 KB Output is correct
108 Correct 242 ms 31928 KB Output is correct
109 Correct 269 ms 31928 KB Output is correct
110 Correct 256 ms 31896 KB Output is correct
111 Correct 237 ms 31908 KB Output is correct
112 Correct 268 ms 31916 KB Output is correct
113 Correct 232 ms 31904 KB Output is correct
114 Correct 256 ms 31888 KB Output is correct
115 Correct 256 ms 31924 KB Output is correct
116 Correct 2813 ms 10472 KB Output is correct
117 Correct 2690 ms 10488 KB Output is correct
118 Correct 4426 ms 12028 KB Output is correct
119 Correct 4196 ms 11996 KB Output is correct
120 Correct 4496 ms 11964 KB Output is correct
121 Correct 5777 ms 13352 KB Output is correct
122 Correct 5979 ms 13428 KB Output is correct
123 Execution timed out 7050 ms 15968 KB Time limit exceeded
124 Halted 0 ms 0 KB -