답안 #792457

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
792457 2023-07-25T05:08:46 Z 반딧불(#10051) Real Mountains (CCO23_day1problem2) C++17
25 / 25
3543 ms 101280 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1000003;

void input();
void makeGoal();
void makeTree();
void solve();

int main(){
    input();
    makeGoal();
    makeTree();
    solve();
}

int n;
ll arr[1000002];
ll goal[1000002];

void input(){
    scanf("%d", &n);
    for(int i=1; i<=n; i++) scanf("%lld", &arr[i]);
}

int L;
int numbers[1000002];
ll prfMax[1000002], sufMax[1000002];
void makeGoal(){
    for(int i=1; i<=n; i++) prfMax[i] = max(prfMax[i-1], arr[i]);
    for(int i=n; i>=1; i--) sufMax[i] = max(sufMax[i+1], arr[i]);
    for(int i=1; i<=n; i++){
        goal[i] = arr[i];
        if(prfMax[i-1] > arr[i] && sufMax[i+1] > arr[i]) goal[i] = min(prfMax[i-1], sufMax[i+1]);
    }

    for(int i=1; i<=n; i++) numbers[i] = arr[i];
    sort(numbers+1, numbers+n+1);
    L = unique(numbers+1, numbers+n+1) - numbers - 1;
}

struct segTree{
    ll minVal[1<<21], minCnt[1<<21], secondMin[1<<21], lazy[1<<21];

    inline void merge(int i){
        minVal[i] = min(minVal[i*2], minVal[i*2+1]);
        minCnt[i] = (minVal[i] == minVal[i*2] ? minCnt[i*2] : 0) + (minVal[i] == minVal[i*2+1] ? minCnt[i*2+1] : 0);
        secondMin[i] = min(minVal[i] == minVal[i*2] ? secondMin[i*2] : minVal[i*2],
                           minVal[i] == minVal[i*2+1] ? secondMin[i*2+1] : minVal[i*2+1]);
    }

    void init(int i, int l, int r, ll *A){
        if(l==r){
            minVal[i] = A[l], minCnt[i] = 1;
            secondMin[i] = INF;
            lazy[i] = 0;
            return;
        }
        int m = (l+r)>>1;
        init(i*2, l, m, A);
        init(i*2+1, m+1, r, A);
        merge(i);
    }

    void propagate(int i, int l, int r){
        if(!lazy[i]) return;
        minVal[i] = max(minVal[i], lazy[i]);
        if(l!=r){
            lazy[i*2] = max(lazy[i*2], lazy[i]);
            lazy[i*2+1] = max(lazy[i*2+1], lazy[i]);
        }
        lazy[i] = 0;
    }

    void update(int i, int l, int r, int s, int e, ll v){
        propagate(i, l, r);
        if(r<s || e<l || minVal[i] >= v) return;
        if(s<=l && r<=e && v < secondMin[i]){
            lazy[i] = v;
            propagate(i, l, r);
            return;
        }
        int m = (l+r)>>1;
        update(i*2, l, m, s, e, v);
        update(i*2+1, m+1, r, s, e, v);
        merge(i);
    }

    pair<ll, ll> query(int i, int l, int r, int s, int e){
        propagate(i, l, r);
        if(r<s || e<l) return make_pair(INF, 0);
        if(s<=l && r<=e) return make_pair(minVal[i], minCnt[i]);
        int m = (l+r)>>1;
        pair<ll, ll> a = query(i*2, l, m, s, e), b = query(i*2+1, m+1, r, s, e);
        return make_pair(min(a.first, b.first), (a.first<=b.first?a.second:0) + (b.first<=a.first?b.second:0));
    }

    int getLeftest(int i, int l, int r, int x, ll v){
        propagate(i, l, r);
        if(r<x || minVal[i] > v) return r+1;
        if(l==r) return l;
        int m = (l+r)>>1;
        int tmp = getLeftest(i*2, l, m, x, v);
        if(tmp != m+1) return tmp;
        else return getLeftest(i*2+1, m+1, r, x, v);
    }

    int getRightest(int i, int l, int r, int x, ll v){
        propagate(i, l, r);
        if(x<l || minVal[i] > v) return l-1;
        if(l==r) return l;
        int m = (l+r)>>1;
        int tmp = getRightest(i*2+1, m+1, r, x, v);
        if(tmp != m) return tmp;
        else return getRightest(i*2, l, m, x, v);
    }

    ll secondQuery(int i, int l, int r, int s, int e, ll v){
        propagate(i, l, r);
        if(r<s || e<l) return INF;
        if(s<=l && r<=e) return minVal[i] == v ? secondMin[i] : minVal[i];
        int m = (l+r)>>1;
        return min(secondQuery(i*2, l, m, s, e, v), secondQuery(i*2+1, m+1, r, s, e, v));
    }
} tree;

void makeTree(){
    tree.init(1, 1, n, arr);
}

ll sum1(ll s){
    return s*(s+1)/2%MOD;
}

ll sum1(ll s, ll e){
    return (sum1(e) - sum1(s-1) + MOD) % MOD;
}

ll ans;
void solve(){
    int lpnt = 1, rpnt = n;
    for(int a=1; a<L; a++){
        ll s = numbers[a], e = numbers[a+1]; /// �������� ������
        while(goal[lpnt] < e) lpnt++;
        while(goal[rpnt] < e) rpnt--;

        pair<ll, ll> pr = tree.query(1, 1, n, lpnt, rpnt);
        if(pr.first != s) continue;
        int k = pr.second;
        int l = tree.getLeftest(1, 1, n, lpnt, s);
        int r = tree.getRightest(1, 1, n, rpnt, s);
        ll lv = tree.query(1, 1, n, lpnt, l-1).first;
        ll rv = tree.query(1, 1, n, r+1, rpnt).first;
        ll mv = tree.secondQuery(1, 1, n, l+1, r-1, s);

        if(l==r){ /// �ٲ� �� �ϳ��� ���
            ans += (e-s) * (lv + rv) + sum1(s, e-1);
            ans %= MOD;
        }
        else{ /// �ٲ� �� ���� ���� ���
            if(lv > rv) swap(lv, rv);
            ans += (lv + rv + min({lv, rv, mv})) * (e-s);
            ans += sum1(s, e-1) + (e-s);
            ans += sum1(s+1, e) * 2 * (k-2);
            ans += sum1(s, e-1) * k;
            ans %= MOD;
        }

        tree.update(1, 1, n, lpnt, rpnt, e);
    }
    printf("%lld", ans);
}

Compilation message

Main.cpp: In function 'void input()':
Main.cpp:26:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
Main.cpp:27:34: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |     for(int i=1; i<=n; i++) scanf("%lld", &arr[i]);
      |                             ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 980 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 2 ms 980 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 1 ms 980 KB Output is correct
10 Correct 2 ms 1028 KB Output is correct
11 Correct 1 ms 980 KB Output is correct
12 Correct 2 ms 980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 980 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 2 ms 980 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 1 ms 980 KB Output is correct
10 Correct 2 ms 1028 KB Output is correct
11 Correct 1 ms 980 KB Output is correct
12 Correct 2 ms 980 KB Output is correct
13 Correct 2 ms 980 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 3 ms 980 KB Output is correct
17 Correct 2 ms 980 KB Output is correct
18 Correct 3 ms 980 KB Output is correct
19 Correct 2 ms 980 KB Output is correct
20 Correct 2 ms 980 KB Output is correct
21 Correct 1 ms 980 KB Output is correct
22 Correct 2 ms 980 KB Output is correct
23 Correct 2 ms 980 KB Output is correct
24 Correct 1 ms 980 KB Output is correct
25 Correct 1 ms 1044 KB Output is correct
26 Correct 2 ms 980 KB Output is correct
27 Correct 2 ms 980 KB Output is correct
28 Correct 1 ms 980 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 980 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 2 ms 980 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 1 ms 980 KB Output is correct
10 Correct 2 ms 1028 KB Output is correct
11 Correct 1 ms 980 KB Output is correct
12 Correct 2 ms 980 KB Output is correct
13 Correct 2 ms 980 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 3 ms 980 KB Output is correct
17 Correct 2 ms 980 KB Output is correct
18 Correct 3 ms 980 KB Output is correct
19 Correct 2 ms 980 KB Output is correct
20 Correct 2 ms 980 KB Output is correct
21 Correct 1 ms 980 KB Output is correct
22 Correct 2 ms 980 KB Output is correct
23 Correct 2 ms 980 KB Output is correct
24 Correct 1 ms 980 KB Output is correct
25 Correct 1 ms 1044 KB Output is correct
26 Correct 2 ms 980 KB Output is correct
27 Correct 2 ms 980 KB Output is correct
28 Correct 1 ms 980 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 0 ms 340 KB Output is correct
35 Correct 9 ms 1056 KB Output is correct
36 Correct 8 ms 1052 KB Output is correct
37 Correct 8 ms 980 KB Output is correct
38 Correct 8 ms 980 KB Output is correct
39 Correct 7 ms 1052 KB Output is correct
40 Correct 1 ms 980 KB Output is correct
41 Correct 2 ms 968 KB Output is correct
42 Correct 2 ms 980 KB Output is correct
43 Correct 5 ms 980 KB Output is correct
44 Correct 5 ms 980 KB Output is correct
45 Correct 5 ms 980 KB Output is correct
46 Correct 7 ms 980 KB Output is correct
47 Correct 8 ms 1052 KB Output is correct
48 Correct 7 ms 1056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 980 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 2 ms 980 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 1 ms 980 KB Output is correct
10 Correct 2 ms 1028 KB Output is correct
11 Correct 1 ms 980 KB Output is correct
12 Correct 2 ms 980 KB Output is correct
13 Correct 2 ms 980 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 3 ms 980 KB Output is correct
17 Correct 2 ms 980 KB Output is correct
18 Correct 3 ms 980 KB Output is correct
19 Correct 2 ms 980 KB Output is correct
20 Correct 2 ms 980 KB Output is correct
21 Correct 1 ms 980 KB Output is correct
22 Correct 2 ms 980 KB Output is correct
23 Correct 2 ms 980 KB Output is correct
24 Correct 1 ms 980 KB Output is correct
25 Correct 1 ms 1044 KB Output is correct
26 Correct 2 ms 980 KB Output is correct
27 Correct 2 ms 980 KB Output is correct
28 Correct 1 ms 980 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 0 ms 340 KB Output is correct
35 Correct 9 ms 1056 KB Output is correct
36 Correct 8 ms 1052 KB Output is correct
37 Correct 8 ms 980 KB Output is correct
38 Correct 8 ms 980 KB Output is correct
39 Correct 7 ms 1052 KB Output is correct
40 Correct 1 ms 980 KB Output is correct
41 Correct 2 ms 968 KB Output is correct
42 Correct 2 ms 980 KB Output is correct
43 Correct 5 ms 980 KB Output is correct
44 Correct 5 ms 980 KB Output is correct
45 Correct 5 ms 980 KB Output is correct
46 Correct 7 ms 980 KB Output is correct
47 Correct 8 ms 1052 KB Output is correct
48 Correct 7 ms 1056 KB Output is correct
49 Correct 7 ms 1052 KB Output is correct
50 Correct 7 ms 1056 KB Output is correct
51 Correct 6 ms 980 KB Output is correct
52 Correct 5 ms 980 KB Output is correct
53 Correct 9 ms 1056 KB Output is correct
54 Correct 2 ms 980 KB Output is correct
55 Correct 2 ms 980 KB Output is correct
56 Correct 2 ms 980 KB Output is correct
57 Correct 5 ms 980 KB Output is correct
58 Correct 5 ms 980 KB Output is correct
59 Correct 7 ms 980 KB Output is correct
60 Correct 9 ms 1056 KB Output is correct
61 Correct 7 ms 980 KB Output is correct
62 Correct 8 ms 1108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 980 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 2 ms 980 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 1 ms 980 KB Output is correct
10 Correct 2 ms 1028 KB Output is correct
11 Correct 1 ms 980 KB Output is correct
12 Correct 2 ms 980 KB Output is correct
13 Correct 2 ms 980 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 3 ms 980 KB Output is correct
17 Correct 2 ms 980 KB Output is correct
18 Correct 3 ms 980 KB Output is correct
19 Correct 2 ms 980 KB Output is correct
20 Correct 2 ms 980 KB Output is correct
21 Correct 1 ms 980 KB Output is correct
22 Correct 2 ms 980 KB Output is correct
23 Correct 2 ms 980 KB Output is correct
24 Correct 1 ms 980 KB Output is correct
25 Correct 1 ms 1044 KB Output is correct
26 Correct 2 ms 980 KB Output is correct
27 Correct 2 ms 980 KB Output is correct
28 Correct 1 ms 980 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 0 ms 340 KB Output is correct
35 Correct 615 ms 101052 KB Output is correct
36 Correct 668 ms 101156 KB Output is correct
37 Correct 648 ms 101172 KB Output is correct
38 Correct 654 ms 101152 KB Output is correct
39 Correct 651 ms 101160 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 1 ms 340 KB Output is correct
42 Correct 249 ms 101064 KB Output is correct
43 Correct 243 ms 101048 KB Output is correct
44 Correct 261 ms 101060 KB Output is correct
45 Correct 140 ms 99224 KB Output is correct
46 Correct 135 ms 99188 KB Output is correct
47 Correct 127 ms 99252 KB Output is correct
48 Correct 234 ms 101176 KB Output is correct
49 Correct 239 ms 101088 KB Output is correct
50 Correct 237 ms 101168 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 980 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 2 ms 980 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 1 ms 980 KB Output is correct
10 Correct 2 ms 1028 KB Output is correct
11 Correct 1 ms 980 KB Output is correct
12 Correct 2 ms 980 KB Output is correct
13 Correct 2 ms 980 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 3 ms 980 KB Output is correct
17 Correct 2 ms 980 KB Output is correct
18 Correct 3 ms 980 KB Output is correct
19 Correct 2 ms 980 KB Output is correct
20 Correct 2 ms 980 KB Output is correct
21 Correct 1 ms 980 KB Output is correct
22 Correct 2 ms 980 KB Output is correct
23 Correct 2 ms 980 KB Output is correct
24 Correct 1 ms 980 KB Output is correct
25 Correct 1 ms 1044 KB Output is correct
26 Correct 2 ms 980 KB Output is correct
27 Correct 2 ms 980 KB Output is correct
28 Correct 1 ms 980 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 0 ms 340 KB Output is correct
35 Correct 9 ms 1056 KB Output is correct
36 Correct 8 ms 1052 KB Output is correct
37 Correct 8 ms 980 KB Output is correct
38 Correct 8 ms 980 KB Output is correct
39 Correct 7 ms 1052 KB Output is correct
40 Correct 1 ms 980 KB Output is correct
41 Correct 2 ms 968 KB Output is correct
42 Correct 2 ms 980 KB Output is correct
43 Correct 5 ms 980 KB Output is correct
44 Correct 5 ms 980 KB Output is correct
45 Correct 5 ms 980 KB Output is correct
46 Correct 7 ms 980 KB Output is correct
47 Correct 8 ms 1052 KB Output is correct
48 Correct 7 ms 1056 KB Output is correct
49 Correct 615 ms 101052 KB Output is correct
50 Correct 668 ms 101156 KB Output is correct
51 Correct 648 ms 101172 KB Output is correct
52 Correct 654 ms 101152 KB Output is correct
53 Correct 651 ms 101160 KB Output is correct
54 Correct 1 ms 340 KB Output is correct
55 Correct 1 ms 340 KB Output is correct
56 Correct 249 ms 101064 KB Output is correct
57 Correct 243 ms 101048 KB Output is correct
58 Correct 261 ms 101060 KB Output is correct
59 Correct 140 ms 99224 KB Output is correct
60 Correct 135 ms 99188 KB Output is correct
61 Correct 127 ms 99252 KB Output is correct
62 Correct 234 ms 101176 KB Output is correct
63 Correct 239 ms 101088 KB Output is correct
64 Correct 237 ms 101168 KB Output is correct
65 Correct 2105 ms 101168 KB Output is correct
66 Correct 2307 ms 101168 KB Output is correct
67 Correct 2147 ms 101172 KB Output is correct
68 Correct 2532 ms 101164 KB Output is correct
69 Correct 2481 ms 101168 KB Output is correct
70 Correct 240 ms 101004 KB Output is correct
71 Correct 248 ms 101044 KB Output is correct
72 Correct 268 ms 101048 KB Output is correct
73 Correct 990 ms 101168 KB Output is correct
74 Correct 1067 ms 101104 KB Output is correct
75 Correct 1000 ms 101112 KB Output is correct
76 Correct 2393 ms 101172 KB Output is correct
77 Correct 1952 ms 101192 KB Output is correct
78 Correct 2529 ms 101168 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 980 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 2 ms 980 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 1 ms 980 KB Output is correct
10 Correct 2 ms 1028 KB Output is correct
11 Correct 1 ms 980 KB Output is correct
12 Correct 2 ms 980 KB Output is correct
13 Correct 2 ms 980 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 3 ms 980 KB Output is correct
17 Correct 2 ms 980 KB Output is correct
18 Correct 3 ms 980 KB Output is correct
19 Correct 2 ms 980 KB Output is correct
20 Correct 2 ms 980 KB Output is correct
21 Correct 1 ms 980 KB Output is correct
22 Correct 2 ms 980 KB Output is correct
23 Correct 2 ms 980 KB Output is correct
24 Correct 1 ms 980 KB Output is correct
25 Correct 1 ms 1044 KB Output is correct
26 Correct 2 ms 980 KB Output is correct
27 Correct 2 ms 980 KB Output is correct
28 Correct 1 ms 980 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 0 ms 340 KB Output is correct
35 Correct 9 ms 1056 KB Output is correct
36 Correct 8 ms 1052 KB Output is correct
37 Correct 8 ms 980 KB Output is correct
38 Correct 8 ms 980 KB Output is correct
39 Correct 7 ms 1052 KB Output is correct
40 Correct 1 ms 980 KB Output is correct
41 Correct 2 ms 968 KB Output is correct
42 Correct 2 ms 980 KB Output is correct
43 Correct 5 ms 980 KB Output is correct
44 Correct 5 ms 980 KB Output is correct
45 Correct 5 ms 980 KB Output is correct
46 Correct 7 ms 980 KB Output is correct
47 Correct 8 ms 1052 KB Output is correct
48 Correct 7 ms 1056 KB Output is correct
49 Correct 7 ms 1052 KB Output is correct
50 Correct 7 ms 1056 KB Output is correct
51 Correct 6 ms 980 KB Output is correct
52 Correct 5 ms 980 KB Output is correct
53 Correct 9 ms 1056 KB Output is correct
54 Correct 2 ms 980 KB Output is correct
55 Correct 2 ms 980 KB Output is correct
56 Correct 2 ms 980 KB Output is correct
57 Correct 5 ms 980 KB Output is correct
58 Correct 5 ms 980 KB Output is correct
59 Correct 7 ms 980 KB Output is correct
60 Correct 9 ms 1056 KB Output is correct
61 Correct 7 ms 980 KB Output is correct
62 Correct 8 ms 1108 KB Output is correct
63 Correct 615 ms 101052 KB Output is correct
64 Correct 668 ms 101156 KB Output is correct
65 Correct 648 ms 101172 KB Output is correct
66 Correct 654 ms 101152 KB Output is correct
67 Correct 651 ms 101160 KB Output is correct
68 Correct 1 ms 340 KB Output is correct
69 Correct 1 ms 340 KB Output is correct
70 Correct 249 ms 101064 KB Output is correct
71 Correct 243 ms 101048 KB Output is correct
72 Correct 261 ms 101060 KB Output is correct
73 Correct 140 ms 99224 KB Output is correct
74 Correct 135 ms 99188 KB Output is correct
75 Correct 127 ms 99252 KB Output is correct
76 Correct 234 ms 101176 KB Output is correct
77 Correct 239 ms 101088 KB Output is correct
78 Correct 237 ms 101168 KB Output is correct
79 Correct 2105 ms 101168 KB Output is correct
80 Correct 2307 ms 101168 KB Output is correct
81 Correct 2147 ms 101172 KB Output is correct
82 Correct 2532 ms 101164 KB Output is correct
83 Correct 2481 ms 101168 KB Output is correct
84 Correct 240 ms 101004 KB Output is correct
85 Correct 248 ms 101044 KB Output is correct
86 Correct 268 ms 101048 KB Output is correct
87 Correct 990 ms 101168 KB Output is correct
88 Correct 1067 ms 101104 KB Output is correct
89 Correct 1000 ms 101112 KB Output is correct
90 Correct 2393 ms 101172 KB Output is correct
91 Correct 1952 ms 101192 KB Output is correct
92 Correct 2529 ms 101168 KB Output is correct
93 Correct 291 ms 100980 KB Output is correct
94 Correct 1473 ms 101212 KB Output is correct
95 Correct 1398 ms 101076 KB Output is correct
96 Correct 1399 ms 101096 KB Output is correct
97 Correct 3543 ms 101168 KB Output is correct
98 Correct 3394 ms 101168 KB Output is correct
99 Correct 3053 ms 101160 KB Output is correct
100 Correct 3196 ms 101280 KB Output is correct
101 Correct 2826 ms 101172 KB Output is correct
102 Correct 3129 ms 101172 KB Output is correct
103 Correct 2939 ms 101164 KB Output is correct
104 Correct 3457 ms 101168 KB Output is correct
105 Correct 251 ms 101048 KB Output is correct
106 Correct 246 ms 101044 KB Output is correct