Submission #968063

# Submission time Handle Problem Language Result Execution time Memory
968063 2024-04-23T07:30:43 Z becaido Real Mountains (CCO23_day1problem2) C++17
25 / 25
1995 ms 76248 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,popcnt,sse4,abm")
#include <bits/stdc++.h>
using namespace std;

#ifdef WAIMAI
#define debug(HEHE...) cout << "[" << #HEHE << "] : ", dout(HEHE)
void dout() {cout << '\n';}
template<typename T, typename...U>
void dout(T t, U...u) {cout << t << (sizeof...(u) ? ", " : ""), dout(u...);}
#else
#define debug(...) 7122
#endif

#define ll long long
#define Waimai ios::sync_with_stdio(false), cin.tie(0)
#define FOR(x,a,b) for (int x = a, I = b; x <= I; x++)
#define pb emplace_back
#define F first
#define S second

#define lpos pos*2
#define rpos pos*2+1

const int INF = 2e9;
const int MOD = 1e6 + 3;
const int SIZE = 1e6 + 5;

int n, mx;
ll ans;
int a[SIZE];
pair<int, int> val[SIZE];

ll sum(int l, int r) {
    return 1ll * (r - l + 1) * (l + r) / 2 % MOD;
}

int mn[SIZE << 2];
void build(int pos, int l, int r) {
    if (l == r) {
        mn[pos] = a[l];
        return;
    }
    int mid = (l + r) / 2;
    build(lpos, l, mid);
    build(rpos, mid + 1, r);
    mn[pos] = min(mn[lpos], mn[rpos]);
}
void upd(int pos, int l, int r, int p) {
    if (l == r) {
        mn[pos] = INF;
        return;
    }
    int mid = (l + r) / 2;
    if (p <= mid) upd(lpos, l, mid, p);
    else upd(rpos, mid + 1, r, p);
    mn[pos] = min(mn[lpos], mn[rpos]);
}
int que(int pos, int l, int r, int L, int R) {
    if (l == L && r == R) return mn[pos];
    int mid = (L + R) / 2;
    if (r <= mid) return que(lpos, l, r, L, mid);
    if (l > mid) return que(rpos, l, r, mid + 1, R);
    return min(que(lpos, l, mid, L, mid), que(rpos, mid + 1, r, mid + 1, R));
}

set<int> s;

void solve() {
    cin >> n;
    FOR (i, 1, n) cin >> a[i], val[i] = {a[i], i};
    sort(val + 1, val + n + 1);
    build(1, 1, n);

    FOR (vi, 1, n - 1) {
        s.insert(val[vi].S);
        upd(1, 1, n, val[vi].S);
        if (val[vi].F == val[vi + 1].F) continue;

        int x = val[vi].F, y = val[vi + 1].F - 1, len = y - x + 1;
        int lmn = 0, rmn = 0, lv = 0, rv = 0;

        while (s.size()) {
            int i = *s.begin(), mn = INF;
            if (i > 1) mn = que(1, 1, i - 1, 1, n);
            if (mn == INF) {
                s.erase(s.begin());
                continue;
            }
            lmn = mn;
            break;
        }
        while (s.size()) {
            int i = *prev(s.end()), mn = INF;
            if (i < n) mn = que(1, i + 1, n, 1, n);
            if (mn == INF) {
                s.erase(prev(s.end()));
                continue;
            }
            rmn = mn;
            break;
        }
        if (s.size() == 0) continue;

        lv = que(1, *s.begin() + 1, n, 1, n);
        rv = que(1, 1, *prev(s.end()) - 1, 1, n);

        if (s.size() == 1) ans += 1ll * len * (lmn + rmn) + sum(x, y);
        else ans += 1ll * len * ((ll) lmn + min(lv, rv) + rmn + 1) % MOD + 3 * sum(x, y) + 1ll * (s.size() - 2) * (3 * sum(x, y) + 2 * len) % MOD;
        ans %= MOD;
    }
    cout << ans << '\n';
}

int main() {
    Waimai;
    solve();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 2 ms 4700 KB Output is correct
5 Correct 2 ms 4700 KB Output is correct
6 Correct 2 ms 4700 KB Output is correct
7 Correct 2 ms 4700 KB Output is correct
8 Correct 2 ms 4832 KB Output is correct
9 Correct 2 ms 4648 KB Output is correct
10 Correct 2 ms 4444 KB Output is correct
11 Correct 3 ms 4700 KB Output is correct
12 Correct 2 ms 4700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 2 ms 4700 KB Output is correct
5 Correct 2 ms 4700 KB Output is correct
6 Correct 2 ms 4700 KB Output is correct
7 Correct 2 ms 4700 KB Output is correct
8 Correct 2 ms 4832 KB Output is correct
9 Correct 2 ms 4648 KB Output is correct
10 Correct 2 ms 4444 KB Output is correct
11 Correct 3 ms 4700 KB Output is correct
12 Correct 2 ms 4700 KB Output is correct
13 Correct 3 ms 4696 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 3 ms 4696 KB Output is correct
17 Correct 3 ms 4700 KB Output is correct
18 Correct 3 ms 4700 KB Output is correct
19 Correct 4 ms 4700 KB Output is correct
20 Correct 3 ms 4700 KB Output is correct
21 Correct 3 ms 4696 KB Output is correct
22 Correct 3 ms 4700 KB Output is correct
23 Correct 3 ms 4852 KB Output is correct
24 Correct 3 ms 4700 KB Output is correct
25 Correct 2 ms 4700 KB Output is correct
26 Correct 3 ms 4700 KB Output is correct
27 Correct 2 ms 4700 KB Output is correct
28 Correct 2 ms 4700 KB Output is correct
29 Correct 1 ms 4444 KB Output is correct
30 Correct 1 ms 4444 KB Output is correct
31 Correct 1 ms 4556 KB Output is correct
32 Correct 1 ms 4444 KB Output is correct
33 Correct 1 ms 4444 KB Output is correct
34 Correct 1 ms 4440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 2 ms 4700 KB Output is correct
5 Correct 2 ms 4700 KB Output is correct
6 Correct 2 ms 4700 KB Output is correct
7 Correct 2 ms 4700 KB Output is correct
8 Correct 2 ms 4832 KB Output is correct
9 Correct 2 ms 4648 KB Output is correct
10 Correct 2 ms 4444 KB Output is correct
11 Correct 3 ms 4700 KB Output is correct
12 Correct 2 ms 4700 KB Output is correct
13 Correct 3 ms 4696 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 3 ms 4696 KB Output is correct
17 Correct 3 ms 4700 KB Output is correct
18 Correct 3 ms 4700 KB Output is correct
19 Correct 4 ms 4700 KB Output is correct
20 Correct 3 ms 4700 KB Output is correct
21 Correct 3 ms 4696 KB Output is correct
22 Correct 3 ms 4700 KB Output is correct
23 Correct 3 ms 4852 KB Output is correct
24 Correct 3 ms 4700 KB Output is correct
25 Correct 2 ms 4700 KB Output is correct
26 Correct 3 ms 4700 KB Output is correct
27 Correct 2 ms 4700 KB Output is correct
28 Correct 2 ms 4700 KB Output is correct
29 Correct 1 ms 4444 KB Output is correct
30 Correct 1 ms 4444 KB Output is correct
31 Correct 1 ms 4556 KB Output is correct
32 Correct 1 ms 4444 KB Output is correct
33 Correct 1 ms 4444 KB Output is correct
34 Correct 1 ms 4440 KB Output is correct
35 Correct 4 ms 4696 KB Output is correct
36 Correct 5 ms 4668 KB Output is correct
37 Correct 4 ms 4824 KB Output is correct
38 Correct 5 ms 4696 KB Output is correct
39 Correct 4 ms 4700 KB Output is correct
40 Correct 3 ms 4700 KB Output is correct
41 Correct 3 ms 4696 KB Output is correct
42 Correct 3 ms 4696 KB Output is correct
43 Correct 4 ms 4700 KB Output is correct
44 Correct 5 ms 4700 KB Output is correct
45 Correct 6 ms 4696 KB Output is correct
46 Correct 3 ms 4700 KB Output is correct
47 Correct 3 ms 4700 KB Output is correct
48 Correct 3 ms 4700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 2 ms 4700 KB Output is correct
5 Correct 2 ms 4700 KB Output is correct
6 Correct 2 ms 4700 KB Output is correct
7 Correct 2 ms 4700 KB Output is correct
8 Correct 2 ms 4832 KB Output is correct
9 Correct 2 ms 4648 KB Output is correct
10 Correct 2 ms 4444 KB Output is correct
11 Correct 3 ms 4700 KB Output is correct
12 Correct 2 ms 4700 KB Output is correct
13 Correct 3 ms 4696 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 3 ms 4696 KB Output is correct
17 Correct 3 ms 4700 KB Output is correct
18 Correct 3 ms 4700 KB Output is correct
19 Correct 4 ms 4700 KB Output is correct
20 Correct 3 ms 4700 KB Output is correct
21 Correct 3 ms 4696 KB Output is correct
22 Correct 3 ms 4700 KB Output is correct
23 Correct 3 ms 4852 KB Output is correct
24 Correct 3 ms 4700 KB Output is correct
25 Correct 2 ms 4700 KB Output is correct
26 Correct 3 ms 4700 KB Output is correct
27 Correct 2 ms 4700 KB Output is correct
28 Correct 2 ms 4700 KB Output is correct
29 Correct 1 ms 4444 KB Output is correct
30 Correct 1 ms 4444 KB Output is correct
31 Correct 1 ms 4556 KB Output is correct
32 Correct 1 ms 4444 KB Output is correct
33 Correct 1 ms 4444 KB Output is correct
34 Correct 1 ms 4440 KB Output is correct
35 Correct 4 ms 4696 KB Output is correct
36 Correct 5 ms 4668 KB Output is correct
37 Correct 4 ms 4824 KB Output is correct
38 Correct 5 ms 4696 KB Output is correct
39 Correct 4 ms 4700 KB Output is correct
40 Correct 3 ms 4700 KB Output is correct
41 Correct 3 ms 4696 KB Output is correct
42 Correct 3 ms 4696 KB Output is correct
43 Correct 4 ms 4700 KB Output is correct
44 Correct 5 ms 4700 KB Output is correct
45 Correct 6 ms 4696 KB Output is correct
46 Correct 3 ms 4700 KB Output is correct
47 Correct 3 ms 4700 KB Output is correct
48 Correct 3 ms 4700 KB Output is correct
49 Correct 4 ms 4700 KB Output is correct
50 Correct 6 ms 4700 KB Output is correct
51 Correct 4 ms 4700 KB Output is correct
52 Correct 4 ms 4700 KB Output is correct
53 Correct 4 ms 4700 KB Output is correct
54 Correct 3 ms 4700 KB Output is correct
55 Correct 3 ms 4700 KB Output is correct
56 Correct 4 ms 4700 KB Output is correct
57 Correct 4 ms 4700 KB Output is correct
58 Correct 4 ms 4852 KB Output is correct
59 Correct 5 ms 4700 KB Output is correct
60 Correct 5 ms 4852 KB Output is correct
61 Correct 4 ms 4700 KB Output is correct
62 Correct 4 ms 4828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 2 ms 4700 KB Output is correct
5 Correct 2 ms 4700 KB Output is correct
6 Correct 2 ms 4700 KB Output is correct
7 Correct 2 ms 4700 KB Output is correct
8 Correct 2 ms 4832 KB Output is correct
9 Correct 2 ms 4648 KB Output is correct
10 Correct 2 ms 4444 KB Output is correct
11 Correct 3 ms 4700 KB Output is correct
12 Correct 2 ms 4700 KB Output is correct
13 Correct 3 ms 4696 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 3 ms 4696 KB Output is correct
17 Correct 3 ms 4700 KB Output is correct
18 Correct 3 ms 4700 KB Output is correct
19 Correct 4 ms 4700 KB Output is correct
20 Correct 3 ms 4700 KB Output is correct
21 Correct 3 ms 4696 KB Output is correct
22 Correct 3 ms 4700 KB Output is correct
23 Correct 3 ms 4852 KB Output is correct
24 Correct 3 ms 4700 KB Output is correct
25 Correct 2 ms 4700 KB Output is correct
26 Correct 3 ms 4700 KB Output is correct
27 Correct 2 ms 4700 KB Output is correct
28 Correct 2 ms 4700 KB Output is correct
29 Correct 1 ms 4444 KB Output is correct
30 Correct 1 ms 4444 KB Output is correct
31 Correct 1 ms 4556 KB Output is correct
32 Correct 1 ms 4444 KB Output is correct
33 Correct 1 ms 4444 KB Output is correct
34 Correct 1 ms 4440 KB Output is correct
35 Correct 843 ms 70336 KB Output is correct
36 Correct 835 ms 70436 KB Output is correct
37 Correct 896 ms 70256 KB Output is correct
38 Correct 892 ms 69236 KB Output is correct
39 Correct 819 ms 68592 KB Output is correct
40 Correct 1 ms 4444 KB Output is correct
41 Correct 1 ms 4444 KB Output is correct
42 Correct 529 ms 68644 KB Output is correct
43 Correct 497 ms 68640 KB Output is correct
44 Correct 527 ms 68640 KB Output is correct
45 Correct 317 ms 68600 KB Output is correct
46 Correct 308 ms 68492 KB Output is correct
47 Correct 352 ms 68556 KB Output is correct
48 Correct 502 ms 68372 KB Output is correct
49 Correct 437 ms 68296 KB Output is correct
50 Correct 411 ms 68356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 2 ms 4700 KB Output is correct
5 Correct 2 ms 4700 KB Output is correct
6 Correct 2 ms 4700 KB Output is correct
7 Correct 2 ms 4700 KB Output is correct
8 Correct 2 ms 4832 KB Output is correct
9 Correct 2 ms 4648 KB Output is correct
10 Correct 2 ms 4444 KB Output is correct
11 Correct 3 ms 4700 KB Output is correct
12 Correct 2 ms 4700 KB Output is correct
13 Correct 3 ms 4696 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 3 ms 4696 KB Output is correct
17 Correct 3 ms 4700 KB Output is correct
18 Correct 3 ms 4700 KB Output is correct
19 Correct 4 ms 4700 KB Output is correct
20 Correct 3 ms 4700 KB Output is correct
21 Correct 3 ms 4696 KB Output is correct
22 Correct 3 ms 4700 KB Output is correct
23 Correct 3 ms 4852 KB Output is correct
24 Correct 3 ms 4700 KB Output is correct
25 Correct 2 ms 4700 KB Output is correct
26 Correct 3 ms 4700 KB Output is correct
27 Correct 2 ms 4700 KB Output is correct
28 Correct 2 ms 4700 KB Output is correct
29 Correct 1 ms 4444 KB Output is correct
30 Correct 1 ms 4444 KB Output is correct
31 Correct 1 ms 4556 KB Output is correct
32 Correct 1 ms 4444 KB Output is correct
33 Correct 1 ms 4444 KB Output is correct
34 Correct 1 ms 4440 KB Output is correct
35 Correct 4 ms 4696 KB Output is correct
36 Correct 5 ms 4668 KB Output is correct
37 Correct 4 ms 4824 KB Output is correct
38 Correct 5 ms 4696 KB Output is correct
39 Correct 4 ms 4700 KB Output is correct
40 Correct 3 ms 4700 KB Output is correct
41 Correct 3 ms 4696 KB Output is correct
42 Correct 3 ms 4696 KB Output is correct
43 Correct 4 ms 4700 KB Output is correct
44 Correct 5 ms 4700 KB Output is correct
45 Correct 6 ms 4696 KB Output is correct
46 Correct 3 ms 4700 KB Output is correct
47 Correct 3 ms 4700 KB Output is correct
48 Correct 3 ms 4700 KB Output is correct
49 Correct 843 ms 70336 KB Output is correct
50 Correct 835 ms 70436 KB Output is correct
51 Correct 896 ms 70256 KB Output is correct
52 Correct 892 ms 69236 KB Output is correct
53 Correct 819 ms 68592 KB Output is correct
54 Correct 1 ms 4444 KB Output is correct
55 Correct 1 ms 4444 KB Output is correct
56 Correct 529 ms 68644 KB Output is correct
57 Correct 497 ms 68640 KB Output is correct
58 Correct 527 ms 68640 KB Output is correct
59 Correct 317 ms 68600 KB Output is correct
60 Correct 308 ms 68492 KB Output is correct
61 Correct 352 ms 68556 KB Output is correct
62 Correct 502 ms 68372 KB Output is correct
63 Correct 437 ms 68296 KB Output is correct
64 Correct 411 ms 68356 KB Output is correct
65 Correct 1483 ms 68452 KB Output is correct
66 Correct 1513 ms 73888 KB Output is correct
67 Correct 1444 ms 72252 KB Output is correct
68 Correct 1476 ms 72528 KB Output is correct
69 Correct 1543 ms 72524 KB Output is correct
70 Correct 512 ms 70272 KB Output is correct
71 Correct 529 ms 70032 KB Output is correct
72 Correct 513 ms 69968 KB Output is correct
73 Correct 709 ms 72440 KB Output is correct
74 Correct 616 ms 72276 KB Output is correct
75 Correct 610 ms 72508 KB Output is correct
76 Correct 851 ms 72364 KB Output is correct
77 Correct 796 ms 72064 KB Output is correct
78 Correct 858 ms 72184 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 2 ms 4700 KB Output is correct
5 Correct 2 ms 4700 KB Output is correct
6 Correct 2 ms 4700 KB Output is correct
7 Correct 2 ms 4700 KB Output is correct
8 Correct 2 ms 4832 KB Output is correct
9 Correct 2 ms 4648 KB Output is correct
10 Correct 2 ms 4444 KB Output is correct
11 Correct 3 ms 4700 KB Output is correct
12 Correct 2 ms 4700 KB Output is correct
13 Correct 3 ms 4696 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 3 ms 4696 KB Output is correct
17 Correct 3 ms 4700 KB Output is correct
18 Correct 3 ms 4700 KB Output is correct
19 Correct 4 ms 4700 KB Output is correct
20 Correct 3 ms 4700 KB Output is correct
21 Correct 3 ms 4696 KB Output is correct
22 Correct 3 ms 4700 KB Output is correct
23 Correct 3 ms 4852 KB Output is correct
24 Correct 3 ms 4700 KB Output is correct
25 Correct 2 ms 4700 KB Output is correct
26 Correct 3 ms 4700 KB Output is correct
27 Correct 2 ms 4700 KB Output is correct
28 Correct 2 ms 4700 KB Output is correct
29 Correct 1 ms 4444 KB Output is correct
30 Correct 1 ms 4444 KB Output is correct
31 Correct 1 ms 4556 KB Output is correct
32 Correct 1 ms 4444 KB Output is correct
33 Correct 1 ms 4444 KB Output is correct
34 Correct 1 ms 4440 KB Output is correct
35 Correct 4 ms 4696 KB Output is correct
36 Correct 5 ms 4668 KB Output is correct
37 Correct 4 ms 4824 KB Output is correct
38 Correct 5 ms 4696 KB Output is correct
39 Correct 4 ms 4700 KB Output is correct
40 Correct 3 ms 4700 KB Output is correct
41 Correct 3 ms 4696 KB Output is correct
42 Correct 3 ms 4696 KB Output is correct
43 Correct 4 ms 4700 KB Output is correct
44 Correct 5 ms 4700 KB Output is correct
45 Correct 6 ms 4696 KB Output is correct
46 Correct 3 ms 4700 KB Output is correct
47 Correct 3 ms 4700 KB Output is correct
48 Correct 3 ms 4700 KB Output is correct
49 Correct 4 ms 4700 KB Output is correct
50 Correct 6 ms 4700 KB Output is correct
51 Correct 4 ms 4700 KB Output is correct
52 Correct 4 ms 4700 KB Output is correct
53 Correct 4 ms 4700 KB Output is correct
54 Correct 3 ms 4700 KB Output is correct
55 Correct 3 ms 4700 KB Output is correct
56 Correct 4 ms 4700 KB Output is correct
57 Correct 4 ms 4700 KB Output is correct
58 Correct 4 ms 4852 KB Output is correct
59 Correct 5 ms 4700 KB Output is correct
60 Correct 5 ms 4852 KB Output is correct
61 Correct 4 ms 4700 KB Output is correct
62 Correct 4 ms 4828 KB Output is correct
63 Correct 843 ms 70336 KB Output is correct
64 Correct 835 ms 70436 KB Output is correct
65 Correct 896 ms 70256 KB Output is correct
66 Correct 892 ms 69236 KB Output is correct
67 Correct 819 ms 68592 KB Output is correct
68 Correct 1 ms 4444 KB Output is correct
69 Correct 1 ms 4444 KB Output is correct
70 Correct 529 ms 68644 KB Output is correct
71 Correct 497 ms 68640 KB Output is correct
72 Correct 527 ms 68640 KB Output is correct
73 Correct 317 ms 68600 KB Output is correct
74 Correct 308 ms 68492 KB Output is correct
75 Correct 352 ms 68556 KB Output is correct
76 Correct 502 ms 68372 KB Output is correct
77 Correct 437 ms 68296 KB Output is correct
78 Correct 411 ms 68356 KB Output is correct
79 Correct 1483 ms 68452 KB Output is correct
80 Correct 1513 ms 73888 KB Output is correct
81 Correct 1444 ms 72252 KB Output is correct
82 Correct 1476 ms 72528 KB Output is correct
83 Correct 1543 ms 72524 KB Output is correct
84 Correct 512 ms 70272 KB Output is correct
85 Correct 529 ms 70032 KB Output is correct
86 Correct 513 ms 69968 KB Output is correct
87 Correct 709 ms 72440 KB Output is correct
88 Correct 616 ms 72276 KB Output is correct
89 Correct 610 ms 72508 KB Output is correct
90 Correct 851 ms 72364 KB Output is correct
91 Correct 796 ms 72064 KB Output is correct
92 Correct 858 ms 72184 KB Output is correct
93 Correct 534 ms 69696 KB Output is correct
94 Correct 816 ms 73876 KB Output is correct
95 Correct 821 ms 73724 KB Output is correct
96 Correct 859 ms 73764 KB Output is correct
97 Correct 965 ms 73312 KB Output is correct
98 Correct 972 ms 73424 KB Output is correct
99 Correct 926 ms 73372 KB Output is correct
100 Correct 1657 ms 73696 KB Output is correct
101 Correct 1665 ms 73644 KB Output is correct
102 Correct 1806 ms 73672 KB Output is correct
103 Correct 1995 ms 73660 KB Output is correct
104 Correct 1733 ms 76248 KB Output is correct
105 Correct 410 ms 70744 KB Output is correct
106 Correct 505 ms 70612 KB Output is correct