QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#125025#2789. Sortingsomethingnew#100 ✓336ms18948kbC++203.6kb2023-07-15 22:53:242024-07-04 00:42:37

Judging History

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

  • [2024-07-04 00:42:37]
  • 评测
  • 测评结果:100
  • 用时:336ms
  • 内存:18948kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-15 22:53:24]
  • 提交

answer

//  ↘ ⬇ ⬇ ⬇ ⬇ ⬇ ↙
//  ➡ @roadfromroi ⬅
//  ↗ ⬆ ⬆ ⬆ ⬆ ⬆ ↖
#include <iostream>
#include "vector"
#include "algorithm"
#include "numeric"
#include "climits"
#include "iomanip"
#include "bitset"
#include "cmath"
#include "map"
#include "deque"
#include "array"
#include "set"
#include "sorting.h"
#include "queue"
#define all(x) x.begin(), x.end()
using namespace std;
vector<pair<int, int>> numswp(vector<int> a) {
    priority_queue<int> beba;
    for (int i = 0; i < a.size(); ++i) {
        if (a[i] != i)
            beba.push(i);
    }
    vector<pair<int, int>> swps;
    while (!beba.empty()) {
        int v = beba.top();
        int u = a[v];
        //cout << v << ' ' << u << ' ' << a[v] << ' ' << a[u] << endl;
        if (v != u) {
            swps.push_back({a[v], a[u]});
            swap(a[v], a[u]);
        } else {
            beba.pop();
        }
    }
    if (!is_sorted(all(a))) exit(1);
    return swps;
}
bool lstrg(vector<int> a, int x) {
    priority_queue<int> beba;
    for (int i = 0; i < a.size(); ++i) {
        if (a[i] != i)
            beba.push(i);
    }
    while (!beba.empty()) {
        int v = beba.top();
        int u = a[v];
        //cout << v << ' ' << u << ' ' << a[v] << ' ' << a[u] << endl;
        if (v != u) {
            x--;
            if (x < 0)
                return 0;
            swap(a[v], a[u]);
        } else {
            beba.pop();
        }
    }
    return 1;
}

int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
    //cout << N << endl;
    vector<int> astrt(N);
    for (int i = 0; i < N; ++i) {
        astrt[i] = S[i];
    }
    int l = -1, r = M;
    while (l + 1 < r) {
        int m = l + r >> 1;
        vector<int> beba = astrt;
        for (int i = 0; i < m; ++i) {
            swap(beba[X[i]], beba[Y[i]]);
        }
        if (lstrg(beba, m))
            r = m;
        else
            l = m;
    }
    int m = r;
    //cout << r << endl;
    vector<int> beba = astrt;
    for (int i = 0; i < m; ++i) {
        swap(beba[X[i]], beba[Y[i]]);
    }
    vector<pair<int, int>> swp = numswp(beba);
    if (swp.size() > r)
        exit(2);
    //cout << r << endl;
    beba = astrt;
    vector<int> ind(N);
    for (int i = 0; i < N; ++i) {
        ind[beba[i]] = i;
    }
    for (int i = 0; i < swp.size(); ++i) {
        swap(ind[beba[X[i]]], ind[beba[Y[i]]]);
        swap(beba[X[i]], beba[Y[i]]);
        P[i] = ind[swp[i].first];
        Q[i] = ind[swp[i].second];
        swap(beba[P[i]], beba[Q[i]]);
        swap(ind[swp[i].first], ind[swp[i].second]);
    }
    for (int i = swp.size(); i < r; ++i) {
        swap(ind[beba[X[i]]], ind[beba[Y[i]]]);
        swap(beba[X[i]], beba[Y[i]]);
        P[i] = 0;
        Q[i] = 0;
    }
    if (!is_sorted(all(beba)))
        exit(1);
    return r;
}
/*
static inline int _readInt() {
    int x;
    cin >> x;
    return x;
}


int main()
{
    int N, M;
    N = _readInt();
    int *S = (int*)malloc(sizeof(int) * (unsigned int)N);
    for (int i = 0; i < N; ++i)
        S[i] = _readInt();
    M = _readInt();
    int *X = (int*)malloc(sizeof(int) * (unsigned int)M), *Y = (int*)malloc(sizeof(int) * (unsigned int)M);
    for (int i = 0; i < M; ++i) {
        X[i] = _readInt();
        Y[i] = _readInt();
    }
    int *P = (int*)malloc(sizeof(int) * (unsigned int)M), *Q = (int*)malloc(sizeof(int) * (unsigned int)M);
    int ans = findSwapPairs(N, S, M, X, Y, P, Q);
    printf("%d\n", ans);
    for (int i = 0; i < ans; ++i)
        printf("%d %d\n", P[i], Q[i]);
    return 0;
}

*/

詳細信息

Subtask #1:

score: 8
Accepted

Test #1:

score: 8
Accepted
time: 0ms
memory: 4016kb

input:

1
0
1
0 0

output:

0

result:

ok correct

Test #2:

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

input:

2
0 1
4
0 0
0 0
0 0
0 0

output:

0

result:

ok correct

Test #3:

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

input:

2
1 0
4
0 0
0 0
0 0
0 0

output:

1
1 0

result:

ok correct

Test #4:

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

input:

3
1 0 2
9
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0

output:

1
1 0

result:

ok correct

Test #5:

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

input:

4
3 2 0 1
16
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0

output:

3
3 1
3 2
3 0

result:

ok correct

Test #6:

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

input:

5
1 4 2 3 0
25
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0

output:

2
4 0
4 1

result:

ok correct

Test #7:

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

input:

5
4 2 1 0 3
25
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0

output:

3
4 3
4 0
2 1

result:

ok correct

Subtask #2:

score: 12
Accepted

Test #8:

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

input:

1
0
30
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0

output:

0

result:

ok correct

Test #9:

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

input:

2
0 1
60
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0

output:

0

result:

ok correct

Test #10:

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

input:

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

output:

93
97 89
97 68
97 62
97 38
97 32
97 94
97 44
97 9
97 8
97 66
97 79
97 57
97 36
97 53
97 35
97 56
97 24
97 58
97 33
97 25
97 78
97 16
97 96
97 54
97 76
95 81
95 60
95 17
95 67
95 30
95 2
95 31
95 55
95 40
95 72
95 64
95 21
95 50
95 71
95 80
95 22
95 87
95 10
95 49
95 11
95 52
95 88
95 47
95 28
95 77
...

result:

ok correct

Test #11:

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

input:

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

output:

92
98 64
98 94
98 17
98 31
98 4
97 51
97 63
97 69
97 13
97 2
97 3
97 0
97 8
97 50
97 26
97 9
97 93
97 56
97 30
97 67
97 65
97 19
97 38
97 25
97 7
97 10
97 49
97 22
97 42
96 91
96 76
96 92
96 57
96 24
96 39
96 27
96 71
96 75
96 20
96 81
96 73
96 82
96 35
96 72
96 88
96 37
96 95
96 55
96 85
96 60
96 4...

result:

ok correct

Test #12:

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

input:

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

output:

95
95 16
95 50
95 62
95 1
95 91
95 74
95 39
95 7
95 63
95 31
95 40
95 11
95 79
95 27
95 33
95 49
95 25
95 17
95 53
95 84
95 68
95 88
95 64
95 54
95 55
95 45
95 28
95 83
95 4
95 44
95 23
95 24
95 87
95 19
95 8
95 41
95 37
95 9
95 13
95 60
95 0
95 12
95 82
95 72
95 65
95 2
95 75
95 66
95 3
95 59
95 51...

result:

ok correct

Subtask #3:

score: 16
Accepted

Test #13:

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

input:

2
0 1
60
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1

output:

0

result:

ok correct

Test #14:

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

input:

5
0 4 1 3 2
150
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
...

output:

2
4 2
4 1

result:

ok correct

Test #15:

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

input:

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

output:

91
95 23
95 0
95 7
95 42
95 3
94 72
94 87
94 13
94 71
94 8
94 81
94 92
94 82
94 74
94 16
94 44
94 34
94 14
94 63
94 41
94 37
94 86
94 30
94 60
94 62
94 77
94 46
94 10
94 58
94 38
94 68
94 51
94 93
94 83
94 47
94 88
94 59
94 55
94 52
94 19
94 39
94 32
94 5
94 50
94 21
94 22
94 73
94 54
94 84
94 36
94...

result:

ok correct

Test #16:

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

input:

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

output:

92
98 11
98 69
98 42
98 0
98 28
98 83
98 78
98 62
98 8
98 18
98 66
98 13
98 4
98 73
98 70
98 79
98 27
98 15
98 49
98 50
98 14
98 40
98 92
98 54
97 93
97 26
97 67
97 85
97 37
97 87
97 63
97 74
97 10
97 82
97 80
97 64
97 88
97 52
97 58
97 45
97 5
97 6
97 30
97 36
97 34
97 76
97 75
97 25
97 35
97 47
97...

result:

ok correct

Test #17:

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

input:

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

output:

97
98 21
98 16
98 49
98 85
98 29
98 35
98 83
98 0
98 52
98 81
98 7
98 75
98 5
98 87
98 19
98 56
98 72
98 3
98 91
98 90
98 61
98 53
98 14
98 62
98 6
98 65
98 45
98 46
98 63
98 37
98 66
98 96
98 10
98 64
98 44
98 4
98 38
98 12
98 95
98 73
98 82
98 27
98 68
98 2
98 59
98 88
98 54
98 50
98 42
98 43
98 4...

result:

ok correct

Test #18:

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

input:

4
0 1 3 2
120
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 ...

output:

2
3 2
0 0

result:

ok correct

Subtask #4:

score: 18
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #19:

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

input:

1
0
30
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0

output:

0

result:

ok correct

Test #20:

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

input:

2
0 1
60
1 0
0 1
1 0
0 1
1 0
0 1
1 0
0 1
0 1
1 0
0 1
0 1
1 0
0 1
0 1
0 1
1 0
1 0
0 1
1 0
0 1
1 0
1 0
1 0
1 0
1 0
0 1
0 1
0 1
1 0
1 0
1 0
1 0
1 0
1 0
1 0
0 1
1 0
0 1
1 0
0 1
1 0
0 1
1 0
1 0
0 1
1 0
1 0
0 1
1 0
1 0
0 1
0 1
0 1
0 1
1 0
0 1
1 0
1 0
1 0

output:

0

result:

ok correct

Test #21:

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

input:

481
264 22 307 266 238 227 68 26 13 12 384 162 410 306 374 311 442 38 407 310 280 308 333 146 326 381 367 110 190 33 141 468 153 393 157 415 229 75 276 392 349 348 179 445 317 64 78 20 323 257 292 395 129 259 165 398 151 219 14 116 338 188 243 61 150 84 72 340 155 133 459 464 248 433 124 399 177 62 ...

output:

473
278 38
278 171
278 281
278 359
278 332
278 429
278 320
278 356
278 84
278 391
138 173
138 87
138 198
138 131
138 318
138 364
138 382
138 377
138 280
138 420
138 67
138 428
138 338
138 438
138 30
138 211
138 225
138 279
138 442
138 37
138 0
138 70
138 302
138 305
138 286
138 33
138 183
138 421
13...

result:

ok correct

Test #22:

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

input:

478
458 446 125 326 318 327 263 67 453 296 46 116 270 440 323 38 181 235 415 412 95 365 133 397 157 441 348 223 459 449 149 168 59 107 171 262 328 450 289 314 141 139 29 393 211 477 146 239 433 142 269 145 342 155 238 172 206 23 108 31 48 117 180 424 50 147 325 468 161 291 272 130 93 472 245 207 154...

output:

476
466 84
466 353
466 33
466 238
466 157
466 424
466 49
466 154
466 475
466 439
466 375
466 190
466 34
466 419
466 31
466 100
466 440
466 315
466 207
466 202
466 132
466 5
466 437
466 103
466 429
466 85
466 430
466 32
466 7
466 90
466 41
466 404
466 28
466 279
466 117
466 220
466 294
466 276
466 22...

result:

ok correct

Test #23:

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

input:

496
426 495 20 100 83 50 3 247 94 52 290 45 179 160 344 239 270 133 492 398 131 476 271 436 69 351 401 494 111 76 393 432 431 207 53 350 24 288 278 359 413 253 181 166 186 336 35 173 209 448 352 364 188 434 203 38 439 32 328 285 213 112 47 128 136 303 49 180 444 132 177 114 287 475 161 483 14 108 66...

output:

490
495 284
495 146
495 46
495 387
495 58
495 328
495 464
495 268
495 102
495 272
495 93
495 321
495 362
495 357
495 25
495 358
495 94
495 380
495 374
495 288
495 411
495 30
495 228
495 428
495 83
495 329
495 133
495 455
495 107
495 66
495 355
495 233
495 307
495 11
495 407
495 296
495 473
495 277
4...

result:

ok correct

Test #24:

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

input:

484
307 290 7 454 181 133 142 213 413 207 146 153 236 111 320 453 476 103 316 158 235 388 150 155 329 297 196 345 335 197 173 0 156 59 357 85 161 280 229 98 412 187 42 226 244 203 99 475 223 81 56 309 273 87 159 317 50 313 199 366 185 409 172 483 447 427 71 284 330 30 73 414 154 70 302 417 113 107 2...

output:

422
483 196
483 104
483 227
483 299
483 30
483 173
483 69
483 26
483 417
483 75
483 150
483 232
483 184
483 43
483 226
483 46
483 99
483 128
483 448
483 396
483 38
483 229
483 470
483 32
483 156
483 249
483 457
483 108
483 220
483 86
483 139
483 209
483 5
483 210
483 386
483 133
483 16
483 476
483 2...

result:

ok correct

Test #25:

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

input:

496
145 300 465 228 235 186 373 183 142 208 278 11 410 286 392 245 44 470 211 368 283 240 265 120 30 68 71 158 263 356 439 243 27 311 86 134 201 33 319 371 254 181 231 89 214 435 113 59 48 151 317 143 320 195 377 426 408 303 22 47 149 330 180 175 412 140 102 204 381 441 50 258 232 105 266 52 122 423...

output:

145
495 301
495 293
494 352
491 170
490 274
490 276
488 484
483 482
481 146
480 444
478 284
473 442
471 470
468 233
468 205
467 119
465 2
464 361
461 346
100 358
456 369
31 243
454 141
129 321
452 372
162 421
450 93
446 65
446 140
443 101
443 212
441 69
440 386
440 380
24 30
438 12
438 410
273 312
4...

result:

ok correct

Test #26:

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

input:

478
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 365 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:

270
418 48
418 137
418 477
201 147
201 292
201 357
201 476
72 47
72 409
72 83
72 415
72 358
72 228
72 294
72 10
72 158
72 367
72 90
72 225
72 467
72 152
72 463
72 444
72 144
72 410
72 71
72 386
72 365
72 254
72 70
72 297
72 342
72 350
72 207
72 293
72 286
72 340
72 388
72 247
72 87
72 362
72 136
72 ...

result:

ok correct

Test #27:

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

input:

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

output:

473
257 475
360 305
360 268
360 168
360 71
360 96
360 16
360 60
360 30
360 323
360 437
360 235
360 13
360 340
360 99
360 382
360 423
360 299
360 175
360 103
360 356
360 430
360 194
360 44
360 293
360 321
360 369
360 220
360 192
360 330
360 326
360 53
360 65
360 32
360 327
360 180
360 416
360 47
360 ...

result:

ok correct

Subtask #5:

score: 20
Accepted

Test #28:

score: 20
Accepted
time: 2ms
memory: 3916kb

input:

1800
530 1775 466 953 230 1179 944 752 990 1316 275 1029 158 152 1673 1706 172 115 599 1661 131 699 1112 454 551 1059 291 495 28 67 773 480 839 462 1210 757 879 285 439 3 1429 820 26 1023 942 199 356 625 1705 1421 144 1529 716 7 1485 1027 1599 696 517 1353 456 1389 273 1363 1414 1177 718 41 777 1621...

output:

1794
1799 689
1799 860
1799 33
1799 462
1799 647
1799 770
1799 1014
1799 22
1799 1112
1799 1758
1799 23
1799 193
1799 24
1799 413
1799 133
1799 830
1799 931
1799 174
1799 1448
1799 1300
1799 864
1799 996
1799 1518
1799 644
1799 1639
1799 1134
1799 431
1799 1328
1799 1719
1799 236
1799 1291
1799 1340...

result:

ok correct

Test #29:

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

input:

1950
1718 335 1071 714 1080 1828 1472 410 553 1269 297 401 1021 621 1763 528 205 1231 406 5 715 876 1474 1110 653 862 838 291 1092 549 955 1334 1044 300 1070 720 1877 484 1597 1948 1078 28 87 1193 505 1024 1259 63 852 960 633 1573 713 504 15 820 1852 752 1601 1168 471 1903 499 693 1209 1492 56 908 9...

output:

1944
1949 684
1949 1324
1949 1468
1949 281
1949 289
1949 1393
1949 433
1949 1171
1949 1307
1949 808
1949 1945
1949 193
1949 1697
1949 1481
1949 1285
1949 13
1949 621
1949 143
1949 58
1949 1601
1949 243
1949 40
1949 1078
1949 1148
1949 441
1949 117
1949 1163
1949 1017
1949 1819
1949 1398
1949 631
194...

result:

ok correct

Test #30:

score: 0
Accepted
time: 2ms
memory: 3868kb

input:

1853
452 1299 444 1527 510 1801 34 1178 1589 1782 342 1800 735 761 879 999 1122 1772 236 566 1459 1256 1149 1498 1827 1027 715 1377 6 306 1811 950 500 890 196 1825 1568 1157 943 1422 475 1237 1792 1796 1363 1217 889 968 1439 1116 322 795 1088 1358 1833 96 118 543 1337 207 876 1144 805 215 1433 903 1...

output:

1844
1174 179
1174 1291
1174 459
1174 1578
1174 1052
1174 85
1174 1088
1174 1184
1174 578
1174 425
1174 435
1174 566
1174 274
1174 1425
1811 64
1811 1343
1811 915
1811 1222
1811 1781
1811 694
1811 688
1811 338
1811 1146
1811 818
1811 1496
1811 727
1811 1337
1811 1210
1811 1442
1811 707
1811 530
1811...

result:

ok correct

Test #31:

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

input:

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

output:

0

result:

ok correct

Test #32:

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

input:

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

output:

134
68 1991
1828 1987
332 1967
263 1957
1184 1954
503 1943
1126 1938
1778 1934
210 1912
1911 960
596 1908
1693 1200
1693 206
1693 1896
1895 1007
93 1892
1017 1875
305 1867
966 494
966 1856
946 1842
1839 631
1839 1394
440 1833
1486 214
1486 1829
1803 748
937 1777
862 1776
336 1775
1587 1774
1753 1770...

result:

ok correct

Test #33:

score: 0
Accepted
time: 2ms
memory: 4108kb

input:

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

output:

377
541 1934
39 855
39 199
39 1929
943 85
943 756
943 551
943 1922
1426 82
1426 1921
1621 1916
1914 701
681 1620
681 1350
681 1910
90 1906
1270 958
1270 1905
1563 1904
1188 438
1188 1903
1877 1902
91 824
91 447
91 1898
191 1895
333 1218
333 1887
448 1882
1568 1190
1568 1404
1568 1654
1568 598
1568 5...

result:

ok correct

Test #34:

score: 0
Accepted
time: 2ms
memory: 3920kb

input:

1999
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 127 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:

1080
102 182
102 1609
102 959
102 1140
102 1306
102 1671
102 1963
102 1741
102 1978
102 1998
371 1997
1443 70
1443 1158
1443 1995
1475 349
1475 1980
1475 648
1475 779
1475 633
1475 1970
1475 1188
1475 245
1475 1863
1475 1601
1475 1846
1475 94
1475 1384
1475 1626
1475 1064
1475 1487
1475 1757
1475 18...

result:

ok correct

Test #35:

score: 0
Accepted
time: 2ms
memory: 4220kb

input:

1901
952 410 986 1281 736 1411 1256 622 375 1423 718 1153 1238 643 120 1336 1097 881 1140 1395 1195 847 925 967 280 1859 966 360 815 770 634 1774 1359 1871 1589 618 991 571 1704 170 1548 1791 225 741 1561 35 1334 1632 203 894 728 1681 1849 22 1152 1719 701 1886 1037 1309 1576 993 1350 1643 893 1888 ...

output:

1897
1840 1838
1840 754
1840 961
1840 1199
1840 1677
1840 1783
1840 6
1840 1256
1840 1449
1840 1267
1840 1680
1840 1529
1840 499
1840 67
1840 654
1840 949
1840 552
1840 1001
1840 682
1840 610
1840 1591
1840 764
1840 1588
1840 1662
1840 302
1840 1659
1840 748
1840 834
1840 1243
1840 207
1840 1204
184...

result:

ok correct

Test #36:

score: 0
Accepted
time: 2ms
memory: 4152kb

input:

1931
1361 1614 1425 1627 1210 1778 166 420 1747 1792 1060 1914 611 833 1280 86 1754 1194 762 185 488 1368 1794 1153 1466 1689 1185 168 1622 1582 959 197 103 1809 1586 436 633 853 463 738 820 630 159 398 150 1370 558 281 1849 483 1691 350 1867 1871 1392 1791 1697 926 639 1865 1063 1726 262 1009 495 1...

output:

1923
1385 747
1385 784
1385 783
1385 1874
1385 1780
1385 1491
1385 658
1385 1383
1385 1834
1385 58
1385 878
1385 1040
1385 163
1385 733
1385 1167
1385 1868
1385 847
1385 1799
1385 1929
1385 1832
1385 627
1385 1563
1385 1050
1385 648
1385 1690
1385 509
1385 1267
1385 1083
1385 817
1385 1402
1385 1519...

result:

ok correct

Test #37:

score: 0
Accepted
time: 2ms
memory: 4124kb

input:

1938
428 1641 1051 1154 1556 814 986 237 1557 1082 84 1382 1823 1591 1779 1565 193 574 1683 1259 405 393 366 644 612 562 303 1567 997 1422 868 132 74 1508 1002 965 1752 500 1148 529 1119 1841 930 1608 1472 310 1435 261 705 908 588 1710 722 1427 1825 1256 1175 379 45 902 1861 62 729 1303 759 766 1022...

output:

1928
321 504
321 1644
321 1730
321 417
321 1862
321 1135
321 308
321 1157
321 523
321 1085
321 1145
321 1316
321 1907
321 1840
321 706
321 142
321 1670
321 1199
321 78
321 1072
321 1597
321 770
321 1448
321 468
321 661
321 1306
321 693
321 322
321 776
321 410
321 1197
321 1264
321 473
321 1124
321 3...

result:

ok correct

Test #38:

score: 0
Accepted
time: 2ms
memory: 3868kb

input:

1997
1053 110 1738 1025 1245 1257 472 471 13 1215 1811 1371 476 1631 1028 892 1191 20 1323 868 435 1063 870 758 1538 155 1105 27 987 1345 1228 1473 452 1092 1561 1874 1417 95 252 565 1315 1389 533 1078 1259 1440 772 0 1588 1750 1451 644 659 1161 173 200 1680 1040 1827 1567 1069 12 1730 866 1493 65 5...

output:

1693
1996 1039
1995 57
1995 818
1995 460
1995 1632
1995 339
1995 621
1995 891
1995 1622
1995 1948
1995 1779
1995 901
1995 1432
1995 1800
1995 1712
1995 462
1995 365
1995 134
1995 1877
1995 929
1995 741
1995 1040
588 1334
588 1262
588 564
588 695
588 103
588 996
588 5
588 1064
588 595
588 1257
588 17...

result:

ok correct

Test #39:

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

input:

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

output:

1091
1720 87
1720 299
1720 347
1720 1328
1720 1060
1720 1179
1720 1
1720 1898
1720 239
1720 249
1720 257
1720 1136
1720 1348
1720 1067
1720 221
1720 71
1720 1835
1720 931
1720 934
1720 1934
1720 1859
1720 969
1720 1357
1720 1016
1720 1618
1720 585
1720 1565
1720 1928
1720 327
1720 645
1720 1412
1720...

result:

ok correct

Test #40:

score: 0
Accepted
time: 2ms
memory: 3864kb

input:

1961
0 1 272 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:

1959
668 401
668 211
668 782
668 1847
668 932
668 1575
668 744
668 43
668 331
668 928
668 0
668 59
668 1813
668 1624
668 902
668 107
668 837
668 1669
668 12
668 1280
668 1006
668 1690
668 386
668 134
668 583
668 1261
668 1176
668 1908
668 183
668 866
668 596
668 229
668 1796
668 1565
668 447
668 59
...

result:

ok correct

Test #41:

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

input:

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

output:

2
1779 1471
0 0

result:

ok correct

Subtask #6:

score: 26
Accepted

Dependency #5:

100%
Accepted

Test #42:

score: 26
Accepted
time: 240ms
memory: 14156kb

input:

176900
167810 159384 90550 63101 76883 19925 161149 18578 132157 136198 141834 156609 167914 129523 2878 165972 95279 65282 30261 94853 37236 41515 166488 123502 141101 86565 153657 72526 396 92614 23189 1661 167567 100107 155037 35542 99140 171977 171544 123048 107611 71527 111368 88756 149185 9360...

output:

176885
176899 131853
176899 2973
176899 95003
176899 2340
176899 108201
176899 67945
176899 22155
176899 111890
176899 56939
176899 154747
176899 164046
176899 137672
176899 24007
176899 24440
176899 106941
176899 98675
176899 166757
176899 62797
176899 159746
176899 51853
176899 41497
176899 111935...

result:

ok correct

Test #43:

score: 0
Accepted
time: 269ms
memory: 14372kb

input:

180601
172380 49504 27207 3423 41891 140536 126137 40192 90592 127987 124918 9486 152764 76028 76578 51283 40029 108361 93576 1341 36411 19763 103182 57530 103033 111456 32419 24822 89698 42054 101746 78793 103184 136054 135074 170297 146325 170251 21191 78975 68633 116257 103827 106102 162889 14512...

output:

180588
180600 31084
180600 18602
180600 50636
180600 105717
180600 86443
180600 110117
180600 122555
180600 61613
180600 173678
180600 66582
180600 96858
180600 102151
180600 77595
180600 177682
180600 3396
180600 60691
180600 153806
180600 98265
180600 74160
180600 17772
180600 150035
180600 158903...

result:

ok correct

Test #44:

score: 0
Accepted
time: 264ms
memory: 14720kb

input:

190000
155277 81364 16113 73641 59637 140074 33594 60852 167804 149502 15249 35894 69246 132504 37548 26618 81511 141393 147548 24346 7165 123128 175784 74022 121283 80377 116823 111912 149688 96762 34103 104558 142346 82209 136360 40339 28418 119696 9573 42868 81005 59704 115658 173964 158009 43922...

output:

189985
107247 102697
107247 140813
107247 23799
107247 146476
107247 137772
107247 147442
107247 139347
107247 13866
107247 81653
107247 171046
107247 50324
107247 50751
107247 151195
107247 16515
107247 113004
107247 184256
107247 13923
107247 100469
107247 7772
107247 159720
107247 176987
107247 6...

result:

ok correct

Test #45:

score: 0
Accepted
time: 67ms
memory: 11648kb

input:

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

output:

0

result:

ok correct

Test #46:

score: 0
Accepted
time: 244ms
memory: 15392kb

input:

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

output:

89748
106982 75114
106982 131077
106982 42132
106982 97050
106982 59766
106982 2159
106982 147656
106982 158562
106982 162851
106982 92971
106982 121362
106982 173052
106982 145525
106982 121897
106982 143778
106982 192197
106982 116320
106982 49332
106982 151388
106982 119653
106982 177609
106982 1...

result:

ok correct

Test #47:

score: 0
Accepted
time: 259ms
memory: 15892kb

input:

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

output:

100444
189897 40513
189897 120793
189897 164759
189897 199972
16655 4024
16655 139792
16655 174422
16655 40398
16655 88993
16655 185750
16655 64202
16655 172263
16655 43025
16655 27654
16655 159353
16655 151127
16655 101013
16655 182045
16655 145726
16655 99671
16655 125428
16655 58657
16655 25484
1...

result:

ok correct

Test #48:

score: 0
Accepted
time: 233ms
memory: 15664kb

input:

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

output:

102949
108742 116371
108742 199960
79795 150592
79795 193839
79795 37439
79795 21672
79795 5448
79795 172916
79795 17669
79795 168282
79795 72001
79795 181834
79795 51
79795 13669
79795 46081
79795 47730
79795 10524
79795 153629
79795 135732
79795 26735
79795 129814
79795 115031
79795 38457
79795 15...

result:

ok correct

Test #49:

score: 0
Accepted
time: 264ms
memory: 18948kb

input:

193129
36602 123872 92038 45146 138692 111345 188441 38874 91571 40957 134717 29367 19348 43950 30107 169548 95423 20615 37890 24013 43534 56756 81846 81665 44142 51120 180128 191175 155099 72840 184568 93861 80314 90359 189897 714 93862 77927 44624 23382 86361 118437 115484 86518 100371 84582 12335...

output:

193113
193128 56304
193128 144320
193128 60561
193128 187537
193128 191856
193128 189455
193128 122462
193128 10263
193128 83744
193128 129758
193128 77368
193128 99400
193128 5495
193128 173292
193128 69444
193128 186725
193128 90653
193128 33469
193128 22486
193128 15932
193128 34342
193128 67173
...

result:

ok correct

Test #50:

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

input:

197082
28948 99935 148708 46451 122696 180672 62930 125162 102390 178828 36655 81146 108094 50099 58749 177353 187400 182745 51049 117239 46107 132994 126349 134844 20491 77064 156426 77316 106562 74474 181231 51810 115214 17483 98735 11537 154284 152530 31318 32324 150103 162145 377 111950 32190 84...

output:

197073
197081 105130
197081 94929
197081 103163
197081 53388
197081 38926
197081 60194
197081 31330
197081 170640
197081 116605
197081 186321
197081 69921
197081 171830
197081 23601
197081 96413
197081 93726
197081 177699
197081 187964
197081 185904
197081 121893
197081 12425
197081 179998
197081 52...

result:

ok correct

Test #51:

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

input:

194300
41456 157650 130220 26552 100104 39688 171793 93878 171968 42386 15076 119236 116984 147030 178130 84543 41422 78012 62905 182069 27860 51578 123684 182555 79509 132548 171199 184307 163260 137221 40321 193521 22658 163921 153451 81135 146421 61739 37826 184064 100949 1221 27789 179291 15206 ...

output:

194290
21306 136498
21306 20686
21306 64947
21306 140111
21306 100800
21306 144727
21306 85384
21306 123406
21306 132117
21306 191443
21306 50219
21306 2317
21306 121030
21306 104161
21306 151406
21306 118681
21306 7290
21306 671
21306 187391
21306 43995
21306 23361
21306 62593
21306 170714
21306 65...

result:

ok correct

Test #52:

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

input:

191745
86160 177973 190897 101427 58207 52429 103273 57783 65873 49221 161353 23941 99019 125297 40852 27805 14133 40994 81091 37037 21432 47533 119915 102063 92390 79753 118310 157456 132054 38761 115430 33036 71721 54738 176381 140861 147078 36903 123109 71733 46877 173730 187571 7820 33867 26827 ...

output:

191732
100963 6479
100963 109809
100963 24551
100963 69469
100963 32639
100963 50902
100963 174981
100963 144315
100963 35564
100963 90860
100963 106238
100963 177195
100963 95719
100963 117321
100963 34893
100963 36700
100963 160872
100963 43250
100963 163302
100963 23552
100963 105953
100963 19160...

result:

ok correct

Test #53:

score: 0
Accepted
time: 214ms
memory: 13784kb

input:

199993
196446 158206 8206 10499 39868 129031 121632 148457 183086 75548 11957 13065 15359 17847 118402 17577 159823 30468 24361 103231 121626 59655 36996 187439 89929 192793 20197 28808 16555 137308 105716 56425 198490 164384 8584 47629 83558 155060 148041 175988 3886 132588 15792 32028 104991 14846...

output:

99996
80362 166356
199987 147923
199987 17983
199987 58464
199987 104256
199987 15759
199987 66018
199987 180539
199987 63720
199987 196432
199987 117561
199987 29363
199987 108256
199987 117607
199987 54080
199987 8670
199987 7371
199987 74012
199987 199649
199987 66110
199987 81907
199987 78025
19...

result:

ok correct

Test #54:

score: 0
Accepted
time: 169ms
memory: 12956kb

input:

195962
0 143495 94457 139954 64590 53700 118663 178237 93365 76238 190312 47039 180296 27740 3019 173316 180035 69779 93653 122287 57697 21 119951 130009 15368 145558 129234 63611 55030 29 189665 107778 157921 184944 79827 118642 86050 82957 86225 39 29493 124696 114418 173586 84617 177846 170864 11...

output:

84206
195960 74602
195959 141000
195959 71155
195959 133032
195959 32857
195959 51303
195959 139035
195959 109223
195959 119594
195959 90715
195959 64855
195959 190643
195959 153126
195959 52528
195959 178383
195959 111859
195959 33919
195959 181618
195959 42825
195959 19831
195959 23246
195959 1620...

result:

ok correct

Test #55:

score: 0
Accepted
time: 335ms
memory: 15216kb

input:

194842
100154 140138 48998 98453 130678 177133 46195 8423 62509 72873 77452 122206 42181 60275 170586 2358 7988 89849 185284 193691 59370 185794 5218 23270 118843 81380 57130 150638 52947 187734 187310 168413 153988 136321 38186 163329 189331 126207 137943 84857 145378 167961 161479 69302 31915 1202...

output:

182153
121044 62408
121044 45605
121044 194841
121044 125110
121044 42830
121044 89040
121044 45026
194840 29753
194840 149616
194840 84162
194840 9290
194840 164226
194840 11889
194840 153895
194840 35883
194840 174062
194840 153141
194840 108810
194840 62138
194840 30069
194840 154770
194840 50311...

result:

ok correct

Test #56:

score: 0
Accepted
time: 336ms
memory: 14816kb

input:

192864
140597 66570 121427 116752 26792 80717 160186 76426 8 89413 178636 77175 26030 47446 80214 37113 6890 186652 99224 16670 42488 160907 6475 13753 93053 55091 124543 86129 121212 126899 190219 159959 130785 94656 182197 40626 190748 71684 29400 127366 187275 144333 66541 159353 56469 45 46 1133...

output:

165493
192863 69681
192863 78067
31387 66708
31387 88665
31387 186798
31387 86778
31387 123195
31387 178946
31387 175530
31387 155824
31387 28654
31387 106170
31387 79615
31387 80381
31387 32013
31387 101547
31387 166044
31387 170781
31387 52433
31387 71351
31387 104888
31387 168719
31387 115096
313...

result:

ok correct

Test #57:

score: 0
Accepted
time: 172ms
memory: 12544kb

input:

197205
69791 7278 144655 44140 100294 77302 123723 171433 104856 173242 169410 67899 36966 171145 136488 47079 48081 152021 59592 5911 4574 162108 173932 54582 62863 110098 59669 47193 129654 106687 152256 89688 184321 178761 50076 26558 84676 120349 3492 76839 83222 138603 78108 16086 42321 191702 ...

output:

49301
197204 60782
197203 190222
197202 862
197199 993
197196 167883
197194 130189
197193 59886
197192 101214
197191 147623
197190 101420
197183 80394
197182 42367
197181 156744
197180 128426
197179 84222
197176 28191
197175 6796
197173 177140
197172 95281
197170 61264
197169 119687
197167 14311
197...

result:

ok correct

Test #58:

score: 0
Accepted
time: 334ms
memory: 15168kb

input:

197131
84406 80027 110287 44746 131371 146934 42426 65970 150332 170783 65657 1953 162645 190993 109274 124958 51133 84371 52975 45289 169245 91663 107556 94239 181471 104596 71086 182854 165285 38597 66664 7262 124939 9815 82726 155117 130064 161982 165615 141978 54973 19100 50015 109085 117973 118...

output:

168671
197130 186218
197130 166888
197130 40785
197130 19926
197130 153193
197130 107301
197130 154197
197130 15498
197130 48571
197130 51063
197130 151480
197130 8752
197130 108879
197130 54030
197130 139360
197130 174807
197130 124758
197130 163607
197130 66126
197130 136289
197130 134291
197130 8...

result:

ok correct

Test #59:

score: 0
Accepted
time: 270ms
memory: 14768kb

input:

190716
70694 127495 127683 172932 35760 161055 89535 88848 86329 70488 159904 154657 123716 114250 17532 30359 18636 56168 87024 174259 84439 39232 146857 23700 109966 77964 87980 58575 44910 187918 44705 123208 129478 100467 24819 82211 54590 167945 186629 189101 150929 88606 28837 150355 60022 149...

output:

190706
190715 101234
190715 122337
190715 134594
190715 16015
190715 155505
190715 144229
190715 166011
190715 83736
190715 46435
190715 89708
190715 137188
190715 49360
190715 24406
190715 102559
190715 1864
190715 91969
190715 174750
190715 41183
190715 160379
190715 12305
190715 80103
190715 9985...

result:

ok correct

Test #60:

score: 0
Accepted
time: 262ms
memory: 15196kb

input:

193898
85269 174015 77811 28051 118737 97733 40719 89809 27239 143398 80856 147511 63066 169396 188622 137055 75691 19603 26753 21153 38282 19883 184352 116056 74924 109097 83545 91598 188816 130408 12005 58299 179552 132499 184991 172525 19246 46965 82109 14127 45042 61971 139287 156790 158325 1053...

output:

193877
178413 66266
178413 146586
178413 183566
178413 189860
178413 59702
178413 133678
178413 192534
178413 89911
178413 4558
178413 23062
178413 89462
178413 89349
178413 69437
178413 28520
178413 4302
178413 92219
178413 36554
178413 7183
178413 86584
178413 56396
178413 15772
178413 154936
1784...

result:

ok correct

Test #61:

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

input:

193451
73331 167267 1859 26632 182171 73089 171348 172101 254 125155 89420 155531 85116 116670 120195 104715 81962 173779 54516 70099 186190 71017 67533 23137 114603 120956 148961 4395 85938 127836 173745 186046 50370 28206 98366 112565 66018 46642 74053 48767 7112 15058 176808 908 73048 45225 60762...

output:

193228
193450 171289
193450 27889
193450 15539
193450 36381
193450 85791
193450 152920
193450 87778
193450 141751
193450 90721
193450 134201
193450 51013
193450 17160
193450 164281
193450 145497
193450 14873
193450 14946
193450 178549
193450 25795
193450 184792
193450 124284
193450 97184
193450 1699...

result:

ok correct

Test #62:

score: 0
Accepted
time: 229ms
memory: 13652kb

input:

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

output:

95351
83953 191761
100698 17190
100698 12868
100698 41141
100698 127601
100698 190798
100698 11748
100698 164092
100698 191760
180561 14919
180561 50636
180561 46176
180561 169292
180561 125110
180561 60462
180561 147543
180561 178617
180561 181451
180561 99617
180561 80068
180561 75625
180561 93482...

result:

ok correct

Test #63:

score: 0
Accepted
time: 24ms
memory: 10992kb

input:

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

output:

2
139084 152764
0 0

result:

ok correct

Test #64:

score: 0
Accepted
time: 279ms
memory: 15344kb

input:

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

output:

199698
186249 142356
186249 11474
186249 94823
186249 28520
186249 24786
186249 78627
186249 80430
186249 81083
186249 94030
186249 97700
186249 186765
186249 116194
186249 136426
186249 71438
186249 61805
186249 142935
186249 2407
186249 22299
186249 70011
186249 61449
186249 94359
186249 176490
18...

result:

ok correct

Test #65:

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

input:

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

output:

191784
188732 125939
188732 143356
188732 13338
188732 52805
188732 164368
188732 92074
188732 92954
188732 124056
188732 87885
188732 98780
188732 64276
188732 36213
188732 45011
188732 32391
188732 112288
188732 40460
188732 102535
188732 188120
188732 69374
188732 18259
188732 91295
188732 54289
...

result:

ok correct

Test #66:

score: 0
Accepted
time: 304ms
memory: 14860kb

input:

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

output:

193069
83347 145502
83347 189803
83347 155990
83347 78685
83347 28614
83347 13579
83347 97916
83347 19281
83347 55727
83347 40965
83347 109295
83347 68565
83347 96857
83347 70626
83347 153824
83347 167081
83347 190241
83347 53267
83347 123995
83347 174294
83347 97252
83347 130734
83347 128574
83347 ...

result:

ok correct