QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#186402#6352. SPPPSPSS.ucup-team859TL 989ms15576kbC++175.9kb2023-09-23 19:23:172023-09-23 19:23:17

Judging History

你现在查看的是最新测评结果

  • [2023-09-23 19:23:17]
  • 评测
  • 测评结果:TL
  • 用时:989ms
  • 内存:15576kb
  • [2023-09-23 19:23:17]
  • 提交

answer

#include <bits/stdc++.h>

#define lsb(x) (x & (-x))

using ull = unsigned long long;
using ll = long long;

using namespace std;

inline bool Good(const vector<int>& v) {
    for (int i = 1; i < (int)v.size(); i++) {
        if (v[i] != i) {
            return false;
        }
    }
    return true;
}

inline void Sort(vector<int>& v, int l, int r) {
    sort(v.begin() + l, v.begin() + r + 1);
}

void Small(vector<int> p, int n, ostream& cout) {
    if (Good(p)) {
        cout << "." << endl;
        exit(0);
    }

    auto Check = [&](int len) -> pair<bool, int> {
        if (len + len + 1 > n) return {true, -1};

        auto temp = p;
        Sort(temp, 1, len);
        Sort(temp, n - len, n);
        if (Good(temp)) {
            return {true, 0};
        }

        temp = p;
        Sort(temp, 1, len + 1);
        Sort(temp, n - len + 1, n);
        if (Good(temp)) {
            return {true, 1};
        }

        return {false, -1};
    };

    int result = -1;
    for (int step = 1 << 20; step; step >>= 1) {
        if (!Check(result + step).first) {
            result += step;
        }
    }

    result++;
    auto curr = Check(result);

    if (result + result + 1 <= n && curr.first) {
        string str;
        for (int i = 1; i <= result + 1; i++) {
            if ((result % 2 == 1 && curr.second == 0) || (result % 2 == 0 && curr.second == 1)) {
                str += (i % 2 == 1 ? 'P' : 'S');
            } else {
                str += (i % 2 == 1 ? 'S' : 'P');
            }
        }
        cout << str << "." << endl;
        exit(0);
    }
}

int Big(vector<int> p, int n, bool isPref) {
    if (!isPref) {
        for (int i = 1; i <= n; i++) {
            p[i] = n - p[i] + 1;
        }
        reverse(p.begin() + 1, p.end());
    }

    int len = 1;
    while (len + (len + 1) <= n) {
        len++;
    }

    if (len % 2) {
        Sort(p, 1, len);
        Sort(p, n - len, n);
    } else {
        Sort(p, 1, len + 1);
        Sort(p, n - len + 1, n);
    }

    int pref = 0;
    while (p[pref + 1] == pref + 1) {
        pref++;
    }

    int suff = 0;
    while (p[n - suff] == n - suff) {
        suff++;
    }

    if (pref + suff >= n) {
        return len + 1;
    }

    pair<int, int> half1 = {pref + 1, pref + 1};
    while (p[half1.second] < p[half1.second + 1]) {
        half1.second++;
    }

    pair<int, int> half2 = {n - suff, n - suff}; 
    while (p[half2.first - 1] < p[half2.first]) {
        half2.first--;
    }

    auto temp = p;
    
    len++;
    while (true) {
        len++;
        assert (len <= n);

        // for (int i = 1; i <= n; i++) {
        //     cerr << temp[i] << " ";
        // }
        // cerr << "\n LEN = " << len << "\n";
        // cerr << pref << " (" << half1.first << ", " << half1.second << ")\n";
        // cerr << suff << " (" << half2.first << ", " << half2.second << ")\n";

        if (len & 1) {
            int l = half1.first;
            int r = half2.first;
            int maxr = half2.first + (len - pref - (half1.second - half1.first + 1));
            // cerr << "MAXR: " << maxr << "\n";

            while (l <= half1.second || r < maxr) {
                // cerr << "L, R, PREF --> " << l << " " << r << " " << pref << "\n";
                if (p[l] < p[r]) {
                    if (l <= half1.second && p[l] == pref + 1) {
                        half1.first++;
                        l++;
                    } else {
                        break;
                    }
                } else {
                    if (r < maxr && p[r] == pref + 1) {
                        half2.first++;
                        r++;
                    } else {
                        break;
                    }
                }
                pref++;
            }

            #ifdef HOME
                Sort(temp, 1, len);
            #endif
        } else {
            int l = half1.second;
            int r = half2.second;
            int minl = half1.second - (len - suff - (half2.second - half2.first + 1));

            while (r >= half2.first || l > minl) {
                if (p[l] > p[r]) {
                    if (l > minl && p[l] == n - suff) {
                        half1.second--;
                        l--;
                    } else {
                        break;
                    }
                } else {
                    if (r >= half2.first && p[r] == n - suff) {
                        half2.second--;
                        r--;
                    } else {
                        break;
                    }
                }
                suff++;
            }

            #ifdef HOME
                Sort(temp, n - len + 1, n);
            #endif
        }

        if (pref + suff >= n) {
            #ifdef HOME
                cerr << "!!!";
                for (auto itr : temp) {
                    cerr << itr << " ";
                }
                cerr << "\n";
            #endif
            return len;
        }
    }
}

int main() {
#ifdef HOME
    ifstream cin("input.in");
    ofstream cout("output.out");
#endif
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int n;
    cin >> n;

    vector<int> p(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> p[i];
    }

    Small(p, n, cout);

    auto res1 = Big(p, n, true);
    auto res2 = Big(p, n, false);
    string str;

    if (res1 < res2) {
        for (int i = 0; i < res1; i++) {
            if (i % 2 == 0) {
                str += 'P';
            } else {
                str += 'S';
            }
        }
    } else {
        for (int i = 0; i < res2; i++) {
            if (i % 2 == 1) {
                str += 'P';
            } else {
                str += 'S';
            }
        }
    }

    cout << str << ".";

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3656kb

input:

3
1 2 3

output:

.

result:

ok OK 0 operations

Test #2:

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

input:

2
2 1

output:

SP.

result:

ok OK 2 operations

Test #3:

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

input:

9
3 2 4 1 5 6 7 9 8

output:

SPSP.

result:

ok OK 4 operations

Test #4:

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

input:

10
2 9 5 7 10 6 3 1 8 4

output:

SPSPSPSP.

result:

ok OK 8 operations

Test #5:

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

input:

13
9 8 5 4 3 2 1 13 12 11 10 7 6

output:

PSPSPSPS.

result:

ok OK 8 operations

Test #6:

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

input:

20
17 6 15 14 4 10 18 7 13 8 2 12 1 19 20 3 11 16 5 9

output:

SPSPSPSPSPSPSP.

result:

ok OK 14 operations

Test #7:

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

input:

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

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPS.

result:

ok OK 57 operations

Test #8:

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

input:

1000
668 554 210 852 617 846 561 95 341 893 276 224 287 1000 356 362 897 205 369 654 181 590 339 377 346 557 382 593 55 62 126 899 49 509 977 585 614 232 865 800 790 292 219 957 379 914 946 246 294 403 940 517 768 623 376 624 331 353 887 626 424 449 115 628 569 809 956 942 300 894 61 936 678 779 549...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 523 operations

Test #9:

score: 0
Accepted
time: 73ms
memory: 4536kb

input:

100000
30619 15529 4854 9258 46894 29948 59533 56945 19473 7608 42291 95532 80537 83105 70434 68130 89221 96367 26768 43837 54765 52814 88446 14950 63224 63479 11957 41446 38702 8466 85556 57724 50097 29014 17961 65178 88627 96815 80115 79096 19625 2979 51033 68224 48649 96250 3406 96433 22584 79610...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 50224 operations

Test #10:

score: 0
Accepted
time: 974ms
memory: 14960kb

input:

999999
1578 253230 300479 227250 673195 324827 649281 5836 935739 543519 370574 305888 969960 550993 463132 799873 408104 207874 140152 331798 698935 749195 181667 828624 142806 789266 207545 870039 88700 189925 952818 455047 184020 276480 107352 733977 864792 660399 680663 667372 602838 139419 6373...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500707 operations

Test #11:

score: 0
Accepted
time: 980ms
memory: 15016kb

input:

1000000
498323 782531 234963 338622 390785 762253 966967 650745 444031 637738 473839 375864 760158 925355 805145 658434 838301 951908 714792 187771 333492 834483 290468 35807 254116 31487 26159 884256 313908 818120 709500 119492 905109 843904 538404 58932 917890 581026 96134 638691 37548 257661 5970...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500708 operations

Test #12:

score: 0
Accepted
time: 981ms
memory: 15096kb

input:

999999
380307 675757 926537 909176 259398 767547 838631 229565 814257 719010 465888 449344 456782 751637 748757 577374 757939 757260 82870 301760 266209 725256 913345 539986 247478 544197 565340 329703 744214 414574 459491 771016 89606 959461 978510 867975 914868 284295 827692 407590 902000 767952 4...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500707 operations

Test #13:

score: 0
Accepted
time: 979ms
memory: 14928kb

input:

1000000
172470 877546 84214 400887 576185 285780 444366 860147 679572 546507 239729 179884 641568 611945 977189 861170 861757 693499 814472 702031 255178 541730 195701 957000 328294 18206 94292 127407 263007 99562 518088 991416 202210 484246 231421 576703 773500 77020 699579 530140 726362 266475 626...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500708 operations

Test #14:

score: 0
Accepted
time: 985ms
memory: 15016kb

input:

999999
677199 527402 260278 378779 196676 500505 577396 576982 652450 128125 354892 561405 186110 561334 565676 844764 382506 305379 925068 208078 261826 38458 770208 575208 532632 190199 485712 280726 926898 155492 38167 609603 546994 379870 692140 671912 601918 200311 856148 602748 462185 21114 95...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500708 operations

Test #15:

score: 0
Accepted
time: 989ms
memory: 15016kb

input:

1000000
658205 878240 84096 393775 557729 717785 892649 547846 422807 378161 798924 644602 145033 110712 138504 956461 341742 765625 673610 342509 423873 129182 392707 32579 60070 466722 986494 956165 949960 516080 98315 228617 987897 101869 510240 75032 104837 57653 90089 361011 655034 87399 917195...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500708 operations

Test #16:

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

input:

999999
560006 626515 58664 838744 331899 741740 279578 478999 629913 502367 224087 372784 152865 636238 570022 4907 690160 662704 313958 835987 577073 39974 554116 608506 928397 237166 371458 131297 716305 127503 368310 291092 204051 919187 30124 574809 66145 667573 552009 969718 524326 38216 31718 ...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500707 operations

Test #17:

score: 0
Accepted
time: 980ms
memory: 14960kb

input:

1000000
170718 784810 674417 159793 189317 115530 524872 124667 363570 32215 429929 857870 786504 55147 260225 923095 230428 883443 620592 493326 858668 898580 49426 842887 324927 561607 693452 710499 436481 482595 832325 617114 614693 640199 419510 663725 273513 263053 841014 263727 372656 198411 3...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500707 operations

Test #18:

score: 0
Accepted
time: 977ms
memory: 14960kb

input:

999999
916422 888632 300041 567034 646896 723598 645143 497821 300002 219825 105896 178442 118885 995990 840287 12749 420928 906993 504111 435638 296923 141718 149413 62682 648366 511386 626431 2995 841547 689727 493661 425018 231433 521401 883925 802229 422860 288294 393191 26220 36803 46033 286602...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500707 operations

Test #19:

score: 0
Accepted
time: 972ms
memory: 15012kb

input:

1000000
46874 765821 886525 977705 548127 465831 540580 146805 506375 466370 168997 91537 183504 584871 197569 524930 989026 923955 624733 821306 59866 341573 53478 890358 290792 45795 848498 441703 988088 170699 262407 669394 988604 839083 947414 387735 667389 442038 238162 829673 242428 907422 143...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500708 operations

Test #20:

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

input:

45
41 43 34 18 38 8 28 3 17 16 32 37 7 1 4 9 13 24 2 36 22 35 40 45 31 11 19 12 21 26 29 20 42 33 30 23 27 15 5 6 39 14 25 44 10

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPS.

result:

ok OK 27 operations

Test #21:

score: 0
Accepted
time: 252ms
memory: 15380kb

input:

999997
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 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

PSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPS...

result:

ok OK 499999 operations

Test #22:

score: 0
Accepted
time: 230ms
memory: 15500kb

input:

999987
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 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 499994 operations

Test #23:

score: 0
Accepted
time: 182ms
memory: 14912kb

input:

1000000
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 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500001 operations

Test #24:

score: 0
Accepted
time: 40ms
memory: 11432kb

input:

1000000
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 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

.

result:

ok OK 0 operations

Test #25:

score: 0
Accepted
time: 184ms
memory: 14956kb

input:

1000000
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 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500001 operations

Test #26:

score: 0
Accepted
time: 180ms
memory: 14960kb

input:

1000000
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 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500005 operations

Test #27:

score: 0
Accepted
time: 184ms
memory: 14908kb

input:

1000000
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 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500008 operations

Test #28:

score: 0
Accepted
time: 173ms
memory: 15004kb

input:

1000000
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 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500023 operations

Test #29:

score: 0
Accepted
time: 224ms
memory: 14908kb

input:

1000000
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 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500224 operations

Test #30:

score: 0
Accepted
time: 887ms
memory: 15068kb

input:

1000000
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 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500672 operations

Test #31:

score: 0
Accepted
time: 43ms
memory: 11364kb

input:

999999
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 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

.

result:

ok OK 0 operations

Test #32:

score: 0
Accepted
time: 179ms
memory: 14988kb

input:

999999
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 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500005 operations

Test #33:

score: 0
Accepted
time: 173ms
memory: 14912kb

input:

999999
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 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500007 operations

Test #34:

score: 0
Accepted
time: 185ms
memory: 15096kb

input:

999999
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 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500022 operations

Test #35:

score: 0
Accepted
time: 228ms
memory: 14920kb

input:

999999
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 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500223 operations

Test #36:

score: 0
Accepted
time: 882ms
memory: 15020kb

input:

999999
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 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500670 operations

Test #37:

score: 0
Accepted
time: 931ms
memory: 15576kb

input:

1000000
85269 232632 182463 141993 164612 185571 196834 27556 17144 41461 114002 223286 199965 104924 74257 11534 186869 93956 52714 49057 66612 84626 209949 70888 46558 179874 35456 159824 197676 205799 91114 167353 56211 100660 152256 9430 118528 232533 161318 5269 118930 15106 47536 88328 58944 6...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 235314 operations

Test #38:

score: 0
Accepted
time: 880ms
memory: 15340kb

input:

1000000
96642 24932 138614 159073 210308 214096 62029 162505 29524 10221 179795 93890 122182 113556 153174 26998 213378 32623 49137 45538 36364 72485 49459 151422 60864 25672 205141 144863 226840 227484 35755 139439 211425 68185 9193 72790 201702 110595 59017 74109 137356 58563 87208 144275 138239 1...

output:

PSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPS...

result:

ok OK 235314 operations

Test #39:

score: 0
Accepted
time: 966ms
memory: 15000kb

input:

1000000
488727 426787 41476 18303 152740 280483 151820 20439 231296 248933 25665 194977 359736 251353 494229 58533 209539 64788 307381 415428 81302 318942 52921 450027 161512 307783 479728 332292 491479 118078 40988 365789 13780 380644 36344 428410 118369 202243 407866 286384 188600 312831 102906 37...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500001 operations

Test #40:

score: 0
Accepted
time: 970ms
memory: 14920kb

input:

1000000
334819 52725 117665 271110 25265 425908 422442 316644 211766 240110 156046 192692 440325 144648 60930 339780 189940 450040 255346 449859 34356 415080 427399 51031 438318 339684 445088 270339 130487 39687 497571 253421 40508 454987 314666 305585 410767 347721 341238 164648 434537 18879 327014...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500001 operations

Test #41:

score: 0
Accepted
time: 515ms
memory: 15320kb

input:

1000000
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 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 222333 operations

Test #42:

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

input:

1000000
69926 66346 53127 49611 51808 15323 1662 17965 64803 12740 39135 17879 63554 11678 25924 8550 62668 86775 67631 17130 95019 58126 37753 8671 71567 28838 99842 81371 42211 10138 11092 85937 11778 43056 95400 28761 90723 66345 68338 54552 88285 66621 88205 52183 16456 99867 54204 43264 42151 9...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 500667 operations

Test #43:

score: 0
Accepted
time: 927ms
memory: 15292kb

input:

999999
113883 1479 137441 182288 87293 53557 200692 186438 48482 98467 125219 173811 10205 33462 116418 2950 35532 85577 212049 198984 3811 27434 14699 115652 219705 68486 163618 202552 136274 139143 55116 194934 219242 95243 230318 166789 4837 183128 102 183772 79990 31009 173826 22828 193641 86533...

output:

SPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSP...

result:

ok OK 235314 operations

Test #44:

score: 0
Accepted
time: 878ms
memory: 15536kb

input:

999999
62901 35715 133527 162199 66245 219202 27943 24162 35408 227837 7214 169972 186885 189493 94865 219521 156516 100914 162168 149048 69857 196348 214357 103440 125144 68854 170190 141644 226852 221438 175614 117289 172568 130317 4355 32887 30202 72304 205461 116455 26519 221271 45957 191138 163...

output:

PSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPS...

result:

ok OK 235314 operations

Test #45:

score: -100
Time Limit Exceeded

input:

999999
202465 233679 342410 231389 159364 117382 24423 126719 260105 221047 150381 87993 233732 455257 31140 165519 463956 17223 281457 317060 36298 198189 32063 168156 186664 281805 461445 403833 92000 179294 261286 203578 148693 364455 477401 391581 436488 427071 331101 363849 168853 69197 42272 8...

output:


result: