답안 #789621

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
789621 2023-07-21T15:03:27 Z math_rabbit_1028 Diversity (CEOI21_diversity) C++14
64 / 100
7000 ms 26956 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n, q, b;
int arr[303030];
ll cnt[303030], cnt2[303030], reord[303030], ans = 0, res[50505];
 
const int m = 300000;
 
struct query{
    int idx, lt, rt;
} Q[50505];
 
bool compare(query p, query q) {
    if (p.lt/b == q.lt/b) return p.rt < q.rt;
    return (p.lt/b) < (q.lt/b);
}
 
struct seg {
    ll sum[4 * m], xsum[4 * m];
    void init(int v, int st, int ed) {
        if (st == ed) {
            sum[v] = reord[st];
            xsum[v] = (ll)st * reord[st];
            return;
        }
        int mid = (st + ed) / 2;
        init(2 * v, st, mid);
        init(2 * v + 1, mid + 1, ed);
        sum[v] = sum[2 * v] + sum[2 * v + 1];
        xsum[v] = xsum[2 * v] + xsum[2 * v + 1];
    }
    void update(int v, int st, int ed, int idx, ll diff) {
        if (st == idx && ed == idx) {
            sum[v] += diff;
            xsum[v] += (ll)st * diff;
            return;
        }
        if (idx < st || idx > ed) return;
        int mid = (st + ed) / 2;
        update(2 * v, st, mid, idx, diff);
        update(2 * v + 1, mid + 1, ed, idx, diff);
        sum[v] = sum[2 * v] + sum[2 * v + 1];
        xsum[v] = xsum[2 * v] + xsum[2 * v + 1];
    }
    ll getsum(int v, int st, int ed, int lt, int rt) {
        if (ed < lt || st > rt) return 0;
        if (lt <= st && ed <= rt) return sum[v];
        int mid = (st + ed) / 2;
        return getsum(2 * v, st, mid, lt, rt) + getsum(2 * v + 1, mid + 1, ed, lt, rt);
    }
    ll getxsum(int v, int st, int ed, int lt, int rt) {
        if (ed < lt || st > rt) return 0;
        if (lt <= st && ed <= rt) return xsum[v];
        int mid = (st + ed) / 2;
        return getxsum(2 * v, st, mid, lt, rt) + getxsum(2 * v + 1, mid + 1, ed, lt, rt);
    }
} s;
 
void init(int p) {
    for (int i = 1; i <= m; i++) cnt[i] = 0;
    ans = 0;
 
    for (int i = Q[p].lt; i <= Q[p].rt; i++) cnt[arr[i]]++;
    for (int i = 1; i <= m; i++) cnt2[i] = cnt[i];
 
    sort(cnt2 + 1, cnt2 + m + 1);
 
    for (int i = 1; i <= m/2; i++) {
        reord[i] = cnt2[2 * i - 1];
    }
    for (int i = 1; i <= m/2; i++) {
        reord[m - i + 1] = cnt2[2 * i];
    }
 
    s.init(1, 1, m);
 
    for (ll i = 1; i <= m; i++) ans += reord[i] * (reord[i] + 1) / 2;
 
    for (ll i = 1; i <= m; i++) {
        ans += reord[i] * ((i + 1) * s.getsum(1, 1, m, 1, i - 1) - s.getxsum(1, 1, m, 1, i - 1));
    }
}
 
void add(int j) {
    int idx, i;
    idx = upper_bound(cnt2 + 1, cnt2 + m + 1, cnt[arr[j]]) - cnt2 - 1;
    assert(cnt2[idx] == cnt[arr[j]]);
    cnt[arr[j]]++;
    cnt2[idx]++;
    if (idx % 2 == 0) i = m - idx/2 + 1;
    else i = (idx + 1) / 2;
    reord[i]++;
    ans += reord[i];
    ans += (i + 1) * s.getsum(1, 1, m, 1, i - 1) - s.getxsum(1, 1, m, 1, i - 1);
    ans += s.getxsum(1, 1, m, i + 1, m) - (i - 1) * s.getsum(1, 1, m, i + 1, m);
    s.update(1, 1, m, i, 1);
}
 
void rem(int j) {
    int idx, i;
    idx = lower_bound(cnt2 + 1, cnt2 + m + 1, cnt[arr[j]]) - cnt2;
    assert(cnt2[idx] == cnt[arr[j]]);
    cnt[arr[j]]--;
    cnt2[idx]--;
    if (idx % 2 == 0) i = m - idx/2 + 1;
    else i = (idx + 1) / 2;
    reord[i]--;
    ans -= reord[i] + 1;
    ans -= (i + 1) * s.getsum(1, 1, m, 1, i - 1) - s.getxsum(1, 1, m, 1, i - 1);
    ans -= s.getxsum(1, 1, m, i + 1, m) - (i - 1) * s.getsum(1, 1, m, i + 1, m);
    s.update(1, 1, m, i, -1);
}
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
 
    cin >> n >> q; b = max(n/100, (int)sqrt(n));
    for (int i = 1; i <= n; i++) cin >> arr[i];
 
    for (int i = 1; i <= q; i++) cin >> Q[i].lt >> Q[i].rt;
    for (int i = 1; i <= q; i++) Q[i].idx = i;
 
    sort(Q + 1, Q + q + 1, compare);
 
    int p = 1;
    for (int i = 0; i <= n/b; i++) {
        if (Q[p].lt/b != i) continue;
 
        init(p);
        res[Q[p].idx] = ans;
 
        p++;
        while (p <= q && Q[p].lt/b == i) {
            for (int j = Q[p - 1].rt + 1; j <= Q[p].rt; j++) add(j);
            if (Q[p - 1].lt > Q[p].lt) for (int j = Q[p].lt; j < Q[p - 1].lt; j++) add(j);
            else for (int j = Q[p - 1].lt; j < Q[p].lt; j++) rem(j);
            res[Q[p].idx] = ans;
            p++;
        }
    }
 
    for (int i = 1; i <= q; i++) cout << res[i] << "\n";
 
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 75 ms 23812 KB Output is correct
2 Correct 63 ms 23808 KB Output is correct
3 Correct 63 ms 23804 KB Output is correct
4 Correct 66 ms 23704 KB Output is correct
5 Correct 66 ms 23804 KB Output is correct
6 Correct 66 ms 23828 KB Output is correct
7 Correct 64 ms 23764 KB Output is correct
8 Correct 64 ms 23768 KB Output is correct
9 Correct 66 ms 23800 KB Output is correct
10 Correct 64 ms 23752 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 64 ms 23800 KB Output is correct
2 Correct 64 ms 23808 KB Output is correct
3 Correct 64 ms 23764 KB Output is correct
4 Correct 68 ms 24404 KB Output is correct
5 Correct 73 ms 24908 KB Output is correct
6 Correct 78 ms 25648 KB Output is correct
7 Correct 78 ms 25588 KB Output is correct
8 Correct 76 ms 25508 KB Output is correct
9 Correct 87 ms 25608 KB Output is correct
10 Correct 77 ms 25624 KB Output is correct
11 Correct 89 ms 25616 KB Output is correct
12 Correct 77 ms 25556 KB Output is correct
13 Correct 76 ms 25588 KB Output is correct
14 Correct 77 ms 25612 KB Output is correct
15 Correct 76 ms 25592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 64 ms 23800 KB Output is correct
2 Correct 64 ms 23808 KB Output is correct
3 Correct 64 ms 23764 KB Output is correct
4 Correct 68 ms 24404 KB Output is correct
5 Correct 73 ms 24908 KB Output is correct
6 Correct 78 ms 25648 KB Output is correct
7 Correct 78 ms 25588 KB Output is correct
8 Correct 76 ms 25508 KB Output is correct
9 Correct 87 ms 25608 KB Output is correct
10 Correct 77 ms 25624 KB Output is correct
11 Correct 89 ms 25616 KB Output is correct
12 Correct 77 ms 25556 KB Output is correct
13 Correct 76 ms 25588 KB Output is correct
14 Correct 77 ms 25612 KB Output is correct
15 Correct 76 ms 25592 KB Output is correct
16 Correct 64 ms 23712 KB Output is correct
17 Correct 64 ms 23808 KB Output is correct
18 Correct 68 ms 23868 KB Output is correct
19 Correct 71 ms 24468 KB Output is correct
20 Correct 73 ms 25108 KB Output is correct
21 Correct 77 ms 25796 KB Output is correct
22 Correct 93 ms 25756 KB Output is correct
23 Correct 77 ms 25776 KB Output is correct
24 Correct 77 ms 25760 KB Output is correct
25 Correct 76 ms 25684 KB Output is correct
26 Correct 78 ms 25684 KB Output is correct
27 Correct 77 ms 25644 KB Output is correct
28 Correct 77 ms 25700 KB Output is correct
29 Correct 78 ms 25720 KB Output is correct
30 Correct 78 ms 25664 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 64 ms 23800 KB Output is correct
2 Correct 64 ms 23808 KB Output is correct
3 Correct 64 ms 23764 KB Output is correct
4 Correct 68 ms 24404 KB Output is correct
5 Correct 73 ms 24908 KB Output is correct
6 Correct 78 ms 25648 KB Output is correct
7 Correct 78 ms 25588 KB Output is correct
8 Correct 76 ms 25508 KB Output is correct
9 Correct 87 ms 25608 KB Output is correct
10 Correct 77 ms 25624 KB Output is correct
11 Correct 89 ms 25616 KB Output is correct
12 Correct 77 ms 25556 KB Output is correct
13 Correct 76 ms 25588 KB Output is correct
14 Correct 77 ms 25612 KB Output is correct
15 Correct 76 ms 25592 KB Output is correct
16 Correct 64 ms 23712 KB Output is correct
17 Correct 64 ms 23808 KB Output is correct
18 Correct 68 ms 23868 KB Output is correct
19 Correct 71 ms 24468 KB Output is correct
20 Correct 73 ms 25108 KB Output is correct
21 Correct 77 ms 25796 KB Output is correct
22 Correct 93 ms 25756 KB Output is correct
23 Correct 77 ms 25776 KB Output is correct
24 Correct 77 ms 25760 KB Output is correct
25 Correct 76 ms 25684 KB Output is correct
26 Correct 78 ms 25684 KB Output is correct
27 Correct 77 ms 25644 KB Output is correct
28 Correct 77 ms 25700 KB Output is correct
29 Correct 78 ms 25720 KB Output is correct
30 Correct 78 ms 25664 KB Output is correct
31 Correct 68 ms 23816 KB Output is correct
32 Correct 64 ms 23824 KB Output is correct
33 Correct 64 ms 23808 KB Output is correct
34 Correct 65 ms 23876 KB Output is correct
35 Correct 67 ms 23872 KB Output is correct
36 Correct 65 ms 23884 KB Output is correct
37 Correct 68 ms 24268 KB Output is correct
38 Correct 67 ms 24132 KB Output is correct
39 Correct 70 ms 24524 KB Output is correct
40 Correct 75 ms 25344 KB Output is correct
41 Correct 78 ms 26116 KB Output is correct
42 Correct 79 ms 26128 KB Output is correct
43 Correct 78 ms 26056 KB Output is correct
44 Correct 81 ms 26120 KB Output is correct
45 Correct 79 ms 26012 KB Output is correct
46 Correct 79 ms 26132 KB Output is correct
47 Correct 79 ms 26120 KB Output is correct
48 Correct 84 ms 26112 KB Output is correct
49 Correct 79 ms 26116 KB Output is correct
50 Correct 79 ms 26124 KB Output is correct
51 Correct 92 ms 26064 KB Output is correct
52 Correct 91 ms 26112 KB Output is correct
53 Correct 80 ms 26120 KB Output is correct
54 Correct 81 ms 26124 KB Output is correct
55 Correct 83 ms 26120 KB Output is correct
56 Correct 80 ms 26060 KB Output is correct
57 Correct 79 ms 26060 KB Output is correct
58 Correct 84 ms 26024 KB Output is correct
59 Correct 78 ms 26128 KB Output is correct
60 Correct 79 ms 26036 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 75 ms 23812 KB Output is correct
2 Correct 63 ms 23808 KB Output is correct
3 Correct 63 ms 23804 KB Output is correct
4 Correct 66 ms 23704 KB Output is correct
5 Correct 66 ms 23804 KB Output is correct
6 Correct 66 ms 23828 KB Output is correct
7 Correct 64 ms 23764 KB Output is correct
8 Correct 64 ms 23768 KB Output is correct
9 Correct 66 ms 23800 KB Output is correct
10 Correct 64 ms 23752 KB Output is correct
11 Correct 64 ms 23800 KB Output is correct
12 Correct 64 ms 23808 KB Output is correct
13 Correct 64 ms 23764 KB Output is correct
14 Correct 68 ms 24404 KB Output is correct
15 Correct 73 ms 24908 KB Output is correct
16 Correct 78 ms 25648 KB Output is correct
17 Correct 78 ms 25588 KB Output is correct
18 Correct 76 ms 25508 KB Output is correct
19 Correct 87 ms 25608 KB Output is correct
20 Correct 77 ms 25624 KB Output is correct
21 Correct 89 ms 25616 KB Output is correct
22 Correct 77 ms 25556 KB Output is correct
23 Correct 76 ms 25588 KB Output is correct
24 Correct 77 ms 25612 KB Output is correct
25 Correct 76 ms 25592 KB Output is correct
26 Correct 64 ms 23712 KB Output is correct
27 Correct 64 ms 23808 KB Output is correct
28 Correct 68 ms 23868 KB Output is correct
29 Correct 71 ms 24468 KB Output is correct
30 Correct 73 ms 25108 KB Output is correct
31 Correct 77 ms 25796 KB Output is correct
32 Correct 93 ms 25756 KB Output is correct
33 Correct 77 ms 25776 KB Output is correct
34 Correct 77 ms 25760 KB Output is correct
35 Correct 76 ms 25684 KB Output is correct
36 Correct 78 ms 25684 KB Output is correct
37 Correct 77 ms 25644 KB Output is correct
38 Correct 77 ms 25700 KB Output is correct
39 Correct 78 ms 25720 KB Output is correct
40 Correct 78 ms 25664 KB Output is correct
41 Correct 68 ms 23816 KB Output is correct
42 Correct 64 ms 23824 KB Output is correct
43 Correct 64 ms 23808 KB Output is correct
44 Correct 65 ms 23876 KB Output is correct
45 Correct 67 ms 23872 KB Output is correct
46 Correct 65 ms 23884 KB Output is correct
47 Correct 68 ms 24268 KB Output is correct
48 Correct 67 ms 24132 KB Output is correct
49 Correct 70 ms 24524 KB Output is correct
50 Correct 75 ms 25344 KB Output is correct
51 Correct 78 ms 26116 KB Output is correct
52 Correct 79 ms 26128 KB Output is correct
53 Correct 78 ms 26056 KB Output is correct
54 Correct 81 ms 26120 KB Output is correct
55 Correct 79 ms 26012 KB Output is correct
56 Correct 79 ms 26132 KB Output is correct
57 Correct 79 ms 26120 KB Output is correct
58 Correct 84 ms 26112 KB Output is correct
59 Correct 79 ms 26116 KB Output is correct
60 Correct 79 ms 26124 KB Output is correct
61 Correct 92 ms 26064 KB Output is correct
62 Correct 91 ms 26112 KB Output is correct
63 Correct 80 ms 26120 KB Output is correct
64 Correct 81 ms 26124 KB Output is correct
65 Correct 83 ms 26120 KB Output is correct
66 Correct 80 ms 26060 KB Output is correct
67 Correct 79 ms 26060 KB Output is correct
68 Correct 84 ms 26024 KB Output is correct
69 Correct 78 ms 26128 KB Output is correct
70 Correct 79 ms 26036 KB Output is correct
71 Correct 68 ms 24148 KB Output is correct
72 Correct 67 ms 24148 KB Output is correct
73 Correct 74 ms 24196 KB Output is correct
74 Correct 68 ms 24216 KB Output is correct
75 Correct 68 ms 24216 KB Output is correct
76 Correct 69 ms 24660 KB Output is correct
77 Correct 70 ms 24652 KB Output is correct
78 Correct 70 ms 24652 KB Output is correct
79 Correct 70 ms 24660 KB Output is correct
80 Correct 69 ms 24600 KB Output is correct
81 Correct 77 ms 25540 KB Output is correct
82 Correct 75 ms 25556 KB Output is correct
83 Correct 75 ms 25556 KB Output is correct
84 Correct 75 ms 25544 KB Output is correct
85 Correct 76 ms 25544 KB Output is correct
86 Correct 76 ms 25608 KB Output is correct
87 Correct 86 ms 25644 KB Output is correct
88 Correct 76 ms 25576 KB Output is correct
89 Correct 79 ms 25648 KB Output is correct
90 Correct 76 ms 25548 KB Output is correct
91 Correct 83 ms 26604 KB Output is correct
92 Correct 84 ms 26584 KB Output is correct
93 Correct 85 ms 26636 KB Output is correct
94 Correct 86 ms 26628 KB Output is correct
95 Correct 83 ms 26708 KB Output is correct
96 Correct 87 ms 26860 KB Output is correct
97 Correct 84 ms 26864 KB Output is correct
98 Correct 84 ms 26828 KB Output is correct
99 Correct 88 ms 26956 KB Output is correct
100 Correct 85 ms 26876 KB Output is correct
101 Correct 85 ms 26868 KB Output is correct
102 Correct 90 ms 26808 KB Output is correct
103 Correct 85 ms 26792 KB Output is correct
104 Correct 87 ms 26856 KB Output is correct
105 Correct 85 ms 26796 KB Output is correct
106 Correct 87 ms 26840 KB Output is correct
107 Correct 85 ms 26900 KB Output is correct
108 Correct 87 ms 26900 KB Output is correct
109 Correct 85 ms 26900 KB Output is correct
110 Correct 102 ms 26896 KB Output is correct
111 Correct 86 ms 26900 KB Output is correct
112 Correct 85 ms 26892 KB Output is correct
113 Correct 84 ms 26792 KB Output is correct
114 Correct 93 ms 26904 KB Output is correct
115 Correct 84 ms 26900 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 75 ms 23812 KB Output is correct
2 Correct 63 ms 23808 KB Output is correct
3 Correct 63 ms 23804 KB Output is correct
4 Correct 66 ms 23704 KB Output is correct
5 Correct 66 ms 23804 KB Output is correct
6 Correct 66 ms 23828 KB Output is correct
7 Correct 64 ms 23764 KB Output is correct
8 Correct 64 ms 23768 KB Output is correct
9 Correct 66 ms 23800 KB Output is correct
10 Correct 64 ms 23752 KB Output is correct
11 Correct 64 ms 23800 KB Output is correct
12 Correct 64 ms 23808 KB Output is correct
13 Correct 64 ms 23764 KB Output is correct
14 Correct 68 ms 24404 KB Output is correct
15 Correct 73 ms 24908 KB Output is correct
16 Correct 78 ms 25648 KB Output is correct
17 Correct 78 ms 25588 KB Output is correct
18 Correct 76 ms 25508 KB Output is correct
19 Correct 87 ms 25608 KB Output is correct
20 Correct 77 ms 25624 KB Output is correct
21 Correct 89 ms 25616 KB Output is correct
22 Correct 77 ms 25556 KB Output is correct
23 Correct 76 ms 25588 KB Output is correct
24 Correct 77 ms 25612 KB Output is correct
25 Correct 76 ms 25592 KB Output is correct
26 Correct 64 ms 23712 KB Output is correct
27 Correct 64 ms 23808 KB Output is correct
28 Correct 68 ms 23868 KB Output is correct
29 Correct 71 ms 24468 KB Output is correct
30 Correct 73 ms 25108 KB Output is correct
31 Correct 77 ms 25796 KB Output is correct
32 Correct 93 ms 25756 KB Output is correct
33 Correct 77 ms 25776 KB Output is correct
34 Correct 77 ms 25760 KB Output is correct
35 Correct 76 ms 25684 KB Output is correct
36 Correct 78 ms 25684 KB Output is correct
37 Correct 77 ms 25644 KB Output is correct
38 Correct 77 ms 25700 KB Output is correct
39 Correct 78 ms 25720 KB Output is correct
40 Correct 78 ms 25664 KB Output is correct
41 Correct 68 ms 23816 KB Output is correct
42 Correct 64 ms 23824 KB Output is correct
43 Correct 64 ms 23808 KB Output is correct
44 Correct 65 ms 23876 KB Output is correct
45 Correct 67 ms 23872 KB Output is correct
46 Correct 65 ms 23884 KB Output is correct
47 Correct 68 ms 24268 KB Output is correct
48 Correct 67 ms 24132 KB Output is correct
49 Correct 70 ms 24524 KB Output is correct
50 Correct 75 ms 25344 KB Output is correct
51 Correct 78 ms 26116 KB Output is correct
52 Correct 79 ms 26128 KB Output is correct
53 Correct 78 ms 26056 KB Output is correct
54 Correct 81 ms 26120 KB Output is correct
55 Correct 79 ms 26012 KB Output is correct
56 Correct 79 ms 26132 KB Output is correct
57 Correct 79 ms 26120 KB Output is correct
58 Correct 84 ms 26112 KB Output is correct
59 Correct 79 ms 26116 KB Output is correct
60 Correct 79 ms 26124 KB Output is correct
61 Correct 92 ms 26064 KB Output is correct
62 Correct 91 ms 26112 KB Output is correct
63 Correct 80 ms 26120 KB Output is correct
64 Correct 81 ms 26124 KB Output is correct
65 Correct 83 ms 26120 KB Output is correct
66 Correct 80 ms 26060 KB Output is correct
67 Correct 79 ms 26060 KB Output is correct
68 Correct 84 ms 26024 KB Output is correct
69 Correct 78 ms 26128 KB Output is correct
70 Correct 79 ms 26036 KB Output is correct
71 Correct 68 ms 24148 KB Output is correct
72 Correct 67 ms 24148 KB Output is correct
73 Correct 74 ms 24196 KB Output is correct
74 Correct 68 ms 24216 KB Output is correct
75 Correct 68 ms 24216 KB Output is correct
76 Correct 69 ms 24660 KB Output is correct
77 Correct 70 ms 24652 KB Output is correct
78 Correct 70 ms 24652 KB Output is correct
79 Correct 70 ms 24660 KB Output is correct
80 Correct 69 ms 24600 KB Output is correct
81 Correct 77 ms 25540 KB Output is correct
82 Correct 75 ms 25556 KB Output is correct
83 Correct 75 ms 25556 KB Output is correct
84 Correct 75 ms 25544 KB Output is correct
85 Correct 76 ms 25544 KB Output is correct
86 Correct 76 ms 25608 KB Output is correct
87 Correct 86 ms 25644 KB Output is correct
88 Correct 76 ms 25576 KB Output is correct
89 Correct 79 ms 25648 KB Output is correct
90 Correct 76 ms 25548 KB Output is correct
91 Correct 83 ms 26604 KB Output is correct
92 Correct 84 ms 26584 KB Output is correct
93 Correct 85 ms 26636 KB Output is correct
94 Correct 86 ms 26628 KB Output is correct
95 Correct 83 ms 26708 KB Output is correct
96 Correct 87 ms 26860 KB Output is correct
97 Correct 84 ms 26864 KB Output is correct
98 Correct 84 ms 26828 KB Output is correct
99 Correct 88 ms 26956 KB Output is correct
100 Correct 85 ms 26876 KB Output is correct
101 Correct 85 ms 26868 KB Output is correct
102 Correct 90 ms 26808 KB Output is correct
103 Correct 85 ms 26792 KB Output is correct
104 Correct 87 ms 26856 KB Output is correct
105 Correct 85 ms 26796 KB Output is correct
106 Correct 87 ms 26840 KB Output is correct
107 Correct 85 ms 26900 KB Output is correct
108 Correct 87 ms 26900 KB Output is correct
109 Correct 85 ms 26900 KB Output is correct
110 Correct 102 ms 26896 KB Output is correct
111 Correct 86 ms 26900 KB Output is correct
112 Correct 85 ms 26892 KB Output is correct
113 Correct 84 ms 26792 KB Output is correct
114 Correct 93 ms 26904 KB Output is correct
115 Correct 84 ms 26900 KB Output is correct
116 Correct 6773 ms 25720 KB Output is correct
117 Correct 6971 ms 25716 KB Output is correct
118 Execution timed out 7068 ms 25680 KB Time limit exceeded
119 Halted 0 ms 0 KB -