QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#453869#2761. Ancient Booksthangthang100 ✓66ms15036kbC++202.4kb2024-06-24 13:45:042024-06-24 13:45:05

Judging History

This is the latest submission verdict.

  • [2024-06-24 13:45:05]
  • Judged
  • Verdict: 100
  • Time: 66ms
  • Memory: 15036kb
  • [2024-06-24 13:45:04]
  • Submitted

answer

#include <bits/stdc++.h>

using namespace std;

const int N = 1e6 + 5;

int L, R, p[N], n, l, r;

int g(int &l, int &r){
    int u = l;
    int v = r;
    int ed = r;
    int st = 1e9;
    int be = r;
    int a = 0;
    while (r <= R){
        ++ r;
        if (r == R + 1) {
            if (st < be){
                -- r;
                break;
            }
            break;
        }
        if (r > ed){
            if (st < be) {
                break;
            }
            a += 2;
            ed = r;
        }
        ed = max(ed, p[r]);
        st = min(st, p[r]);
    }
    r = ed;

    be = l;
    ed = l;
    st = -1;
    int b = 0;
    while (l >= L){
        -- l;
        if (l == L - 1) {
            if (st > be) {
                ++ l;
                break;
            }
            else return a + b;
        }
        if (l < ed){
            if (st > be) break;
            b += 2;
            ed = l;
        }
        ed = min(ed, p[l]);
        st = max(st, p[l]);
    }
    l = ed;

    while (u > l || v < r){
        if (u > l){
            -- u;
            l = min({l, u, p[u]});
            r = max({r, u, p[u]});
        }
        else if (v < r){
            ++ v;
            l = min({l, v, p[v]});
            r = max({r, v, p[v]});
        }
    }

    return min(a, b);
}

long long minimum_walk(vector <int> arr, int s){
    int n = arr.size();
    for (int i = 0; i < n; ++ i) p[i] = arr[i];

    long long ans = 0;
    L = s, R = s;
    for (int i = 0; i < n; ++ i){
        ans += abs(p[i] - i);
        if (p[i] != i){
            L = min(L, i);
            R = max(R, i);
        }
    }

    l = s;
    r = s;
    int st = min(s, p[s]);
    int ed = max(s, p[s]);
    while (l > st || r < ed){
        if (l > st){
            -- l;
            st = min({st, l, p[l]});
            ed = max({ed, l, p[l]});
        }
        else {
            ++ r;
            st = min({st, r, p[r]});
            ed = max({ed, r, p[r]});
        }
    }

    while (L <= l && r <= R) ans += g(l, r);

    return ans;
}
//
//int main(){
//    freopen("books.inp", "r", stdin);
//    freopen("books.out", "w", stdout);
//
//    cin >> n;
//    int s; cin >> s;
//    vector <int> p(n);
//    for (int i = 0; i < n; ++ i) cin >> p[i];
//    cout << minimum_walk(p, s);
//}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 12
Accepted

Test #1:

score: 12
Accepted
time: 1ms
memory: 3768kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
4 0
0 2 3 1

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
6

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 3764kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
4 0
0 3 2 1

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
6

result:

ok 3 lines

Test #3:

score: 0
Accepted
time: 0ms
memory: 4072kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
4 0
3 2 0 1

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
8

result:

ok 3 lines

Test #4:

score: 0
Accepted
time: 0ms
memory: 3968kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
3 0
2 0 1

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
4

result:

ok 3 lines

Test #5:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
4 0
2 0 1 3

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
4

result:

ok 3 lines

Test #6:

score: 0
Accepted
time: 0ms
memory: 3940kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
4 0
3 2 1 0

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
8

result:

ok 3 lines

Test #7:

score: 0
Accepted
time: 0ms
memory: 3764kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
4 0
3 0 1 2

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
6

result:

ok 3 lines

Test #8:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
4 0
3 1 0 2

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
6

result:

ok 3 lines

Test #9:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
4 0
0 1 2 3

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
0

result:

ok 3 lines

Test #10:

score: 0
Accepted
time: 0ms
memory: 3760kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
4 0
0 2 1 3

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
4

result:

ok 3 lines

Test #11:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
2 0
0 1

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
0

result:

ok 3 lines

Test #12:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
2 0
1 0

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
2

result:

ok 3 lines

Test #13:

score: 0
Accepted
time: 0ms
memory: 3732kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
4 0
2 3 1 0

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
8

result:

ok 3 lines

Test #14:

score: 0
Accepted
time: 0ms
memory: 3752kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1 0
0

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
0

result:

ok 3 lines

Test #15:

score: 0
Accepted
time: 0ms
memory: 3688kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
4 0
0 3 1 2

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
6

result:

ok 3 lines

Test #16:

score: 0
Accepted
time: 0ms
memory: 3680kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
4 0
1 2 3 0

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
6

result:

ok 3 lines

Test #17:

score: 0
Accepted
time: 0ms
memory: 3756kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
4 0
2 1 0 3

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
4

result:

ok 3 lines

Test #18:

score: 0
Accepted
time: 0ms
memory: 3944kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
4 0
1 2 0 3

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
4

result:

ok 3 lines

Subtask #2:

score: 10
Accepted

Dependency #1:

100%
Accepted

Test #19:

score: 10
Accepted
time: 1ms
memory: 3772kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 0
215 425 385 199 188 505 975 632 250 971 805 355 676 906 376 988 646 301 810 225 850 903 990 777 150 469 227 99 867 817 904 361 913 67 707 461 556 963 60 603 999 113 124 628 18 756 929 255 689 73 63 354 511 684 598 824 816 780 161 519 61 182 733 30 594 625 ...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
338572

result:

ok 3 lines

Test #20:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 0
349 981 442 749 932 774 582 268 840 618 934 310 964 214 627 623 765 161 58 180 6 612 663 994 630 602 128 286 682 479 884 969 872 548 827 744 438 10 169 789 511 299 293 177 4 850 869 781 334 912 126 916 816 212 254 226 276 977 465 584 665 512 265 871 710 90...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
338488

result:

ok 3 lines

Test #21:

score: 0
Accepted
time: 0ms
memory: 3828kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
0

result:

ok 3 lines

Test #22:

score: 0
Accepted
time: 1ms
memory: 3688kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 0
1 0 3 2 6 7 4 5 8 11 9 10 14 13 12 15 16 17 18 20 19 21 22 24 23 25 26 29 28 27 30 31 34 35 32 33 36 37 38 39 40 41 42 43 44 45 46 47 49 48 50 54 51 52 53 55 56 59 58 60 57 61 62 64 65 63 66 67 69 68 70 71 72 73 74 75 76 78 79 77 80 81 82 83 84 85 86 87 88...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
2082

result:

ok 3 lines

Test #23:

score: 0
Accepted
time: 1ms
memory: 4080kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 0
0 2 1 3 4 5 7 6 8 9 10 11 12 14 17 15 16 13 18 19 22 20 21 23 26 24 25 27 28 31 29 30 32 33 34 35 39 37 38 36 40 42 41 43 44 45 47 48 46 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 70 71 69 72 73 76 77 78 79 75 80 74 81 82 83 84 86 85 87 88...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
2096

result:

ok 3 lines

Test #24:

score: 0
Accepted
time: 1ms
memory: 3688kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 0
0 1 2 3 5 4 6 9 7 8 10 11 12 13 15 14 16 17 18 20 19 26 23 27 22 24 21 25 32 30 31 28 33 29 34 35 36 38 37 40 42 43 41 39 44 45 49 50 47 48 46 51 54 55 53 57 56 52 58 60 59 61 62 63 64 65 66 67 68 71 69 70 72 73 74 75 76 77 83 81 85 84 79 78 82 80 86 90 87...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
2648

result:

ok 3 lines

Test #25:

score: 0
Accepted
time: 0ms
memory: 3688kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 0
0 5 2 3 11 7 12 4 6 10 1 9 8 13 14 15 17 16 18 20 19 22 21 23 24 27 26 25 33 31 28 32 29 30 34 35 36 37 38 39 43 42 44 41 40 45 47 50 51 49 48 52 46 54 53 56 55 57 59 58 60 61 62 66 64 65 63 67 68 69 74 76 75 77 79 71 80 72 78 70 73 84 85 83 81 82 86 87 88...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
2790

result:

ok 3 lines

Test #26:

score: 0
Accepted
time: 1ms
memory: 3980kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 0
1 0 3 6 2 5 4 8 10 7 9 25 11 22 14 16 28 27 15 20 19 13 17 23 18 12 24 21 26 42 45 38 46 32 36 35 37 34 43 31 33 40 29 44 30 39 41 57 58 54 59 53 47 49 55 52 50 48 56 60 51 68 61 64 67 66 65 69 62 70 63 87 82 76 84 73 75 74 89 72 71 81 88 80 86 83 78 79 85...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
12988

result:

ok 3 lines

Test #27:

score: 0
Accepted
time: 0ms
memory: 3972kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 0
3 2 0 6 8 29 19 16 21 23 20 1 25 30 27 24 12 5 18 14 10 26 22 15 4 17 9 11 13 28 7 37 40 33 35 34 36 41 31 38 32 39 54 55 42 52 48 43 49 47 58 45 50 57 51 56 44 46 53 65 66 70 60 75 69 74 59 67 72 61 64 62 63 68 73 71 89 103 83 92 127 129 121 85 82 116 117...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
21534

result:

ok 3 lines

Test #28:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 0
13 3 12 10 4 6 8 16 14 0 9 7 1 15 2 5 11 26 18 24 27 23 22 21 30 28 29 17 19 25 20 53 115 118 94 52 84 50 68 41 121 38 78 82 93 136 31 98 74 112 58 111 108 133 70 89 95 119 40 80 59 42 129 32 48 114 106 127 87 135 43 61 100 97 122 86 44 123 96 103 56 35 90...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
44102

result:

ok 3 lines

Test #29:

score: 0
Accepted
time: 0ms
memory: 3688kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 0
187 1 6 3 4 5 2 7 612 9 16 11 12 13 14 15 10 17 421 23 22 21 20 32 24 30 29 27 28 26 25 31 19 395 35 34 663 37 41 39 40 38 42 359 44 50 46 47 48 49 45 51 571 68 67 66 64 57 58 62 61 60 59 63 65 56 55 54 53 862 70 71 72 73 79 75 76 77 78 74 80 83 82 81 84 8...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
28572

result:

ok 3 lines

Subtask #3:

score: 28
Accepted

Dependency #2:

100%
Accepted

Test #30:

score: 28
Accepted
time: 54ms
memory: 14904kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 0
644512 472808 85072 65450 172756 282729 522590 357405 471541 291723 453984 843369 590813 163885 27389 613046 200216 535509 43689 765302 411696 57611 186006 261119 919316 930942 427702 417523 329659 226535 468401 376049 504719 901736 77976 61745 224042 1...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
333035179244

result:

ok 3 lines

Test #31:

score: 0
Accepted
time: 61ms
memory: 14844kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 0
541498 786918 720390 165172 12594 449529 955233 523816 106727 641049 347737 282117 508955 257968 690952 415572 153843 941051 432401 250935 93698 968543 50014 781192 319222 586265 763978 575201 186801 601452 468575 380999 768204 334786 638795 857400 6110...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
333200737604

result:

ok 3 lines

Test #32:

score: 0
Accepted
time: 51ms
memory: 14884kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
0

result:

ok 3 lines

Test #33:

score: 0
Accepted
time: 57ms
memory: 14732kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 0
0 2 1 3 6 4 5 7 8 11 10 9 12 13 14 15 16 17 18 19 20 21 24 23 22 26 25 27 29 28 30 31 32 33 35 34 36 37 38 40 39 41 42 44 43 45 46 48 49 47 50 51 52 53 54 55 57 56 59 60 58 61 62 63 64 65 66 67 69 68 70 71 75 74 73 72 76 77 78 79 82 80 81 86 88 83 85 84...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
2121672

result:

ok 3 lines

Test #34:

score: 0
Accepted
time: 62ms
memory: 14736kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 0
0 1 2 3 6 5 4 7 8 10 9 12 11 13 14 15 16 17 18 26 22 23 21 24 20 25 19 27 28 32 29 31 30 34 33 37 39 35 38 36 42 40 41 43 44 45 46 47 48 49 50 51 53 52 54 56 55 62 59 61 63 57 58 60 64 65 66 67 68 70 69 71 74 72 73 76 75 77 80 78 81 79 82 83 84 85 86 87...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
2121806

result:

ok 3 lines

Test #35:

score: 0
Accepted
time: 66ms
memory: 14904kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 0
1 0 2 3 4 5 7 6 8 10 9 13 11 12 15 18 17 14 16 21 20 19 23 22 28 25 26 30 24 29 27 33 32 35 31 34 36 37 38 39 40 41 42 44 43 45 47 46 49 48 50 52 51 53 54 61 57 62 63 60 59 55 58 56 65 66 73 69 67 68 72 71 64 70 74 75 76 78 77 80 79 81 84 87 82 85 88 86...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
2466824

result:

ok 3 lines

Test #36:

score: 0
Accepted
time: 63ms
memory: 14872kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 0
3 1 2 0 4 5 6 14 8 24 26 23 11 31 15 12 17 32 34 18 22 16 19 10 9 20 7 37 30 27 28 13 40 33 29 36 38 21 39 25 35 41 48 42 49 45 51 47 44 43 46 50 54 52 57 55 58 53 56 59 62 64 61 66 60 63 65 88 82 79 74 97 92 87 67 81 69 93 94 72 70 77 71 80 83 95 91 75...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
6580036

result:

ok 3 lines

Test #37:

score: 0
Accepted
time: 52ms
memory: 14916kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 0
44 103 162 9 66 113 125 51 48 21 56 63 128 158 97 73 71 31 60 169 130 74 139 13 65 150 184 70 23 88 68 107 93 182 118 132 47 136 45 153 168 10 54 127 151 121 4 89 138 24 46 82 147 104 156 37 106 135 0 30 41 72 19 94 105 75 145 134 146 137 133 159 69 43 ...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
100465800

result:

ok 3 lines

Test #38:

score: 0
Accepted
time: 56ms
memory: 14808kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 0
771 794 313 683 425 357 614 580 102 733 159 696 814 233 808 770 433 282 810 680 477 330 542 897 867 646 724 208 182 47 166 151 462 453 198 37 821 737 493 65 721 190 703 456 23 763 428 905 574 780 505 888 620 49 311 830 637 504 290 272 117 707 185 21 865...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
640681656

result:

ok 3 lines

Test #39:

score: 0
Accepted
time: 52ms
memory: 14828kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 0
75 166 204 231 129 95 111 57 10 167 55 126 260 108 97 103 168 160 136 261 202 48 79 153 114 175 234 41 73 56 105 158 176 219 223 72 113 121 151 186 128 259 187 193 83 172 18 28 246 135 207 90 169 141 60 101 222 232 115 59 100 17 251 210 120 228 6 15 52 ...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
861869232

result:

ok 3 lines

Test #40:

score: 0
Accepted
time: 56ms
memory: 14972kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 0
6369 10587 8875 9964 5826 1051 7639 10185 5162 6808 3630 11670 10914 1285 6070 9989 245 1798 7398 8400 9515 1721 2071 9104 11026 6297 6746 11362 375 4311 4387 9116 11519 4164 9657 10373 8673 6013 11256 3836 3480 8274 8995 3670 11790 3076 7229 2611 4552 ...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
7046223616

result:

ok 3 lines

Test #41:

score: 0
Accepted
time: 58ms
memory: 14852kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 0
39219 246875 115631 209368 108496 131350 222537 66529 180440 34465 199975 231081 94272 119468 20007 134071 21934 28459 252019 45651 163486 114256 58468 34742 175404 69210 191801 178023 35190 242658 16977 101752 27135 79245 65513 13356 212284 115367 2191...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
114320986160

result:

ok 3 lines

Test #42:

score: 0
Accepted
time: 57ms
memory: 14852kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 0
339 378 1061 393 662 996 746 826 197 354 445 75 138 851 784 627 935 618 20 1035 777 801 537 335 233 1044 216 569 802 1078 114 271 1064 771 1115 729 1023 1089 846 1057 387 514 269 641 1126 498 566 865 941 708 734 959 965 778 994 626 447 1132 234 226 1124...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
71880239388

result:

ok 3 lines

Test #43:

score: 0
Accepted
time: 60ms
memory: 14780kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 0
645294 1 2 126 4 5 53 7 8 50 10 11 12 46 14 44 43 42 41 19 20 21 22 36 24 34 33 27 31 30 29 28 32 26 25 35 23 37 38 39 40 18 17 16 15 45 13 47 48 49 9 51 52 6 54 55 56 125 124 59 122 61 120 63 64 65 116 115 114 101 70 99 72 97 74 95 94 77 78 91 80 81 82...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
357984172

result:

ok 3 lines

Subtask #4:

score: 20
Accepted

Dependency #2:

100%
Accepted

Test #44:

score: 20
Accepted
time: 0ms
memory: 3688kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 425
2 1 999 5 3 4 6 8 9 7 10 11 13 15 14 12 16 17 20 21 18 19 22 23 24 25 26 28 27 29 30 31 32 35 36 37 33 34 38 39 40 41 43 45 44 42 46 50 47 48 49 51 54 53 52 55 56 59 57 58 60 61 62 63 64 65 66 69 68 67 70 71 72 73 74 75 77 76 78 79 81 80 83 82 84 88 86 8...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
3304

result:

ok 3 lines

Test #45:

score: 0
Accepted
time: 0ms
memory: 3760kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 35
998 4 996 1 999 8 9 6 5 7 10 12 15 25 27 13 16 17 18 19 20 21 22 11 14 23 26 24 29 28 30 44 46 35 34 45 36 37 38 39 40 41 42 43 31 32 47 33 48 67 53 69 51 70 54 55 56 57 58 59 60 61 62 63 64 65 66 68 50 49 71 52 95 74 92 76 96 77 78 79 80 81 82 83 84 85 8...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
9800

result:

ok 3 lines

Test #46:

score: 0
Accepted
time: 0ms
memory: 3764kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 396
2 994 5 1 998 0 7 6 8 9 10 11 14 13 12 15 17 18 16 19 25 23 24 20 21 22 26 29 27 28 30 31 32 33 34 35 37 39 38 40 41 36 42 48 43 44 45 47 46 49 50 56 54 52 55 51 57 53 58 60 63 59 61 62 64 65 66 71 67 72 69 70 73 68 74 77 75 78 81 82 79 80 76 83 84 88 86...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
5920

result:

ok 3 lines

Test #47:

score: 0
Accepted
time: 0ms
memory: 4024kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 600
1 0 2 3 4 5 6 7 8 10 9 11 12 13 14 15 16 17 18 19 21 20 27 23 25 28 24 26 22 29 30 31 33 32 34 35 36 37 38 41 39 40 42 43 44 45 46 47 52 51 48 49 50 54 53 55 56 58 57 59 63 61 60 62 65 64 67 66 68 69 71 72 70 74 73 75 76 77 79 78 80 81 82 83 84 85 87 88 ...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
2094

result:

ok 3 lines

Test #48:

score: 0
Accepted
time: 0ms
memory: 3948kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 500
1 2 0 3 6 5 4 10 8 11 7 9 12 13 14 19 15 20 18 16 17 21 22 24 23 26 25 27 29 28 30 32 31 33 34 35 38 37 39 36 40 42 41 43 44 45 46 47 48 50 49 51 54 53 52 56 57 55 58 59 60 61 62 63 64 65 66 67 69 68 70 72 71 73 76 74 78 75 77 80 79 81 82 83 84 85 86 87 ...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
2096

result:

ok 3 lines

Test #49:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 400
815 1 2 4 3 5 6 722 16 9 10 11 12 13 14 15 8 131 45 19 27 26 22 23 24 25 21 20 28 36 35 31 33 32 34 30 29 37 18 39 42 41 40 43 44 53 46 47 48 49 50 51 52 38 479 55 56 74 58 59 68 61 60 67 64 65 66 63 62 69 70 71 72 73 57 75 76 81 78 79 80 77 82 83 84 730...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
22140

result:

ok 3 lines

Test #50:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 500
179 29 27 6 4 5 3 25 17 9 15 11 12 13 14 10 16 8 18 24 20 21 22 23 19 7 26 2 28 1 819 31 59 54 53 35 36 46 38 45 40 41 42 43 44 39 37 47 48 34 50 51 52 49 58 55 56 57 33 32 60 934 62 84 76 65 66 67 72 69 70 71 68 73 74 75 64 63 81 79 80 78 82 83 89 88 87...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
12764

result:

ok 3 lines

Test #51:

score: 0
Accepted
time: 0ms
memory: 3828kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 500
855 100 35 5 4 3 7 6 34 9 10 16 12 15 14 13 11 18 17 33 23 21 22 20 24 25 26 32 29 28 30 31 27 19 8 2 36 37 39 38 41 40 99 81 45 44 61 50 49 48 47 55 54 53 52 51 56 59 58 57 60 46 75 74 66 65 64 67 73 69 70 71 72 68 63 62 80 79 78 77 76 43 91 85 84 83 86...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
10478

result:

ok 3 lines

Test #52:

score: 0
Accepted
time: 0ms
memory: 3736kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 700
40 32 2 4 3 5 17 11 10 9 8 7 15 14 13 12 16 6 24 23 22 21 20 19 18 31 30 29 28 27 26 25 1 39 34 35 36 38 37 33 0 833 46 43 44 45 42 49 48 47 85 59 52 53 58 57 56 55 54 51 62 61 60 81 64 66 65 73 70 69 68 71 72 67 80 76 75 78 77 79 74 63 82 84 83 50 247 1...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
9824

result:

ok 3 lines

Test #53:

score: 0
Accepted
time: 0ms
memory: 3768kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 999
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 ...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
0

result:

ok 3 lines

Test #54:

score: 0
Accepted
time: 0ms
memory: 3772kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 460
999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 93...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
446014

result:

ok 3 lines

Test #55:

score: 0
Accepted
time: 0ms
memory: 3732kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 530
999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 93...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
446022

result:

ok 3 lines

Test #56:

score: 0
Accepted
time: 0ms
memory: 4024kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 622
999 5 1 7 4 2 6 3 12 9 8 10 13 11 14 19 18 15 20 16 21 17 26 22 25 23 24 27 28 991 32 33 36 35 31 30 34 976 42 44 38 39 43 40 41 46 47 48 49 45 50 51 57 53 58 56 55 54 52 64 59 60 65 62 63 61 968 70 72 69 71 67 73 68 953 81 78 79 76 75 77 80 84 88 86 85 ...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
33892

result:

ok 3 lines

Test #57:

score: 0
Accepted
time: 0ms
memory: 4096kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 440
999 6 4 2 9 3 1 8 7 5 10 958 16 20 12 21 19 15 14 13 18 17 28 25 27 31 23 29 22 24 30 26 37 41 34 32 35 36 40 33 38 39 947 43 52 50 51 47 44 49 46 45 48 56 57 54 55 62 60 61 58 53 59 72 66 69 70 63 68 67 65 64 71 936 77 75 81 74 80 79 82 83 76 78 895 86 ...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
25052

result:

ok 3 lines

Test #58:

score: 0
Accepted
time: 0ms
memory: 3768kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 566
999 10 4 28 17 7 25 14 20 9 22 13 2 8 1 18 24 6 26 29 21 23 16 12 30 5 27 19 15 3 11 54 49 51 57 33 53 44 47 50 35 55 40 37 58 34 56 46 59 41 31 52 45 60 43 42 39 36 48 38 32 78 68 89 87 74 77 66 86 81 61 83 85 90 88 64 72 82 65 70 69 63 75 79 71 73 84 8...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
17916

result:

ok 3 lines

Test #59:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 409
999 32 49 25 8 44 18 29 69 1 17 40 56 36 13 2 4 58 16 57 68 30 61 12 55 39 31 50 54 41 47 19 35 23 64 59 26 3 10 14 5 27 22 63 48 53 33 52 42 38 21 24 67 28 62 7 20 51 45 11 43 70 66 34 65 15 9 60 37 46 6 718 121 100 91 141 72 98 90 134 119 126 93 140 88...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
26208

result:

ok 3 lines

Test #60:

score: 0
Accepted
time: 0ms
memory: 3764kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 479
999 1 2 3 4 997 6 993 8 988 10 985 12 981 14 15 16 979 18 973 20 968 22 965 24 25 26 27 963 29 30 31 32 33 961 35 956 37 38 39 40 954 42 948 44 45 946 47 48 49 50 944 52 938 54 932 56 927 58 59 60 61 62 925 64 919 66 914 68 909 70 71 72 907 74 903 76 899...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
150846

result:

ok 3 lines

Test #61:

score: 0
Accepted
time: 0ms
memory: 4076kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 531
999 2 1 4 3 5 6 7 8 996 10 11 987 14 13 15 16 18 17 19 20 21 22 984 25 24 26 27 29 28 981 31 32 976 35 34 37 36 39 38 41 40 973 44 43 45 46 970 49 48 51 50 967 53 54 958 56 57 953 60 59 61 62 950 64 65 945 68 67 69 70 72 71 74 73 75 76 942 78 79 935 82 8...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
92034

result:

ok 3 lines

Test #62:

score: 0
Accepted
time: 0ms
memory: 4080kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 475
999 2 4 5 3 1 978 9 7 8 10 11 13 12 15 14 16 972 18 22 19 21 20 956 28 27 26 24 25 935 32 31 34 30 33 914 40 36 37 39 38 44 41 43 45 42 46 48 49 50 47 53 51 55 54 52 908 57 58 60 59 61 882 66 63 64 67 65 856 73 72 70 71 69 78 77 74 75 76 80 83 81 82 79 8...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
41800

result:

ok 3 lines

Test #63:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000 780
999 48 37 60 90 17 76 26 54 19 71 27 88 53 33 45 2 84 1 95 70 82 81 22 93 7 57 51 23 14 72 78 5 59 83 15 12 18 35 77 97 10 9 98 52 31 85 89 4 6 39 69 41 30 34 94 25 28 96 3 47 36 91 58 16 24 66 100 86 73 87 40 38 99 43 46 79 50 63 13 11 75 21 20 32 56 92...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
33388

result:

ok 3 lines

Subtask #5:

score: 30
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #64:

score: 30
Accepted
time: 56ms
memory: 15036kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 93782
2 999997 999998 4 896 897 7 6 8 10 9 12 11 13 16 14 15 17 18 21 19 20 22 23 25 24 26 28 27 29 31 30 32 33 34 38 35 37 36 39 41 40 42 45 43 46 44 47 49 50 48 51 52 53 54 55 58 56 57 59 60 61 62 63 64 65 66 67 68 69 70 71 73 74 76 75 72 77 80 81 79 78...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
9339550

result:

ok 3 lines

Test #65:

score: 0
Accepted
time: 61ms
memory: 14748kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 886747
0 999999 28872 28873 205 5 6 7 8 10 13 9 11 14 12 15 19 16 17 18 21 20 22 24 27 26 23 25 28 32 29 30 31 33 35 34 36 39 40 42 38 37 41 43 46 45 44 47 50 49 48 51 52 53 54 60 56 58 59 57 55 61 63 62 64 65 66 68 67 69 70 73 72 71 74 75 76 77 78 79 82 ...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
7226436

result:

ok 3 lines

Test #66:

score: 0
Accepted
time: 55ms
memory: 14832kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 541246
297 999882 999593 257 999604 999626 222 102 397 82 999842 999783 374 999990 460 250 279 999849 289 999861 3 195 999779 45 999824 405 299 348 267 999906 418 314 999999 385 999766 149 221 999597 367 242 388 999788 999609 477 999502 22 999523 999664 9...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
1470760606

result:

ok 3 lines

Test #67:

score: 0
Accepted
time: 61ms
memory: 14836kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 421645
474 77 999569 999979 268 240 999597 473 20 999577 95 263 25 999639 79 999950 999961 999588 446 999556 999937 999716 369 390 457 192 406 999526 999539 478 248 999608 203 437 999810 999904 999973 350 433 156 999851 395 289 223 372 999807 999969 154 3...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
2408891936

result:

ok 3 lines

Test #68:

score: 0
Accepted
time: 3ms
memory: 4404kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
100000 1821
93 99914 99970 99989 79 34 36 99936 50 99937 40 99907 92 99918 26 99955 99981 43 99935 13 17 81 99909 84 46 99968 99916 99980 99947 99949 99975 80 38 99951 8 99927 62 99913 65 76 99971 27 23 77 45 73 99946 99994 69 99988 72 90 2 33 99963 1 99993 24 99...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
19193502

result:

ok 3 lines

Test #69:

score: 0
Accepted
time: 3ms
memory: 5980kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
100000 31661
24 99983 28 99945 99946 99948 2 99997 99988 39 46 10 12 99958 52 20 56 38 99955 99990 99969 13 48 99961 57 99966 99967 99986 59 99951 99943 26 99973 30 36 99985 99952 50 99964 99991 53 51 5 99970 23 99963 99998 99971 7 15 99994 99959 21 34 29 1 58 45...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
18687632

result:

ok 3 lines

Test #70:

score: 0
Accepted
time: 3ms
memory: 4392kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
100000 96120
99997 22 99986 99977 25 99989 9 15 29 1 99971 11 99982 6 19 99993 99985 99976 99988 99975 99998 8 20 99981 23 99970 99990 7 99983 99978 372 374 48 386 43 390 391 36 396 41 57 371 42 376 393 45 381 385 380 59 51 384 34 389 31 397 30 379 38 55 62 61 60...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
8518604

result:

ok 3 lines

Test #71:

score: 0
Accepted
time: 3ms
memory: 4684kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
100000 7736
99995 99994 99996 2 3 4 3113 3111 3110 3108 3109 11 16 13 15 29 30 34 18 19 20 21 22 23 24 25 26 27 28 32 33 17 31 12 14 38 46 41 45 47 35 42 48 39 37 40 36 44 43 49 135 51 54 134 50 139 56 57 58 59 61 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 7...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
1845260

result:

ok 3 lines

Test #72:

score: 0
Accepted
time: 7ms
memory: 6268kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
100000 71850
99997 0 2 3 241 5 239 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 ...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
528976

result:

ok 3 lines

Test #73:

score: 0
Accepted
time: 7ms
memory: 4352kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
100000 14129
664 4676 734 98552 2733 1814 2626 4884 98685 4677 98133 96752 479 4154 4978 99587 98866 95997 97528 95768 4565 2220 531 393 807 717 3749 3615 2542 95656 3933 95910 4810 96222 98535 1533 96003 99499 3600 99267 99663 4784 503 19 4376 96404 3019 95597 9...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
1136066236

result:

ok 3 lines

Test #74:

score: 0
Accepted
time: 61ms
memory: 14824kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 600000
0 1 6 2 3 4 5 7 8 10 12 11 9 13 14 15 17 16 18 21 20 22 19 23 24 25 26 28 27 29 30 31 32 34 33 35 36 37 38 39 40 41 42 44 43 45 47 48 46 49 50 51 53 55 52 54 56 57 59 58 60 61 63 62 65 64 67 72 69 68 70 71 66 73 75 74 76 77 78 79 80 81 83 82 85 84 ...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
2121418

result:

ok 3 lines

Test #75:

score: 0
Accepted
time: 57ms
memory: 14968kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 500000
2 0 1 3 4 5 6 8 7 10 9 12 11 13 14 15 16 17 18 19 20 21 26 23 22 25 24 27 31 30 29 28 32 33 35 34 36 37 38 40 39 41 42 43 44 45 46 47 48 49 50 51 52 53 54 56 55 58 57 59 60 61 63 64 62 66 65 68 67 69 70 71 72 73 74 75 76 77 80 78 82 81 83 79 84 85 ...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
2122378

result:

ok 3 lines

Test #76:

score: 0
Accepted
time: 56ms
memory: 14800kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 400000
873949 31 30 3 4 27 26 25 24 23 22 14 12 13 11 15 21 20 19 18 17 16 10 9 8 7 6 5 28 29 2 101 32 33 34 35 96 37 38 39 54 53 52 43 50 45 48 47 46 49 44 51 42 41 40 55 56 80 79 59 77 61 62 74 73 72 66 67 68 69 70 71 65 64 63 75 76 60 78 58 57 81 92 91...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
1701695278

result:

ok 3 lines

Test #77:

score: 0
Accepted
time: 58ms
memory: 14732kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 500000
629710 1 189 3 187 186 6 7 119 9 59 11 42 13 40 15 38 17 36 35 20 33 22 23 30 29 26 27 28 25 24 31 32 21 34 19 18 37 16 39 14 41 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 12 58 10 60 61 62 88 87 86 66 67 68 82 81 71 77 76 74 75 73 72 78 79 80 70...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
686542538

result:

ok 3 lines

Test #78:

score: 0
Accepted
time: 63ms
memory: 14756kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 500000
788624 83614 81427 349 14 5 6 9 8 7 13 12 11 10 4 166 17 16 165 22 20 21 19 77 33 30 26 27 28 29 25 31 32 24 44 41 39 37 38 36 40 35 43 42 34 45 46 49 48 47 76 59 54 53 52 56 55 57 58 51 67 61 64 63 62 66 65 60 68 75 71 70 74 73 72 69 50 23 90 82 8...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
24375964

result:

ok 3 lines

Test #79:

score: 0
Accepted
time: 60ms
memory: 14800kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 700000
67279 19313 2889 2695 2374 242 46 41 8 10 9 40 19 14 13 15 16 18 17 12 27 26 22 23 25 24 21 20 35 30 29 34 32 33 31 28 36 39 38 37 11 7 42 45 44 43 6 47 49 48 144 119 69 54 53 56 55 60 58 59 57 63 62 61 68 67 66 65 64 52 118 107 83 73 75 74 76 82 8...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
23559310

result:

ok 3 lines

Test #80:

score: 0
Accepted
time: 51ms
memory: 14876kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 999999
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 ...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
0

result:

ok 3 lines

Test #81:

score: 0
Accepted
time: 59ms
memory: 14776kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 460000
999999 999998 999997 999996 999995 999994 999993 999992 999991 999990 999989 999988 999987 999986 999985 999984 999983 999982 999981 999980 999979 999978 999977 999976 999975 999974 999973 999972 999971 999970 999969 999968 999967 999966 999965 999...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
444446015554

result:

ok 3 lines

Test #82:

score: 0
Accepted
time: 62ms
memory: 14804kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 530000
999999 999998 999997 999996 999995 999994 999993 999992 999991 999990 999989 999988 999987 999986 999985 999984 999983 999982 999981 999980 999979 999978 999977 999976 999975 999974 999973 999972 999971 999970 999969 999968 999967 999966 999965 999...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
444446025552

result:

ok 3 lines

Test #83:

score: 0
Accepted
time: 61ms
memory: 14836kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 501250
999999 3 6 7 4 2 5 1 999963 9 15 12 14 13 10 11 17 16 19 21 22 20 18 27 23 26 29 24 28 25 32 34 36 33 35 31 30 999955 38 44 39 40 43 41 42 999919 50 49 51 52 46 47 48 53 58 56 59 55 57 54 999911 63 67 62 61 64 65 66 72 73 68 69 74 70 71 75 80 81 78...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
29808765966

result:

ok 3 lines

Test #84:

score: 0
Accepted
time: 63ms
memory: 14756kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 499336
999999 6 10 8 4 9 7 5 1 3 2 999958 17 12 14 13 16 18 20 19 21 15 999917 28 32 25 31 23 29 30 27 24 26 999886 38 43 40 35 36 34 41 39 42 37 999845 50 46 48 54 51 53 45 47 49 52 999794 58 65 63 61 57 64 59 60 62 56 999753 67 73 76 69 68 74 75 72 70 7...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
21310649830

result:

ok 3 lines

Test #85:

score: 0
Accepted
time: 64ms
memory: 14824kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 501874
999999 16 3 10 7 17 29 14 12 30 27 23 13 25 19 8 28 15 2 26 21 11 24 4 18 22 6 1 9 20 5 999938 49 61 33 42 39 35 36 41 47 53 57 52 40 32 60 48 51 37 56 45 59 38 43 54 44 46 34 50 55 58 80 62 65 89 63 70 91 69 68 81 90 72 67 84 83 82 79 71 77 76 73 ...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
7278760044

result:

ok 3 lines

Test #86:

score: 0
Accepted
time: 64ms
memory: 14924kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 496562
999999 26 99 40 61 65 13 71 95 62 16 66 55 41 2 15 85 74 32 23 17 27 18 68 42 59 97 83 67 51 94 72 24 70 53 14 5 35 49 50 39 21 8 11 81 56 79 33 7 45 46 84 22 80 58 92 34 29 4 73 47 93 30 98 64 28 1 87 91 38 60 20 88 77 44 52 96 3 9 12 54 76 100 48...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
2256415838

result:

ok 3 lines

Test #87:

score: 0
Accepted
time: 60ms
memory: 14728kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 500200
999999 1 2 3 4 5 999997 7 8 9 999995 11 999990 13 14 15 999988 17 18 19 20 999986 22 999981 24 25 26 999979 28 999974 30 31 32 33 999972 35 36 37 38 999970 40 41 42 43 44 999968 46 47 999966 49 50 51 52 999964 54 55 999962 57 58 59 60 61 999960 63 ...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
153843096512

result:

ok 3 lines

Test #88:

score: 0
Accepted
time: 66ms
memory: 14820kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 500915
999999 1 2 999988 4 5 999983 7 8 999974 11 10 13 12 14 15 16 17 999971 19 20 22 21 999968 24 25 999963 28 27 999956 30 31 32 33 35 34 37 36 38 39 999953 42 41 44 43 45 46 47 48 999950 50 51 999945 54 53 999940 56 57 59 58 999937 61 62 64 63 65 66 6...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
90856543768

result:

ok 3 lines

Test #89:

score: 0
Accepted
time: 62ms
memory: 14840kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 498993
999999 1 4 3 2 5 6 7 9 8 10 15 13 14 12 11 18 17 20 16 19 21 23 25 24 22 999993 31 28 29 27 30 35 32 36 33 34 40 39 37 38 41 45 46 44 43 42 999987 49 50 48 51 52 999971 58 57 54 56 55 62 61 59 60 63 999965 66 69 65 68 67 71 74 73 72 70 78 79 77 76 ...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
40690348238

result:

ok 3 lines

Test #90:

score: 0
Accepted
time: 59ms
memory: 14964kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 491075
999999 61 117 270 285 185 72 243 217 256 14 169 13 38 225 154 296 251 247 32 137 302 308 35 73 250 189 36 54 127 59 79 280 131 232 268 80 277 68 152 313 254 176 167 182 75 25 97 231 86 310 266 297 119 194 91 94 289 244 248 245 294 49 180 269 109 27...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
798745986

result:

ok 3 lines

Test #91:

score: 0
Accepted
time: 63ms
memory: 15036kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 528817
999999 3 692 244 834 893 995 585 686 9 952 847 679 970 687 561 136 576 156 996 745 165 824 200 203 29 409 301 933 531 240 936 37 874 236 162 413 728 784 111 153 360 89 756 414 373 740 621 345 369 547 120 470 619 494 123 722 762 227 674 652 727 878 ...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
558049748

result:

ok 3 lines

Test #92:

score: 0
Accepted
time: 59ms
memory: 14788kb

input:

f58fb993-f209-43d7-9391-c46c61f180b9
1000000 505985
999999 4492 7205 1150 5792 1573 4243 3797 6195 8752 5389 7988 2676 4110 3151 1507 3596 2437 5288 24 5150 8542 1973 9945 8272 1022 3160 2306 5424 3836 803 9934 6914 1931 8284 3910 5377 8606 366 4712 8727 6784 6173 6292 4900 873 5186 2577 4518 8712 8...

output:

9048298f-efa0-4f8a-9322-0c8855609a66
OK
3320522632

result:

ok 3 lines

Extra Test:

score: 0
Extra Test Passed