답안 #752657

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
752657 2023-06-03T11:29:13 Z 이동현(#9968) Diversity (CEOI21_diversity) C++17
64 / 100
7000 ms 9600 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define mi(x, y) (x = min(x, y))
#define ma(x, y) (x = max(x, y))
using namespace std;

const int NS = (int)3e5 + 4, TS = 150014, QS = 50004;
int n, q, B;
long long t1[TS], t2[TS], t3[TS], t4[TS];
int a[NS];
int stkn;
int fir[NS], ed[NS], cnt[NS], pos[NS], stk[NS];
long long out[QS];

struct Data{
    int l, r, id;
    Data(){}
    bool operator<(const Data&R)const{
        return (l / B < R.l / B) || (l / B == R.l / B && r < R.r);
    }
}que[QS];

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    memset(ed, -1, sizeof(ed));
    int n, q;
    cin >> n >> q;
    //n = 300000, q = 50000;
    for(int i = 1; i <= n; ++i){
        cin >> a[i];
        //a[i] = i;
    }
    for(int i = 1; i <= q; ++i){
        cin >> que[i].l >> que[i].r;
        //que[i].l = i, que[i].r = i * 6;
        que[i].id = i;
    }

    B = 1300;
    sort(que + 1, que + q + 1);
    int l = 1, r = 0;
    long long ans = 0, szans = 0;
    auto upd = [&](int p, int v, int osz){
        --p;
        //cout << p << ' ' << v << ' ' << osz << endl;
        //cout << fir[2] << ' ' << fir[3] << endl;

        szans += (osz + (v > 0 ? v : 0)) * v;
        ans += (osz + (v > 0 ? v : 0)) * v;
        if(p % 2){
            long long t1a = 0, t2a = 0, t3a = 0, t4a = 0;
            long long t1p = 0, t2p = 0;
            for(int i = TS - 1; i > 0; i -= (i & -i)){
                t1a += t1[i], t2a += t2[i], t3a += t3[i], t4a += t4[i];
            }
            for(int i = p / 2 + 1; i > 0; i -= (i & -i)){
                t1p += t1[i], t2p += t2[i];
            }
            t1a -= osz, t1p -= osz, t2a -= osz * (p / 2), t2p -= osz * (p / 2);

            szans += v * (t3a + t1a);
            //cout << ans << ' ' << szans << ' ' << t3a << ' ' << t4a << endl;
            ans += 2 * v * t3a + (p / 2) * v * t3a + t4a * v;
            ans += v * t1a + ((p / 2) * v * t1p - t2p * v) - ((p / 2) * v * (t1a - t1p) - (t2a - t2p) * v);

            for(int i = p / 2 + 1; i < TS; i += (i & -i)){
                t1[i] += v;
                t2[i] += v * (p / 2);
            }
        }
        else{
            long long t1a = 0, t2a = 0, t3a = 0, t4a = 0;
            long long t3p = 0, t4p = 0;
            for(int i = TS - 1; i > 0; i -= (i & -i)){
                t1a += t1[i], t2a += t2[i], t3a += t3[i], t4a += t4[i];
            }
            for(int i = p / 2 + 1; i > 0; i -= (i & -i)){
                t3p += t3[i], t4p += t4[i];
            }
            t3a -= osz, t3p -= osz, t4a -= osz * (p / 2), t4p -= osz * (p / 2);

            //cout << "SDF" << ' ' << t1a << ' ' << t2a << ' ' << t3a << ' ' << t4a << ' ' << t3p << ' ' << t4p << endl;

            szans += v * (t1a + t3a);
            ans += 2 * v * t1a + (p / 2) * v * t1a + t2a * v;
            ans += v * t3a + ((p / 2) * v * t3p - t4p * v) - ((p / 2) * v * (t3a - t3p) - (t4a - t4p) * v);

            for(int i = p / 2 + 1; i < TS; i += (i & -i)){
                t3[i] += v;
                t4[i] += v * (p / 2);
            }
        }

        //cout << ans << ' ' << szans << endl;
    };
    auto add = [&](int val){
        if(!cnt[val]) pos[val] = ++stkn, stk[stkn] = val;
        int ch1 = pos[val], osz = cnt[val];
        if(cnt[val] && stk[fir[cnt[val]]] != val){
            int nxt = stk[fir[cnt[val]]];
            ch1 = pos[nxt];
            swap(stk[pos[val]], stk[pos[nxt]]);
            swap(pos[val], pos[nxt]);
        }
        ++fir[cnt[val]];
        ++cnt[val];
        if(fir[cnt[val]] > ed[cnt[val]]) fir[cnt[val]] = ed[cnt[val]] = pos[val];
        else ++ed[cnt[val]];

        upd(ch1, 1, osz);
    };
    auto del = [&](int val){
        int ch1 = pos[val], osz = cnt[val];
        if(cnt[val] && stk[ed[cnt[val]]] != val){
            int nxt = stk[ed[cnt[val]]];
            ch1 = pos[nxt];
            swap(stk[pos[val]], stk[pos[nxt]]);
            swap(pos[val], pos[nxt]);
        }
        --ed[cnt[val]];
        --cnt[val];
        if(fir[cnt[val]] > ed[cnt[val]]) fir[cnt[val]] = ed[cnt[val]] = pos[val];
        else --fir[cnt[val]];

        upd(ch1, -1, osz);

        if(!cnt[val]) stk[stkn] = 0, --stkn, pos[val] = 0;
    };
    for(int i = 1; i <= q; ++i){
        while(r < que[i].r){
            ++r;
            add(a[r]);
        }
        while(l > que[i].l){
            --l;
            add(a[l]);
        }
        while(r > que[i].r){
            del(a[r]);
            --r;
        }
        while(l < que[i].l){
            del(a[l]);
            ++l;
        }

        out[que[i].id] = ans - szans * stkn + (long long)stkn * (que[i].r - que[i].l + 1) * (que[i].r - que[i].l + 2) / 2;
    }

    for(int i = 1; i <= q; ++i){
        cout << out[i] << '\n';
    }
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1620 KB Output is correct
2 Correct 1 ms 1620 KB Output is correct
3 Correct 1 ms 1620 KB Output is correct
4 Correct 1 ms 1620 KB Output is correct
5 Correct 1 ms 1620 KB Output is correct
6 Correct 1 ms 1620 KB Output is correct
7 Correct 1 ms 1620 KB Output is correct
8 Correct 1 ms 1620 KB Output is correct
9 Correct 1 ms 1620 KB Output is correct
10 Correct 1 ms 1620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1620 KB Output is correct
2 Correct 1 ms 1620 KB Output is correct
3 Correct 4 ms 1748 KB Output is correct
4 Correct 24 ms 2136 KB Output is correct
5 Correct 54 ms 2728 KB Output is correct
6 Correct 83 ms 2972 KB Output is correct
7 Correct 81 ms 3448 KB Output is correct
8 Correct 72 ms 3004 KB Output is correct
9 Correct 69 ms 3024 KB Output is correct
10 Correct 72 ms 3148 KB Output is correct
11 Correct 77 ms 3120 KB Output is correct
12 Correct 84 ms 2972 KB Output is correct
13 Correct 70 ms 3044 KB Output is correct
14 Correct 72 ms 3128 KB Output is correct
15 Correct 70 ms 3072 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1620 KB Output is correct
2 Correct 1 ms 1620 KB Output is correct
3 Correct 4 ms 1748 KB Output is correct
4 Correct 24 ms 2136 KB Output is correct
5 Correct 54 ms 2728 KB Output is correct
6 Correct 83 ms 2972 KB Output is correct
7 Correct 81 ms 3448 KB Output is correct
8 Correct 72 ms 3004 KB Output is correct
9 Correct 69 ms 3024 KB Output is correct
10 Correct 72 ms 3148 KB Output is correct
11 Correct 77 ms 3120 KB Output is correct
12 Correct 84 ms 2972 KB Output is correct
13 Correct 70 ms 3044 KB Output is correct
14 Correct 72 ms 3128 KB Output is correct
15 Correct 70 ms 3072 KB Output is correct
16 Correct 1 ms 1620 KB Output is correct
17 Correct 1 ms 1620 KB Output is correct
18 Correct 4 ms 1748 KB Output is correct
19 Correct 26 ms 2140 KB Output is correct
20 Correct 48 ms 2556 KB Output is correct
21 Correct 72 ms 3008 KB Output is correct
22 Correct 68 ms 3016 KB Output is correct
23 Correct 69 ms 3012 KB Output is correct
24 Correct 70 ms 2932 KB Output is correct
25 Correct 76 ms 3064 KB Output is correct
26 Correct 74 ms 3004 KB Output is correct
27 Correct 71 ms 2976 KB Output is correct
28 Correct 83 ms 3068 KB Output is correct
29 Correct 74 ms 2980 KB Output is correct
30 Correct 70 ms 2936 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1620 KB Output is correct
2 Correct 1 ms 1620 KB Output is correct
3 Correct 4 ms 1748 KB Output is correct
4 Correct 24 ms 2136 KB Output is correct
5 Correct 54 ms 2728 KB Output is correct
6 Correct 83 ms 2972 KB Output is correct
7 Correct 81 ms 3448 KB Output is correct
8 Correct 72 ms 3004 KB Output is correct
9 Correct 69 ms 3024 KB Output is correct
10 Correct 72 ms 3148 KB Output is correct
11 Correct 77 ms 3120 KB Output is correct
12 Correct 84 ms 2972 KB Output is correct
13 Correct 70 ms 3044 KB Output is correct
14 Correct 72 ms 3128 KB Output is correct
15 Correct 70 ms 3072 KB Output is correct
16 Correct 1 ms 1620 KB Output is correct
17 Correct 1 ms 1620 KB Output is correct
18 Correct 4 ms 1748 KB Output is correct
19 Correct 26 ms 2140 KB Output is correct
20 Correct 48 ms 2556 KB Output is correct
21 Correct 72 ms 3008 KB Output is correct
22 Correct 68 ms 3016 KB Output is correct
23 Correct 69 ms 3012 KB Output is correct
24 Correct 70 ms 2932 KB Output is correct
25 Correct 76 ms 3064 KB Output is correct
26 Correct 74 ms 3004 KB Output is correct
27 Correct 71 ms 2976 KB Output is correct
28 Correct 83 ms 3068 KB Output is correct
29 Correct 74 ms 2980 KB Output is correct
30 Correct 70 ms 2936 KB Output is correct
31 Correct 1 ms 1620 KB Output is correct
32 Correct 1 ms 1620 KB Output is correct
33 Correct 1 ms 1620 KB Output is correct
34 Correct 3 ms 1748 KB Output is correct
35 Correct 3 ms 1620 KB Output is correct
36 Correct 4 ms 1748 KB Output is correct
37 Correct 14 ms 1876 KB Output is correct
38 Correct 13 ms 1876 KB Output is correct
39 Correct 25 ms 2004 KB Output is correct
40 Correct 51 ms 2472 KB Output is correct
41 Correct 71 ms 2772 KB Output is correct
42 Correct 72 ms 2872 KB Output is correct
43 Correct 75 ms 2884 KB Output is correct
44 Correct 75 ms 2872 KB Output is correct
45 Correct 78 ms 2764 KB Output is correct
46 Correct 70 ms 2884 KB Output is correct
47 Correct 68 ms 2868 KB Output is correct
48 Correct 69 ms 2772 KB Output is correct
49 Correct 70 ms 2872 KB Output is correct
50 Correct 70 ms 2880 KB Output is correct
51 Correct 68 ms 2772 KB Output is correct
52 Correct 75 ms 2872 KB Output is correct
53 Correct 68 ms 2868 KB Output is correct
54 Correct 71 ms 2864 KB Output is correct
55 Correct 70 ms 2784 KB Output is correct
56 Correct 74 ms 2772 KB Output is correct
57 Correct 72 ms 2876 KB Output is correct
58 Correct 70 ms 2868 KB Output is correct
59 Correct 76 ms 2868 KB Output is correct
60 Correct 71 ms 2884 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1620 KB Output is correct
2 Correct 1 ms 1620 KB Output is correct
3 Correct 1 ms 1620 KB Output is correct
4 Correct 1 ms 1620 KB Output is correct
5 Correct 1 ms 1620 KB Output is correct
6 Correct 1 ms 1620 KB Output is correct
7 Correct 1 ms 1620 KB Output is correct
8 Correct 1 ms 1620 KB Output is correct
9 Correct 1 ms 1620 KB Output is correct
10 Correct 1 ms 1620 KB Output is correct
11 Correct 1 ms 1620 KB Output is correct
12 Correct 1 ms 1620 KB Output is correct
13 Correct 4 ms 1748 KB Output is correct
14 Correct 24 ms 2136 KB Output is correct
15 Correct 54 ms 2728 KB Output is correct
16 Correct 83 ms 2972 KB Output is correct
17 Correct 81 ms 3448 KB Output is correct
18 Correct 72 ms 3004 KB Output is correct
19 Correct 69 ms 3024 KB Output is correct
20 Correct 72 ms 3148 KB Output is correct
21 Correct 77 ms 3120 KB Output is correct
22 Correct 84 ms 2972 KB Output is correct
23 Correct 70 ms 3044 KB Output is correct
24 Correct 72 ms 3128 KB Output is correct
25 Correct 70 ms 3072 KB Output is correct
26 Correct 1 ms 1620 KB Output is correct
27 Correct 1 ms 1620 KB Output is correct
28 Correct 4 ms 1748 KB Output is correct
29 Correct 26 ms 2140 KB Output is correct
30 Correct 48 ms 2556 KB Output is correct
31 Correct 72 ms 3008 KB Output is correct
32 Correct 68 ms 3016 KB Output is correct
33 Correct 69 ms 3012 KB Output is correct
34 Correct 70 ms 2932 KB Output is correct
35 Correct 76 ms 3064 KB Output is correct
36 Correct 74 ms 3004 KB Output is correct
37 Correct 71 ms 2976 KB Output is correct
38 Correct 83 ms 3068 KB Output is correct
39 Correct 74 ms 2980 KB Output is correct
40 Correct 70 ms 2936 KB Output is correct
41 Correct 1 ms 1620 KB Output is correct
42 Correct 1 ms 1620 KB Output is correct
43 Correct 1 ms 1620 KB Output is correct
44 Correct 3 ms 1748 KB Output is correct
45 Correct 3 ms 1620 KB Output is correct
46 Correct 4 ms 1748 KB Output is correct
47 Correct 14 ms 1876 KB Output is correct
48 Correct 13 ms 1876 KB Output is correct
49 Correct 25 ms 2004 KB Output is correct
50 Correct 51 ms 2472 KB Output is correct
51 Correct 71 ms 2772 KB Output is correct
52 Correct 72 ms 2872 KB Output is correct
53 Correct 75 ms 2884 KB Output is correct
54 Correct 75 ms 2872 KB Output is correct
55 Correct 78 ms 2764 KB Output is correct
56 Correct 70 ms 2884 KB Output is correct
57 Correct 68 ms 2868 KB Output is correct
58 Correct 69 ms 2772 KB Output is correct
59 Correct 70 ms 2872 KB Output is correct
60 Correct 70 ms 2880 KB Output is correct
61 Correct 68 ms 2772 KB Output is correct
62 Correct 75 ms 2872 KB Output is correct
63 Correct 68 ms 2868 KB Output is correct
64 Correct 71 ms 2864 KB Output is correct
65 Correct 70 ms 2784 KB Output is correct
66 Correct 74 ms 2772 KB Output is correct
67 Correct 72 ms 2876 KB Output is correct
68 Correct 70 ms 2868 KB Output is correct
69 Correct 76 ms 2868 KB Output is correct
70 Correct 71 ms 2884 KB Output is correct
71 Correct 14 ms 1876 KB Output is correct
72 Correct 14 ms 1876 KB Output is correct
73 Correct 13 ms 1876 KB Output is correct
74 Correct 13 ms 1876 KB Output is correct
75 Correct 13 ms 1924 KB Output is correct
76 Correct 24 ms 2136 KB Output is correct
77 Correct 23 ms 2132 KB Output is correct
78 Correct 26 ms 2104 KB Output is correct
79 Correct 24 ms 2192 KB Output is correct
80 Correct 25 ms 2132 KB Output is correct
81 Correct 49 ms 2648 KB Output is correct
82 Correct 48 ms 2704 KB Output is correct
83 Correct 48 ms 2644 KB Output is correct
84 Correct 50 ms 2688 KB Output is correct
85 Correct 53 ms 2688 KB Output is correct
86 Correct 50 ms 2888 KB Output is correct
87 Correct 49 ms 2928 KB Output is correct
88 Correct 49 ms 2944 KB Output is correct
89 Correct 48 ms 2896 KB Output is correct
90 Correct 55 ms 2956 KB Output is correct
91 Correct 85 ms 5508 KB Output is correct
92 Correct 69 ms 5460 KB Output is correct
93 Correct 75 ms 5452 KB Output is correct
94 Correct 75 ms 5476 KB Output is correct
95 Correct 73 ms 5476 KB Output is correct
96 Correct 74 ms 8224 KB Output is correct
97 Correct 78 ms 8184 KB Output is correct
98 Correct 74 ms 8176 KB Output is correct
99 Correct 85 ms 8228 KB Output is correct
100 Correct 72 ms 8236 KB Output is correct
101 Correct 84 ms 8140 KB Output is correct
102 Correct 72 ms 8184 KB Output is correct
103 Correct 76 ms 8140 KB Output is correct
104 Correct 81 ms 8160 KB Output is correct
105 Correct 73 ms 8136 KB Output is correct
106 Correct 74 ms 9512 KB Output is correct
107 Correct 73 ms 9580 KB Output is correct
108 Correct 70 ms 9536 KB Output is correct
109 Correct 71 ms 9488 KB Output is correct
110 Correct 91 ms 9600 KB Output is correct
111 Correct 73 ms 9580 KB Output is correct
112 Correct 77 ms 9572 KB Output is correct
113 Correct 77 ms 9512 KB Output is correct
114 Correct 75 ms 9528 KB Output is correct
115 Correct 87 ms 9560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1620 KB Output is correct
2 Correct 1 ms 1620 KB Output is correct
3 Correct 1 ms 1620 KB Output is correct
4 Correct 1 ms 1620 KB Output is correct
5 Correct 1 ms 1620 KB Output is correct
6 Correct 1 ms 1620 KB Output is correct
7 Correct 1 ms 1620 KB Output is correct
8 Correct 1 ms 1620 KB Output is correct
9 Correct 1 ms 1620 KB Output is correct
10 Correct 1 ms 1620 KB Output is correct
11 Correct 1 ms 1620 KB Output is correct
12 Correct 1 ms 1620 KB Output is correct
13 Correct 4 ms 1748 KB Output is correct
14 Correct 24 ms 2136 KB Output is correct
15 Correct 54 ms 2728 KB Output is correct
16 Correct 83 ms 2972 KB Output is correct
17 Correct 81 ms 3448 KB Output is correct
18 Correct 72 ms 3004 KB Output is correct
19 Correct 69 ms 3024 KB Output is correct
20 Correct 72 ms 3148 KB Output is correct
21 Correct 77 ms 3120 KB Output is correct
22 Correct 84 ms 2972 KB Output is correct
23 Correct 70 ms 3044 KB Output is correct
24 Correct 72 ms 3128 KB Output is correct
25 Correct 70 ms 3072 KB Output is correct
26 Correct 1 ms 1620 KB Output is correct
27 Correct 1 ms 1620 KB Output is correct
28 Correct 4 ms 1748 KB Output is correct
29 Correct 26 ms 2140 KB Output is correct
30 Correct 48 ms 2556 KB Output is correct
31 Correct 72 ms 3008 KB Output is correct
32 Correct 68 ms 3016 KB Output is correct
33 Correct 69 ms 3012 KB Output is correct
34 Correct 70 ms 2932 KB Output is correct
35 Correct 76 ms 3064 KB Output is correct
36 Correct 74 ms 3004 KB Output is correct
37 Correct 71 ms 2976 KB Output is correct
38 Correct 83 ms 3068 KB Output is correct
39 Correct 74 ms 2980 KB Output is correct
40 Correct 70 ms 2936 KB Output is correct
41 Correct 1 ms 1620 KB Output is correct
42 Correct 1 ms 1620 KB Output is correct
43 Correct 1 ms 1620 KB Output is correct
44 Correct 3 ms 1748 KB Output is correct
45 Correct 3 ms 1620 KB Output is correct
46 Correct 4 ms 1748 KB Output is correct
47 Correct 14 ms 1876 KB Output is correct
48 Correct 13 ms 1876 KB Output is correct
49 Correct 25 ms 2004 KB Output is correct
50 Correct 51 ms 2472 KB Output is correct
51 Correct 71 ms 2772 KB Output is correct
52 Correct 72 ms 2872 KB Output is correct
53 Correct 75 ms 2884 KB Output is correct
54 Correct 75 ms 2872 KB Output is correct
55 Correct 78 ms 2764 KB Output is correct
56 Correct 70 ms 2884 KB Output is correct
57 Correct 68 ms 2868 KB Output is correct
58 Correct 69 ms 2772 KB Output is correct
59 Correct 70 ms 2872 KB Output is correct
60 Correct 70 ms 2880 KB Output is correct
61 Correct 68 ms 2772 KB Output is correct
62 Correct 75 ms 2872 KB Output is correct
63 Correct 68 ms 2868 KB Output is correct
64 Correct 71 ms 2864 KB Output is correct
65 Correct 70 ms 2784 KB Output is correct
66 Correct 74 ms 2772 KB Output is correct
67 Correct 72 ms 2876 KB Output is correct
68 Correct 70 ms 2868 KB Output is correct
69 Correct 76 ms 2868 KB Output is correct
70 Correct 71 ms 2884 KB Output is correct
71 Correct 14 ms 1876 KB Output is correct
72 Correct 14 ms 1876 KB Output is correct
73 Correct 13 ms 1876 KB Output is correct
74 Correct 13 ms 1876 KB Output is correct
75 Correct 13 ms 1924 KB Output is correct
76 Correct 24 ms 2136 KB Output is correct
77 Correct 23 ms 2132 KB Output is correct
78 Correct 26 ms 2104 KB Output is correct
79 Correct 24 ms 2192 KB Output is correct
80 Correct 25 ms 2132 KB Output is correct
81 Correct 49 ms 2648 KB Output is correct
82 Correct 48 ms 2704 KB Output is correct
83 Correct 48 ms 2644 KB Output is correct
84 Correct 50 ms 2688 KB Output is correct
85 Correct 53 ms 2688 KB Output is correct
86 Correct 50 ms 2888 KB Output is correct
87 Correct 49 ms 2928 KB Output is correct
88 Correct 49 ms 2944 KB Output is correct
89 Correct 48 ms 2896 KB Output is correct
90 Correct 55 ms 2956 KB Output is correct
91 Correct 85 ms 5508 KB Output is correct
92 Correct 69 ms 5460 KB Output is correct
93 Correct 75 ms 5452 KB Output is correct
94 Correct 75 ms 5476 KB Output is correct
95 Correct 73 ms 5476 KB Output is correct
96 Correct 74 ms 8224 KB Output is correct
97 Correct 78 ms 8184 KB Output is correct
98 Correct 74 ms 8176 KB Output is correct
99 Correct 85 ms 8228 KB Output is correct
100 Correct 72 ms 8236 KB Output is correct
101 Correct 84 ms 8140 KB Output is correct
102 Correct 72 ms 8184 KB Output is correct
103 Correct 76 ms 8140 KB Output is correct
104 Correct 81 ms 8160 KB Output is correct
105 Correct 73 ms 8136 KB Output is correct
106 Correct 74 ms 9512 KB Output is correct
107 Correct 73 ms 9580 KB Output is correct
108 Correct 70 ms 9536 KB Output is correct
109 Correct 71 ms 9488 KB Output is correct
110 Correct 91 ms 9600 KB Output is correct
111 Correct 73 ms 9580 KB Output is correct
112 Correct 77 ms 9572 KB Output is correct
113 Correct 77 ms 9512 KB Output is correct
114 Correct 75 ms 9528 KB Output is correct
115 Correct 87 ms 9560 KB Output is correct
116 Correct 3674 ms 3208 KB Output is correct
117 Correct 3660 ms 3084 KB Output is correct
118 Correct 4094 ms 3372 KB Output is correct
119 Correct 4127 ms 3364 KB Output is correct
120 Correct 4142 ms 3372 KB Output is correct
121 Correct 5144 ms 3580 KB Output is correct
122 Correct 5074 ms 3676 KB Output is correct
123 Execution timed out 7083 ms 3404 KB Time limit exceeded
124 Halted 0 ms 0 KB -