QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#401490#2555. Two BulletsnguyentunglamWA 2575ms11456kbC++174.4kb2024-04-28 20:18:492024-04-28 20:18:50

Judging History

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

  • [2024-04-28 20:18:50]
  • 评测
  • 测评结果:WA
  • 用时:2575ms
  • 内存:11456kb
  • [2024-04-28 20:18:49]
  • 提交

answer

#include<bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define endl "\n"
using namespace std;

const int N = 1e5 + 10, K = 500;

int a[N], deg[N], rev_idx[N], cost[N];

int n;

int st[N / K + 10], ed[N / K + 10];

vector<int> rrh[N / K + 10];

long long timer;

struct IT {

int lazy[K * 4 + 10];

pair<int, int> T[K * 4 + 10];


void build(int s, int l, int r) {
  if (l == r) {
    T[s] = make_pair(0, l);
    return;
  }
  int mid = l + r >> 1;
  build(s << 1, l, mid);
  build(s << 1 | 1, mid + 1, r);
  T[s] = min(T[s << 1], T[s << 1 | 1]);
}

void push(int s, int l, int r) {
  if (!lazy[s]) return;
  T[s].first += lazy[s];
  if (l != r) {
    lazy[s << 1] += lazy[s];
    lazy[s << 1 | 1] += lazy[s];
  }
  lazy[s] = 0;
}

void up(int s, int l, int r, int from, int to, int val) {
  push(s, l, r);
  if (l > to || r < from) return;
  if (from <= l && r <= to) {
    lazy[s] = val;
    push(s, l, r);
    return;
  }
  int mid = l + r >> 1;
  up(s << 1, l, mid, from, to, val);
  up(s << 1 | 1, mid + 1, r, from, to, val);
  T[s] = min(T[s << 1], T[s << 1 | 1]);
}

} it[N / K];

int bit[N];

void add (int pos, int val) {
  while (pos) {
    bit[pos] += val;
    pos -= pos & -pos;
  }
}

int get(int pos) {
  int ret = 0;
  while (pos <= n) {
    ret += bit[pos];
    pos += pos & -pos;
  }
  return ret;
}

priority_queue<int> q[2];

int32_t main() {
  #define task ""

  cin.tie(0) -> sync_with_stdio(0);

  if (fopen("task.inp", "r")) {
    freopen("task.inp", "r", stdin);
    freopen("task.out", "w", stdout);
  }

  if (fopen(task".inp", "r")) {
    freopen (task".inp", "r", stdin);
    freopen (task".out", "w", stdout);
  }

  cin >> n;

  for(int i = 1; i <= n; i++) cin >> a[i];

  for(int i = 1; i <= n; i++) rev_idx[a[i]] = i;

  for(int i = 1; i <= n; i++) {
    cost[i] = get(a[i]);
    add(a[i], 1);
  }

  for(int i = n, mn = 1e9; i >= 1; i--) {
    deg[i] = a[i] > mn;
    mn = min(mn, a[i]);
  }

  auto idx = [&] (int block, int val) {
    return upper_bound(all(rrh[block]), val) - rrh[block].begin();
  };

  auto handle = [&] (int block) {
//    timer++;
    while (it[block].T[1].first == 0) {
      int x = it[block].T[1].second;
      it[block].up(1, 1, ed[block] - st[block] + 1, x, x, 1e9);
      int y = rev_idx[rrh[block][x - 1]];
      q[deg[y]].push(y);
//      cout << y << endl;
    }
  };

  for(int block = 0; block <= n / K; block++) {
    st[block] = max(1, block * K);
    ed[block] = min(n, block * K + K - 1);
    for(int i = st[block]; i <= ed[block]; i++) rrh[block].push_back(a[i]);
    sort(all(rrh[block]));
    rrh[block].resize(unique(all(rrh[block])) - rrh[block].begin());
    it[block].build(1, 1, ed[block] - st[block] + 1);
    for(int i = st[block]; i <= ed[block]; i++) {
      int pos = idx(block, a[i]);
      it[block].up(1, 1, ed[block] - st[block] + 1, pos, pos, cost[i]);
    }
    handle(block);
  }


  auto del = [&] (int i) {
    int group = i / K;
    for(int j = i + 1; j <= ed[group]; j++) if (a[i] > a[j]) {
      int pos = idx(group, a[j]);
      it[group].up(1, 1, ed[group] - st[group] + 1, pos, pos, -1);
      timer++;
    }
    handle(group);
    for(int block = group + 1; block <= n / K; block++) {
      timer++;
      int pos = idx(block, a[i]);
      if (!pos) continue;
      it[block].up(1, 1, ed[block] - st[block] + 1, 1, pos, -1);
      handle(block);
    }
  };

//  exit(0);

  vector<pair<int, int> > ans;

//  cout << timer << endl;

  while (1) {
    if (q[1].size() >= 2) {
      int x = q[1].top(); q[1].pop();
      int y = q[1].top(); q[1].pop();
      ans.emplace_back(a[x], a[y]);
      del(x);
      del(y);
    }
    else if (q[1].size() == 1) {
      int x = q[1].top(); q[1].pop();
      if (q[0].empty()) ans.emplace_back(a[x], a[x]);
      else {
        int y = q[0].top(); q[0].pop();
        ans.emplace_back(a[x], a[y]);
      }
      del(x);
    }
    else {
      if (q[0].empty()) break;
      int x = q[0].top(); q[0].pop();
      if (q[0].empty()) {
        ans.emplace_back(a[x], a[x]);
        break;
      }
      int y = q[0].top(); q[0].pop();
      ans.emplace_back(a[x], a[y]);
    }
  }

//  cout << timer << endl;

  cout << ans.size() << endl;

  for(auto &[x, y] : ans) cout << x << " " << y << endl;

  cerr << 1.0 * clock() / CLOCKS_PER_SEC << endl;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 8988kb

input:

8
4 3 8 2 1 7 6 5

output:

4
8 4
7 3
6 2
5 1

result:

ok da

Test #2:

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

input:

8
5 6 7 1 2 8 3 4

output:

4
8 7
6 5
4 3
2 1

result:

ok da

Test #3:

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

input:

4
1 2 4 3

output:

2
4 2
3 1

result:

ok da

Test #4:

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

input:

2
1 2

output:

1
2 1

result:

ok da

Test #5:

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

input:

2
2 1

output:

2
2 2
1 1

result:

ok da

Test #6:

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

input:

3
1 2 3

output:

2
3 2
1 1

result:

ok da

Test #7:

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

input:

3
1 3 2

output:

2
3 1
2 2

result:

ok da

Test #8:

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

input:

3
2 1 3

output:

2
2 3
1 1

result:

ok da

Test #9:

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

input:

3
2 3 1

output:

2
3 2
1 1

result:

ok da

Test #10:

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

input:

3
3 1 2

output:

2
3 3
2 1

result:

ok da

Test #11:

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

input:

3
3 2 1

output:

3
3 3
2 2
1 1

result:

ok da

Test #12:

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

input:

4
1 2 3 4

output:

2
4 3
2 1

result:

ok da

Test #13:

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

input:

4
1 2 4 3

output:

2
4 2
3 1

result:

ok da

Test #14:

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

input:

4
1 3 2 4

output:

2
3 4
2 1

result:

ok da

Test #15:

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

input:

4
1 3 4 2

output:

2
4 3
2 1

result:

ok da

Test #16:

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

input:

4
1 4 2 3

output:

2
4 1
3 2

result:

ok da

Test #17:

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

input:

4
1 4 3 2

output:

3
4 1
3 3
2 2

result:

ok da

Test #18:

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

input:

4
2 1 3 4

output:

2
2 4
3 1

result:

ok da

Test #19:

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

input:

4
2 1 4 3

output:

2
4 2
3 1

result:

ok da

Test #20:

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

input:

4
2 3 1 4

output:

2
3 2
4 1

result:

ok da

Test #21:

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

input:

4
2 3 4 1

output:

3
4 3
2 2
1 1

result:

ok da

Test #22:

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

input:

4
2 4 1 3

output:

2
4 2
3 1

result:

ok da

Test #23:

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

input:

4
2 4 3 1

output:

3
4 2
3 3
1 1

result:

ok da

Test #24:

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

input:

4
3 1 2 4

output:

2
3 4
2 1

result:

ok da

Test #25:

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

input:

4
3 1 4 2

output:

2
4 3
2 1

result:

ok da

Test #26:

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

input:

4
3 2 1 4

output:

3
3 4
2 2
1 1

result:

ok da

Test #27:

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

input:

4
3 2 4 1

output:

3
4 3
2 2
1 1

result:

ok da

Test #28:

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

input:

4
3 4 1 2

output:

2
4 3
2 1

result:

ok da

Test #29:

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

input:

4
3 4 2 1

output:

3
4 3
2 2
1 1

result:

ok da

Test #30:

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

input:

4
4 1 2 3

output:

3
4 4
3 2
1 1

result:

ok da

Test #31:

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

input:

4
4 1 3 2

output:

3
4 4
3 1
2 2

result:

ok da

Test #32:

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

input:

4
4 2 1 3

output:

3
4 4
2 3
1 1

result:

ok da

Test #33:

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

input:

4
4 2 3 1

output:

3
4 4
3 2
1 1

result:

ok da

Test #34:

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

input:

4
4 3 1 2

output:

3
4 4
3 3
2 1

result:

ok da

Test #35:

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

input:

4
4 3 2 1

output:

4
4 4
3 3
2 2
1 1

result:

ok da

Test #36:

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

input:

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

output:

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

result:

ok da

Test #37:

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

input:

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

output:

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

result:

ok da

Test #38:

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

input:

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

output:

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

result:

ok da

Test #39:

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

input:

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

output:

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

result:

ok da

Test #40:

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

input:

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

output:

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

result:

ok da

Test #41:

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

input:

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

output:

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

result:

ok da

Test #42:

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

input:

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

output:

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

result:

ok da

Test #43:

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

input:

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

output:

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

result:

ok da

Test #44:

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

input:

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

output:

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

result:

ok da

Test #45:

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

input:

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

output:

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

result:

ok da

Test #46:

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

input:

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

output:

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

result:

ok da

Test #47:

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

input:

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

output:

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

result:

ok da

Test #48:

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

input:

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

output:

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

result:

ok da

Test #49:

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

input:

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

output:

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

result:

ok da

Test #50:

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

input:

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

output:

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

result:

ok da

Test #51:

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

input:

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

output:

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

result:

ok da

Test #52:

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

input:

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

output:

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

result:

ok da

Test #53:

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

input:

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

output:

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

result:

ok da

Test #54:

score: 0
Accepted
time: 9ms
memory: 8568kb

input:

495
237 201 155 129 345 454 113 11 492 357 300 295 198 442 14 79 288 431 343 64 285 101 316 15 34 293 3 393 384 47 296 402 488 328 128 409 110 72 249 115 386 450 167 214 489 227 172 220 336 59 206 315 278 63 395 478 490 165 164 303 449 145 31 418 119 179 373 320 93 255 183 38 58 491 375 416 430 326 ...

output:

248
495 494
493 492
491 490
489 488
487 486
485 478
484 483
482 480
481 477
479 476
475 454
474 473
472 471
470 468
469 465
467 463
466 462
464 461
460 459
458 457
456 452
455 450
453 451
449 442
448 431
447 446
445 441
444 443
440 439
438 437
436 434
435 430
433 429
432 428
427 418
426 425
424 423
...

result:

ok da

Test #55:

score: 0
Accepted
time: 10ms
memory: 8688kb

input:

495
492 491 487 481 495 494 493 480 490 478 489 488 477 486 485 475 472 484 483 471 468 482 479 466 465 463 476 461 460 459 474 457 473 455 454 470 469 453 452 467 450 449 464 462 448 447 458 456 443 451 446 442 445 437 436 435 434 433 429 444 427 426 441 440 439 424 423 438 421 419 416 432 413 431 ...

output:

250
495 492
494 491
493 487
490 481
489 480
488 478
486 477
485 485
484 475
483 472
482 471
479 468
476 466
474 465
473 463
470 461
469 460
467 459
464 457
462 455
458 454
456 453
452 452
451 450
449 449
448 448
447 447
446 443
445 442
444 437
441 436
440 435
439 434
438 433
432 429
431 427
430 426
...

result:

ok da

Test #56:

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

input:

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

output:

248
494 493
492 490
489 487
486 485
482 481
479 477
476 474
473 472
470 468
460 459
458 457
456 455
454 452
447 446
445 444
443 442
440 436
435 434
433 432
430 429
426 424
423 422
421 420
419 418
411 409
408 407
405 399
398 397
396 392
391 390
389 383
381 380
379 378
376 374
373 372
370 368
367 365
...

result:

ok da

Test #57:

score: 0
Accepted
time: 9ms
memory: 8612kb

input:

496
237 201 155 129 345 454 113 11 492 357 300 295 198 442 14 79 288 431 343 64 285 101 316 15 34 293 3 393 384 47 296 402 488 328 128 409 110 72 249 115 386 450 167 214 489 227 172 220 336 59 206 315 278 63 395 478 490 165 164 303 449 145 31 418 119 179 373 320 93 255 183 38 58 491 375 416 496 326 ...

output:

248
496 492
495 494
493 491
490 489
488 454
487 486
485 478
484 483
482 480
481 477
479 476
475 450
474 473
472 471
470 468
469 465
467 463
466 462
464 461
460 459
458 457
456 452
455 449
453 451
448 442
447 446
445 441
444 443
440 439
438 437
436 434
435 431
433 429
432 428
427 418
426 425
424 423
...

result:

ok da

Test #58:

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

input:

496
493 491 486 496 481 495 494 492 490 489 473 488 487 472 469 468 485 484 483 464 482 480 463 479 478 477 460 458 476 475 457 456 474 471 455 454 470 453 452 467 449 448 447 446 466 437 465 436 433 432 430 428 462 426 461 425 424 421 420 419 459 417 416 451 410 450 409 408 407 445 405 444 443 442 ...

output:

262
496 493
495 491
494 486
492 481
490 490
489 489
488 473
487 487
485 472
484 469
483 468
482 464
480 480
479 463
478 478
477 477
476 460
475 458
474 457
471 456
470 455
467 454
466 453
465 452
462 449
461 448
459 447
451 446
450 437
445 436
444 433
443 432
442 430
441 428
440 426
439 425
438 424
...

result:

ok da

Test #59:

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

input:

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

output:

248
496 494
493 492
489 488
487 486
485 484
482 480
478 477
476 475
472 471
469 467
465 464
463 462
461 459
457 456
455 453
452 450
449 448
445 442
438 436
435 434
433 429
427 424
421 417
416 415
414 413
410 408
406 404
403 399
396 394
393 392
391 390
389 386
385 379
378 375
373 372
371 370
369 366
...

result:

ok da

Test #60:

score: 0
Accepted
time: 6ms
memory: 10260kb

input:

497
237 201 155 129 345 454 113 11 492 357 300 295 198 442 14 79 288 431 343 64 285 101 316 15 34 293 3 393 384 47 296 402 488 328 128 409 110 72 249 115 386 450 167 214 489 227 172 220 336 59 206 315 278 63 395 478 490 165 164 303 449 145 31 418 119 179 373 320 93 255 183 38 58 491 375 416 496 326 ...

output:

249
497 496
495 494
493 492
491 490
489 488
487 486
485 478
484 483
482 480
481 477
479 476
475 454
474 473
472 471
470 468
469 465
467 463
466 462
464 461
460 459
458 457
456 452
455 450
453 451
449 442
448 431
447 446
445 441
444 443
440 439
438 437
436 434
435 429
433 428
432 427
430 426
425 423
...

result:

ok da

Test #61:

score: 0
Accepted
time: 10ms
memory: 8696kb

input:

497
496 492 490 489 497 495 494 493 488 486 485 484 480 478 491 487 475 483 474 482 471 468 465 464 460 459 481 458 457 456 479 477 455 453 476 473 450 444 443 440 472 439 470 469 435 433 467 432 430 466 429 463 462 428 461 425 420 419 454 418 452 451 416 449 415 413 412 448 409 402 401 400 447 399 ...

output:

259
497 496
495 492
494 490
493 489
491 488
487 486
485 485
484 484
483 480
482 478
481 475
479 474
477 471
476 468
473 465
472 464
470 460
469 459
467 458
466 457
463 456
462 455
461 453
454 450
452 444
451 443
449 440
448 439
447 435
446 433
445 432
442 430
441 429
438 428
437 425
436 420
434 419
...

result:

ok da

Test #62:

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

input:

497
6 1 2 10 11 3 12 4 15 5 7 8 16 17 18 19 21 25 26 30 31 9 32 13 14 20 33 35 37 40 41 43 22 45 23 46 24 27 49 50 28 52 53 29 54 58 59 34 36 38 39 42 44 47 61 48 51 63 55 67 68 69 56 57 72 60 62 77 78 79 80 64 65 82 85 87 88 66 89 91 98 102 70 104 71 111 112 113 117 118 120 73 125 129 130 74 75 131...

output:

249
497 496
495 494
492 490
489 488
486 485
483 482
481 479
478 475
473 472
469 465
464 463
458 457
456 453
452 451
449 447
445 443
440 439
437 434
433 432
431 430
429 427
424 420
416 414
413 412
411 410
405 401
400 397
394 392
391 389
387 386
385 384
383 376
375 373
372 371
370 368
367 366
364 363
...

result:

ok da

Test #63:

score: 0
Accepted
time: 6ms
memory: 8640kb

input:

498
237 201 155 129 345 454 113 11 492 357 300 295 198 442 14 79 288 431 343 64 285 101 316 15 34 293 3 393 384 47 296 402 488 328 128 409 110 72 249 115 386 450 167 214 489 227 172 220 336 59 206 315 278 63 395 478 490 165 164 303 449 145 31 418 119 179 373 320 93 255 183 38 58 491 375 416 496 326 ...

output:

249
498 496
497 494
495 492
493 491
490 489
488 454
487 486
485 478
484 483
482 480
481 477
479 476
475 450
474 473
472 471
470 468
469 465
467 463
466 462
464 461
460 459
458 457
456 452
455 449
453 451
448 442
447 446
445 441
444 443
440 439
438 437
436 434
435 431
433 429
432 428
430 427
426 425
...

result:

ok da

Test #64:

score: 0
Accepted
time: 11ms
memory: 9264kb

input:

498
496 495 494 493 498 497 489 492 491 488 485 490 487 482 486 484 481 479 478 475 483 474 480 477 476 473 471 464 472 462 470 469 459 458 456 468 467 454 466 453 465 450 448 446 463 461 460 445 440 457 455 437 452 434 451 449 433 432 431 428 427 425 447 444 443 442 422 441 419 439 438 436 418 435 ...

output:

272
498 496
497 495
494 494
493 493
492 489
491 491
490 488
487 485
486 482
484 484
483 481
480 479
478 478
477 475
476 474
473 473
472 471
470 464
469 462
468 459
467 458
466 456
465 454
463 453
461 450
460 448
457 446
455 445
452 440
451 437
449 434
447 433
444 432
443 431
442 428
441 427
439 425
...

result:

ok da

Test #65:

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

input:

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

output:

249
498 497
495 494
493 491
490 488
487 486
485 484
482 481
480 478
477 475
473 472
470 469
467 462
461 456
455 448
447 446
445 444
443 441
440 432
429 427
424 423
419 418
417 414
411 410
407 405
404 403
402 399
397 396
391 390
388 386
384 383
381 378
375 370
369 366
364 362
360 359
356 355
354 353
...

result:

ok da

Test #66:

score: 0
Accepted
time: 9ms
memory: 8644kb

input:

499
237 201 155 129 345 454 113 11 492 357 300 295 198 442 14 79 288 431 343 64 285 101 316 15 34 293 3 393 384 47 296 402 488 328 128 409 110 72 249 115 386 450 167 214 489 227 172 220 336 59 206 315 278 63 395 478 490 165 164 303 449 145 31 418 119 179 373 320 93 255 183 38 58 491 375 416 496 326 ...

output:

250
499 498
497 496
495 494
493 492
491 490
489 488
487 486
485 478
484 483
482 480
481 477
479 476
475 454
474 473
472 471
470 468
469 465
467 463
466 462
464 461
460 459
458 457
456 452
455 450
453 451
449 442
448 431
447 446
445 441
444 443
440 439
438 437
436 434
435 429
433 428
432 427
430 426
...

result:

ok da

Test #67:

score: 0
Accepted
time: 11ms
memory: 9312kb

input:

499
498 496 492 499 497 495 494 493 491 489 486 484 481 490 488 487 478 485 483 474 465 482 464 480 463 461 460 479 477 459 476 456 475 455 473 472 471 470 453 469 452 451 448 447 468 467 446 445 466 439 434 433 462 458 457 454 450 449 432 444 443 430 442 441 428 440 438 437 427 422 436 421 420 418 ...

output:

266
499 498
497 496
495 492
494 494
493 493
491 491
490 489
488 486
487 484
485 481
483 478
482 474
480 465
479 464
477 463
476 461
475 460
473 459
472 456
471 455
470 470
469 453
468 452
467 451
466 448
462 447
458 446
457 445
454 439
450 434
449 433
444 432
443 443
442 430
441 441
440 428
438 438
...

result:

ok da

Test #68:

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

input:

499
5 7 11 12 13 1 17 18 20 22 24 2 3 25 26 27 4 29 31 6 32 33 8 9 10 14 15 34 35 16 19 21 23 28 41 30 36 37 42 45 38 39 46 49 40 50 51 43 52 44 47 48 54 59 53 65 55 67 68 71 56 57 74 75 78 79 58 81 86 87 88 89 60 91 61 98 99 100 102 103 112 62 113 63 114 64 115 116 66 117 69 120 70 121 72 122 124 7...

output:

250
499 498
497 496
495 494
493 492
490 485
484 483
482 480
478 477
476 475
474 471
470 469
468 467
465 463
461 459
456 454
453 450
449 446
444 442
441 440
439 438
436 432
431 430
429 428
427 426
425 422
421 415
414 413
412 408
406 405
404 402
398 397
389 387
386 384
383 381
380 379
378 377
373 371
...

result:

ok da

Test #69:

score: 0
Accepted
time: 9ms
memory: 8580kb

input:

500
237 201 155 129 345 454 113 11 492 357 300 295 198 442 14 79 288 431 343 64 285 101 316 15 34 293 3 393 384 47 296 402 488 328 128 409 110 72 249 115 386 450 167 214 489 227 172 220 336 59 206 315 278 63 395 478 490 165 164 303 449 145 31 418 119 179 373 320 93 255 183 38 58 491 375 416 496 326 ...

output:

250
500 496
499 498
497 494
495 492
493 491
490 489
488 454
487 486
485 478
484 483
482 480
481 477
479 476
475 450
474 473
472 471
470 468
469 465
467 463
466 462
464 461
460 459
458 457
455 452
453 451
449 442
448 431
447 446
445 441
444 443
440 439
438 437
436 434
435 429
433 428
432 427
430 426
...

result:

ok da

Test #70:

score: 0
Accepted
time: 11ms
memory: 8876kb

input:

500
499 500 495 490 498 489 497 496 488 486 484 482 478 477 476 475 494 493 470 492 491 469 468 467 487 463 458 485 483 481 450 444 442 480 479 441 474 473 472 440 439 438 437 471 436 435 466 434 430 465 429 428 425 424 423 464 422 421 462 461 460 459 419 417 415 457 413 456 455 454 453 452 411 410 ...

output:

254
500 499
498 495
497 490
496 489
494 488
493 486
492 484
491 482
487 478
485 477
483 476
481 475
480 470
479 469
474 468
473 467
472 463
471 458
466 450
465 444
464 442
462 441
461 440
460 439
459 438
457 437
456 436
455 435
454 434
453 430
452 429
451 428
449 425
448 424
447 423
446 422
445 421
...

result:

ok da

Test #71:

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

input:

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

output:

250
500 499
498 496
495 494
493 492
489 486
483 482
480 477
476 475
474 473
472 471
469 468
466 465
464 463
462 461
456 455
453 452
451 450
449 448
445 441
439 438
437 436
435 432
431 430
427 425
424 423
422 421
420 417
414 410
409 407
405 404
403 400
397 395
394 393
392 390
385 382
381 374
370 369
...

result:

ok da

Test #72:

score: 0
Accepted
time: 145ms
memory: 9156kb

input:

7495
4964 650 6871 129 3768 1551 6223 3875 6536 6438 5015 2528 1952 6441 3809 5102 4857 1821 343 4675 5029 7078 5456 3073 5001 5755 7275 3342 384 1608 1397 4856 1282 6194 878 4679 3536 6512 520 5397 2350 3380 1127 3969 2691 227 7293 3378 2728 3182 4059 6851 6641 900 2747 7195 4531 165 6187 4029 522 ...

output:

3748
7495 7485
7494 7491
7493 7492
7490 7489
7488 7487
7486 7469
7484 7475
7483 7480
7482 7477
7481 7478
7479 7474
7476 7473
7472 7471
7470 7468
7467 7466
7465 7464
7463 7459
7462 7454
7461 7458
7460 7457
7456 7455
7453 7452
7451 7450
7449 7447
7448 7445
7446 7444
7443 7415
7442 7441
7440 7439
7438 ...

result:

ok da

Test #73:

score: 0
Accepted
time: 135ms
memory: 8736kb

input:

7495
7495 7490 7488 7486 7494 7481 7480 7478 7477 7475 7463 7460 7459 7493 7492 7458 7491 7489 7487 7485 7457 7455 7484 7483 7454 7453 7452 7450 7448 7482 7444 7442 7440 7435 7479 7431 7476 7474 7426 7473 7423 7422 7421 7418 7472 7471 7470 7469 7468 7467 7414 7413 7411 7409 7408 7405 7466 7465 7403 ...

output:

3773
7495 7495
7494 7490
7493 7488
7492 7486
7491 7481
7489 7480
7487 7478
7485 7477
7484 7475
7483 7463
7482 7460
7479 7459
7476 7458
7474 7457
7473 7455
7472 7454
7471 7453
7470 7452
7469 7450
7468 7448
7467 7444
7466 7442
7465 7440
7464 7435
7462 7431
7461 7426
7456 7423
7451 7422
7449 7421
7447 ...

result:

ok da

Test #74:

score: 0
Accepted
time: 22ms
memory: 9748kb

input:

7495
1 3 5 7 8 2 10 4 11 13 6 14 17 9 21 12 15 23 25 26 16 18 31 19 20 32 35 36 37 42 22 45 46 24 27 28 47 48 49 29 51 52 58 60 30 33 34 38 62 63 39 40 64 65 66 70 72 73 41 74 43 75 77 44 50 53 78 79 54 81 82 55 56 83 57 87 88 89 93 59 61 67 68 97 69 100 102 107 108 110 112 113 118 119 120 71 124 12...

output:

3748
7494 7493
7492 7491
7489 7488
7487 7486
7485 7484
7483 7482
7479 7476
7475 7474
7473 7468
7465 7464
7462 7456
7455 7454
7453 7452
7451 7449
7445 7441
7440 7439
7438 7436
7435 7433
7431 7430
7428 7427
7425 7421
7419 7408
7405 7404
7403 7402
7401 7399
7396 7395
7394 7392
7391 7389
7386 7383
7382 ...

result:

ok da

Test #75:

score: 0
Accepted
time: 146ms
memory: 9284kb

input:

7496
4964 650 6871 129 3768 1551 6223 3875 6536 6438 5015 2528 1952 6441 3809 5102 4857 1821 343 4675 5029 7078 5456 3073 5001 5755 7275 3342 384 1608 1397 4856 1282 6194 878 4679 3536 6512 520 5397 2350 3380 1127 3969 2691 227 7293 3378 2728 3182 4059 6851 6641 900 2747 7195 4531 165 6187 4029 522 ...

output:

3748
7496 7495
7494 7491
7493 7492
7490 7489
7488 7487
7486 7485
7484 7475
7483 7480
7482 7477
7481 7478
7479 7474
7476 7473
7472 7471
7470 7469
7468 7466
7467 7465
7464 7459
7463 7447
7462 7454
7461 7458
7460 7457
7456 7455
7453 7452
7451 7450
7449 7443
7448 7445
7446 7444
7442 7441
7440 7439
7438 ...

result:

ok da

Test #76:

score: 0
Accepted
time: 133ms
memory: 10384kb

input:

7496
7493 7496 7495 7490 7494 7489 7492 7491 7484 7476 7488 7487 7473 7471 7470 7468 7467 7465 7462 7456 7486 7455 7453 7451 7485 7446 7483 7482 7481 7480 7479 7478 7477 7445 7444 7475 7439 7435 7474 7472 7433 7432 7469 7430 7429 7428 7466 7464 7463 7427 7461 7460 7423 7422 7420 7459 7458 7418 7415 ...

output:

3779
7496 7493
7495 7495
7494 7490
7492 7489
7491 7491
7488 7484
7487 7476
7486 7473
7485 7471
7483 7470
7482 7468
7481 7467
7480 7465
7479 7462
7478 7456
7477 7455
7475 7453
7474 7451
7472 7446
7469 7445
7466 7444
7464 7439
7463 7435
7461 7433
7460 7432
7459 7430
7458 7429
7457 7428
7454 7427
7452 ...

result:

ok da

Test #77:

score: 0
Accepted
time: 19ms
memory: 10124kb

input:

7496
4 8 9 14 16 1 19 2 3 5 6 20 21 23 7 25 32 10 33 34 35 36 38 11 39 12 40 13 15 17 43 45 46 47 18 48 51 54 22 58 61 24 62 67 68 26 27 28 72 29 73 75 76 80 30 81 31 37 41 42 82 83 44 85 49 87 50 91 100 52 53 55 56 57 101 103 104 105 106 59 107 109 112 60 63 64 114 122 65 124 66 126 69 70 71 74 127...

output:

3748
7495 7494
7493 7492
7490 7488
7486 7485
7484 7482
7481 7479
7476 7475
7474 7472
7470 7468
7467 7466
7465 7463
7462 7460
7459 7458
7456 7455
7452 7451
7449 7446
7443 7439
7438 7436
7433 7431
7430 7429
7428 7427
7426 7425
7424 7421
7418 7413
7411 7410
7407 7404
7403 7397
7395 7387
7386 7385
7384 ...

result:

ok da

Test #78:

score: 0
Accepted
time: 142ms
memory: 8944kb

input:

7497
4964 650 6871 129 3768 1551 6223 3875 6536 6438 5015 2528 1952 6441 3809 5102 4857 1821 343 4675 5029 7078 5456 3073 5001 5755 7275 3342 384 1608 1397 4856 1282 6194 878 4679 3536 6512 520 5397 2350 3380 1127 3969 2691 227 7293 3378 2728 3182 4059 6851 6641 900 2747 7195 4531 165 6187 4029 522 ...

output:

3749
7497 7495
7496 7494
7493 7492
7491 7485
7490 7489
7488 7487
7486 7469
7484 7475
7483 7480
7482 7477
7481 7478
7479 7474
7476 7473
7472 7471
7470 7468
7467 7466
7465 7464
7463 7459
7462 7454
7461 7458
7460 7457
7456 7455
7453 7452
7451 7450
7449 7447
7448 7445
7446 7444
7443 7415
7442 7441
7440 ...

result:

ok da

Test #79:

score: 0
Accepted
time: 136ms
memory: 8744kb

input:

7497
7493 7490 7489 7488 7487 7486 7497 7485 7496 7482 7495 7481 7480 7479 7478 7494 7492 7477 7470 7491 7469 7484 7483 7476 7468 7475 7466 7462 7474 7461 7473 7458 7457 7455 7472 7454 7453 7450 7447 7471 7445 7467 7465 7444 7464 7443 7442 7440 7463 7439 7460 7459 7438 7437 7435 7430 7456 7452 7427 ...

output:

3790
7497 7493
7496 7490
7495 7489
7494 7488
7492 7487
7491 7486
7485 7485
7484 7482
7483 7481
7480 7480
7479 7479
7478 7478
7477 7477
7476 7470
7475 7469
7474 7468
7473 7466
7472 7462
7471 7461
7467 7458
7465 7457
7464 7455
7463 7454
7460 7453
7459 7450
7456 7447
7452 7445
7451 7444
7449 7443
7448 ...

result:

ok da

Test #80:

score: 0
Accepted
time: 19ms
memory: 9236kb

input:

7497
4 1 7 11 14 15 18 22 2 23 3 5 26 34 35 6 8 36 38 9 10 12 13 39 40 43 44 45 16 17 47 48 49 19 50 57 59 60 20 21 24 25 62 27 28 64 67 68 29 30 31 71 76 77 79 32 81 33 82 84 85 86 87 88 37 41 90 92 93 95 42 96 97 103 105 46 51 52 53 107 108 109 110 54 55 111 112 113 56 115 58 61 63 117 65 118 119 ...

output:

3749
7496 7494
7492 7491
7490 7488
7487 7485
7483 7482
7481 7480
7479 7475
7469 7467
7466 7464
7461 7458
7455 7454
7452 7451
7449 7447
7445 7444
7443 7442
7440 7438
7437 7436
7435 7434
7433 7432
7429 7428
7427 7425
7424 7418
7417 7416
7415 7412
7410 7409
7404 7402
7401 7396
7394 7392
7390 7389
7388 ...

result:

ok da

Test #81:

score: 0
Accepted
time: 146ms
memory: 8964kb

input:

7498
4964 650 6871 129 3768 1551 6223 3875 6536 6438 5015 2528 1952 6441 3809 5102 4857 1821 343 4675 5029 7078 5456 3073 5001 5755 7275 3342 384 1608 1397 4856 1282 6194 878 4679 3536 6512 520 5397 2350 3380 1127 3969 2691 227 7293 3378 2728 3182 4059 6851 6641 900 2747 7195 4531 165 6187 4029 522 ...

output:

3749
7498 7497
7496 7495
7494 7491
7493 7492
7490 7489
7488 7487
7486 7485
7484 7475
7483 7480
7482 7477
7481 7478
7479 7474
7476 7473
7472 7471
7470 7469
7468 7466
7467 7465
7464 7459
7463 7447
7462 7454
7461 7458
7460 7457
7456 7455
7453 7452
7451 7450
7449 7443
7448 7445
7446 7444
7442 7441
7440 ...

result:

ok da

Test #82:

score: 0
Accepted
time: 132ms
memory: 10200kb

input:

7498
7495 7494 7492 7488 7498 7497 7487 7486 7485 7496 7484 7483 7493 7491 7482 7490 7480 7489 7478 7477 7473 7472 7469 7481 7465 7464 7479 7476 7475 7463 7462 7459 7458 7474 7457 7456 7471 7470 7454 7452 7450 7447 7446 7468 7467 7444 7443 7439 7466 7438 7461 7437 7460 7455 7435 7434 7453 7433 7431 ...

output:

3768
7498 7495
7497 7494
7496 7492
7493 7488
7491 7487
7490 7486
7489 7485
7484 7484
7483 7483
7482 7482
7481 7480
7479 7478
7477 7477
7476 7473
7475 7472
7474 7469
7471 7465
7470 7464
7468 7463
7467 7462
7466 7459
7461 7458
7460 7457
7456 7456
7455 7454
7453 7452
7451 7450
7449 7447
7448 7446
7445 ...

result:

ok da

Test #83:

score: 0
Accepted
time: 23ms
memory: 8908kb

input:

7498
4 5 6 1 9 2 3 7 8 13 10 16 17 20 21 25 11 26 28 12 14 15 18 19 22 23 24 30 31 27 33 29 32 39 48 34 35 49 36 51 37 54 38 40 55 41 56 42 43 57 58 59 44 61 64 65 45 71 46 47 50 52 72 53 73 77 78 60 62 88 92 93 63 66 95 99 67 68 100 69 70 74 75 101 76 79 102 103 106 80 81 109 115 116 117 82 120 124...

output:

3749
7498 7497
7495 7494
7493 7492
7491 7490
7489 7488
7487 7485
7484 7481
7480 7478
7477 7476
7475 7471
7470 7468
7461 7460
7457 7455
7453 7452
7451 7448
7447 7446
7441 7440
7439 7438
7437 7434
7433 7432
7430 7428
7425 7424
7423 7421
7420 7416
7415 7414
7412 7409
7408 7407
7403 7402
7399 7397
7394 ...

result:

ok da

Test #84:

score: 0
Accepted
time: 146ms
memory: 9544kb

input:

7499
4964 650 6871 129 3768 1551 6223 3875 6536 6438 5015 2528 1952 6441 3809 5102 4857 1821 343 4675 5029 7078 5456 3073 5001 5755 7275 3342 384 1608 1397 4856 1282 6194 878 4679 3536 6512 520 5397 2350 3380 1127 3969 2691 227 7293 3378 2728 3182 4059 6851 6641 900 2747 7195 4531 165 6187 4029 522 ...

output:

3750
7499 7497
7498 7495
7496 7494
7493 7492
7491 7485
7490 7489
7488 7487
7486 7469
7484 7475
7483 7480
7482 7477
7481 7478
7479 7474
7476 7473
7472 7471
7470 7468
7467 7466
7465 7464
7463 7459
7462 7454
7461 7458
7460 7457
7456 7455
7453 7452
7451 7450
7449 7447
7448 7445
7446 7444
7443 7415
7442 ...

result:

ok da

Test #85:

score: 0
Accepted
time: 136ms
memory: 10244kb

input:

7499
7498 7499 7491 7497 7496 7487 7495 7494 7485 7481 7479 7493 7492 7490 7489 7477 7488 7476 7471 7486 7470 7484 7464 7483 7463 7482 7460 7480 7459 7478 7475 7454 7452 7474 7473 7472 7451 7450 7449 7448 7446 7469 7468 7467 7466 7465 7443 7462 7438 7461 7458 7457 7456 7428 7455 7426 7425 7424 7423 ...

output:

3766
7499 7498
7497 7491
7496 7496
7495 7487
7494 7494
7493 7485
7492 7481
7490 7479
7489 7489
7488 7477
7486 7476
7484 7471
7483 7470
7482 7464
7480 7463
7478 7460
7475 7459
7474 7454
7473 7452
7472 7472
7469 7451
7468 7450
7467 7449
7466 7448
7465 7446
7462 7443
7461 7438
7458 7458
7457 7457
7456 ...

result:

ok da

Test #86:

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

input:

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

output:

3750
7499 7497
7496 7495
7494 7493
7491 7490
7489 7488
7486 7479
7478 7477
7476 7473
7472 7470
7469 7464
7463 7460
7459 7456
7452 7450
7449 7447
7446 7445
7442 7441
7440 7439
7434 7432
7430 7429
7427 7425
7423 7420
7417 7413
7412 7411
7410 7409
7407 7406
7405 7398
7397 7396
7394 7393
7392 7391
7390 ...

result:

ok da

Test #87:

score: 0
Accepted
time: 141ms
memory: 9036kb

input:

7500
4964 650 6871 129 3768 1551 6223 3875 6536 6438 5015 2528 1952 6441 3809 5102 4857 1821 343 4675 5029 7078 5456 3073 5001 5755 7275 3342 384 1608 1397 4856 1282 6194 878 4679 3536 6512 520 5397 2350 3380 1127 3969 2691 227 7293 3378 2728 3182 4059 6851 6641 900 2747 7195 4531 165 6187 4029 522 ...

output:

3750
7500 7499
7498 7497
7496 7495
7494 7491
7493 7492
7490 7489
7488 7487
7486 7485
7484 7475
7483 7480
7482 7477
7481 7478
7479 7474
7476 7473
7472 7471
7470 7469
7468 7466
7467 7465
7464 7459
7463 7447
7462 7454
7461 7458
7460 7457
7456 7455
7453 7452
7451 7450
7449 7443
7448 7445
7446 7444
7442 ...

result:

ok da

Test #88:

score: 0
Accepted
time: 139ms
memory: 9800kb

input:

7500
7500 7498 7499 7497 7492 7490 7488 7485 7481 7479 7476 7471 7496 7470 7469 7495 7494 7466 7493 7491 7460 7489 7459 7458 7456 7455 7487 7453 7486 7450 7447 7484 7446 7443 7440 7436 7435 7483 7482 7430 7424 7423 7422 7480 7421 7478 7418 7416 7477 7413 7475 7411 7474 7473 7472 7468 7410 7467 7408 ...

output:

3788
7500 7500
7499 7498
7497 7497
7496 7492
7495 7490
7494 7488
7493 7485
7491 7481
7489 7479
7487 7476
7486 7471
7484 7470
7483 7469
7482 7466
7480 7460
7478 7459
7477 7458
7475 7456
7474 7455
7473 7453
7472 7450
7468 7447
7467 7446
7465 7443
7464 7440
7463 7436
7462 7435
7461 7430
7457 7424
7454 ...

result:

ok da

Test #89:

score: 0
Accepted
time: 23ms
memory: 9556kb

input:

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

output:

3750
7500 7499
7497 7496
7494 7493
7492 7491
7489 7488
7487 7486
7483 7481
7479 7478
7477 7476
7475 7472
7471 7470
7468 7467
7466 7462
7461 7460
7459 7457
7455 7454
7450 7447
7444 7443
7442 7439
7438 7435
7433 7431
7429 7428
7427 7425
7422 7421
7420 7419
7417 7411
7409 7408
7407 7406
7405 7404
7402 ...

result:

ok da

Test #90:

score: 0
Accepted
time: 2569ms
memory: 11104kb

input:

99995
64268 66535 9758 42907 84212 83488 27748 86198 80658 11614 93419 2528 96160 79473 83517 43109 37111 46603 93665 54540 84236 62717 24719 57225 8333 15728 40821 31719 13096 75018 76890 46244 75863 59618 67460 10326 84775 11276 83363 72071 9353 94316 9469 3969 78568 53071 96835 50125 2728 46756 5...

output:

49998
99995 99994
99993 99991
99992 99990
99989 99987
99988 99986
99985 99984
99983 99981
99982 99980
99979 99978
99977 99975
99976 99974
99973 99972
99971 99970
99969 99968
99967 99966
99965 99964
99963 99962
99961 98550
99960 99959
99958 99957
99956 99830
99955 99954
99953 99952
99951 99950
99949 ...

result:

ok da

Test #91:

score: 0
Accepted
time: 1686ms
memory: 11020kb

input:

99995
99992 99990 99995 99994 99989 99993 99985 99991 99979 99974 99970 99988 99987 99986 99969 99984 99965 99983 99982 99964 99981 99962 99961 99960 99958 99955 99980 99953 99978 99951 99977 99976 99950 99975 99948 99946 99939 99973 99936 99935 99930 99928 99972 99924 99971 99968 99923 99922 99920 ...

output:

50171
99995 99992
99994 99990
99993 99989
99991 99985
99988 99979
99987 99974
99986 99970
99984 99969
99983 99965
99982 99982
99981 99964
99980 99962
99978 99961
99977 99960
99976 99958
99975 99955
99973 99953
99972 99951
99971 99950
99968 99948
99967 99946
99966 99939
99963 99936
99959 99935
99957 ...

result:

ok da

Test #92:

score: 0
Accepted
time: 462ms
memory: 11344kb

input:

99995
4 5 6 8 10 1 11 2 3 14 16 19 21 7 22 9 24 26 27 12 29 31 35 43 13 47 15 17 48 18 51 20 23 25 28 52 53 55 30 56 58 32 60 61 33 34 36 63 37 38 64 65 39 66 70 40 72 77 86 88 89 41 42 44 45 46 91 49 93 94 95 98 100 50 101 54 102 103 57 59 62 67 104 108 68 112 116 117 118 119 69 120 71 73 74 123 12...

output:

49998
99995 99994
99992 99991
99990 99989
99988 99987
99986 99985
99982 99980
99978 99977
99973 99971
99970 99969
99968 99966
99963 99962
99959 99957
99955 99954
99953 99952
99951 99950
99949 99943
99942 99938
99934 99931
99929 99928
99925 99924
99921 99918
99914 99913
99911 99910
99909 99908
99906 ...

result:

ok da

Test #93:

score: 0
Accepted
time: 2572ms
memory: 11024kb

input:

99996
64268 66535 9758 42907 84212 83488 27748 86198 80658 11614 93419 2528 96160 79473 83517 43109 37111 46603 93665 54540 84236 62717 24719 57225 8333 15728 40821 31719 13096 75018 76890 46244 75863 59618 67460 10326 84775 11276 83363 72071 9353 94316 9469 3969 78568 53071 96835 50125 2728 46756 5...

output:

49998
99996 99995
99994 99991
99993 99989
99992 99990
99988 99987
99986 99985
99984 99961
99983 99981
99982 99980
99979 99978
99977 99975
99976 99974
99973 99972
99971 99970
99969 99968
99967 99966
99965 99964
99963 99962
99960 99959
99958 99957
99956 99830
99955 99954
99953 99952
99951 99950
99949 ...

result:

ok da

Test #94:

score: 0
Accepted
time: 1776ms
memory: 11152kb

input:

99996
99996 99994 99993 99992 99990 99995 99988 99991 99981 99989 99978 99975 99987 99974 99986 99973 99970 99985 99984 99983 99982 99980 99968 99979 99967 99964 99963 99960 99959 99956 99977 99976 99972 99971 99955 99954 99969 99966 99950 99948 99943 99941 99965 99940 99938 99962 99936 99933 99961 ...

output:

50088
99996 99996
99995 99994
99993 99993
99992 99992
99991 99990
99989 99988
99987 99981
99986 99978
99985 99975
99984 99974
99983 99973
99982 99970
99980 99980
99979 99968
99977 99967
99976 99964
99972 99963
99971 99960
99969 99959
99966 99956
99965 99955
99962 99954
99961 99950
99958 99948
99957 ...

result:

ok da

Test #95:

score: 0
Accepted
time: 447ms
memory: 11456kb

input:

99996
4 1 2 5 7 3 6 10 8 9 16 17 18 11 20 12 13 14 21 15 27 28 30 31 32 19 22 23 33 37 38 40 41 24 25 42 43 44 47 26 29 48 34 35 50 36 39 53 45 59 46 62 49 51 63 69 70 52 54 73 55 75 82 83 89 96 56 97 98 99 57 100 58 101 107 60 109 110 112 61 64 65 66 113 114 67 116 120 122 130 68 131 71 137 72 74 7...

output:

49998
99996 99995
99993 99992
99991 99990
99987 99986
99985 99983
99979 99976
99974 99973
99972 99969
99964 99963
99961 99959
99958 99957
99956 99955
99952 99948
99947 99945
99944 99942
99941 99936
99935 99933
99932 99927
99926 99925
99924 99922
99921 99919
99918 99916
99915 99913
99910 99908
99907 ...

result:

ok da

Test #96:

score: 0
Accepted
time: 2569ms
memory: 11100kb

input:

99997
64268 66535 9758 42907 84212 83488 27748 86198 80658 11614 93419 2528 96160 79473 83517 43109 37111 46603 93665 54540 84236 62717 24719 57225 8333 15728 40821 31719 13096 75018 76890 46244 75863 59618 67460 10326 84775 11276 83363 72071 9353 94316 9469 3969 78568 53071 96835 50125 2728 46756 5...

output:

49999
99997 99995
99996 99994
99993 99991
99992 99990
99989 99987
99988 99986
99985 99984
99983 99981
99982 99980
99979 99978
99977 99975
99976 99974
99973 99972
99971 99970
99969 99968
99967 99966
99965 99964
99963 99962
99961 98550
99960 99959
99958 99957
99956 99830
99955 99954
99953 99952
99951 ...

result:

ok da

Test #97:

score: 0
Accepted
time: 1736ms
memory: 11244kb

input:

99997
99993 99989 99988 99997 99996 99987 99995 99983 99982 99994 99992 99991 99981 99979 99990 99978 99977 99976 99974 99986 99985 99972 99970 99984 99980 99975 99968 99973 99971 99967 99963 99962 99956 99969 99966 99965 99964 99961 99960 99955 99954 99952 99959 99951 99948 99958 99946 99957 99953 ...

output:

50114
99997 99993
99996 99989
99995 99988
99994 99987
99992 99983
99991 99982
99990 99981
99986 99979
99985 99978
99984 99977
99980 99976
99975 99974
99973 99972
99971 99970
99969 99968
99967 99967
99966 99963
99965 99962
99964 99956
99961 99961
99960 99960
99959 99955
99958 99954
99957 99952
99953 ...

result:

ok da

Test #98:

score: 0
Accepted
time: 481ms
memory: 11440kb

input:

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

output:

49999
99996 99995
99991 99988
99987 99985
99983 99982
99981 99980
99978 99977
99975 99974
99972 99971
99966 99965
99963 99961
99960 99959
99958 99956
99954 99952
99950 99948
99946 99945
99944 99942
99940 99939
99938 99937
99936 99935
99934 99933
99931 99928
99922 99921
99920 99917
99915 99914
99913 ...

result:

ok da

Test #99:

score: 0
Accepted
time: 2575ms
memory: 11028kb

input:

99998
64268 66535 9758 42907 84212 83488 27748 86198 80658 11614 93419 2528 96160 79473 83517 43109 37111 46603 93665 54540 84236 62717 24719 57225 8333 15728 40821 31719 13096 75018 76890 46244 75863 59618 67460 10326 84775 11276 83363 72071 9353 94316 9469 3969 78568 53071 96835 50125 2728 46756 5...

output:

49999
99998 99984
99997 99995
99996 99994
99993 99991
99992 99990
99989 99987
99988 99986
99985 99981
99983 99980
99982 99979
99978 99968
99977 99975
99976 99974
99973 99972
99971 99970
99969 99967
99966 99965
99964 99961
99963 99962
99960 99959
99958 99957
99956 99830
99955 99954
99953 99952
99951 ...

result:

ok da

Test #100:

score: 0
Accepted
time: 1712ms
memory: 11148kb

input:

99998
99996 99994 99998 99997 99991 99995 99989 99993 99992 99988 99986 99985 99982 99980 99990 99979 99987 99984 99983 99978 99977 99973 99972 99971 99969 99981 99976 99975 99968 99966 99974 99965 99959 99970 99958 99967 99957 99956 99954 99951 99950 99949 99948 99964 99963 99962 99947 99946 99945 ...

output:

50122
99998 99996
99997 99994
99995 99991
99993 99989
99992 99992
99990 99988
99987 99986
99985 99985
99984 99982
99983 99980
99981 99979
99978 99978
99977 99977
99976 99973
99975 99972
99974 99971
99970 99969
99968 99968
99967 99966
99965 99965
99964 99959
99963 99958
99962 99957
99961 99956
99960 ...

result:

ok da

Test #101:

score: 0
Accepted
time: 449ms
memory: 11300kb

input:

99998
2 1 4 6 3 5 8 12 7 17 9 18 20 22 25 26 28 10 34 35 11 13 40 14 43 46 15 16 19 47 48 21 51 52 53 23 55 24 57 27 29 30 31 59 32 63 65 66 68 33 69 36 70 71 37 72 74 38 39 75 41 77 42 79 81 83 85 86 89 44 90 91 45 49 92 95 96 98 50 100 104 54 56 58 107 109 110 60 61 111 113 62 115 64 118 123 125 6...

output:

49999
99998 99997
99994 99993
99992 99990
99989 99988
99987 99985
99984 99983
99982 99981
99979 99977
99976 99975
99974 99972
99971 99965
99964 99963
99962 99959
99956 99954
99952 99951
99949 99948
99943 99942
99939 99936
99934 99932
99931 99930
99929 99928
99925 99924
99919 99918
99917 99915
99914 ...

result:

ok da

Test #102:

score: 0
Accepted
time: 2573ms
memory: 11076kb

input:

99999
64268 66535 9758 42907 84212 83488 27748 86198 80658 11614 93419 2528 96160 79473 83517 43109 37111 46603 93665 54540 84236 62717 24719 57225 8333 15728 40821 31719 13096 75018 76890 46244 75863 59618 67460 10326 84775 11276 83363 72071 9353 94316 9469 3969 78568 53071 96835 50125 2728 46756 5...

output:

50000
99999 99998
99997 99995
99996 99994
99993 99991
99992 99990
99989 99987
99988 99986
99985 99984
99983 99981
99982 99980
99979 99978
99977 99975
99976 99974
99973 99972
99971 99970
99969 99968
99967 99966
99965 99964
99963 99962
99961 98550
99960 99959
99958 99957
99956 99830
99955 99954
99953 ...

result:

ok da

Test #103:

score: 0
Accepted
time: 1708ms
memory: 11144kb

input:

99999
99997 99999 99995 99987 99986 99984 99998 99978 99977 99976 99996 99975 99994 99993 99971 99969 99992 99965 99991 99990 99962 99989 99960 99988 99985 99983 99982 99957 99953 99981 99950 99980 99949 99979 99946 99974 99973 99972 99943 99970 99968 99942 99967 99966 99964 99963 99961 99959 99941 ...

output:

50253
99999 99997
99998 99995
99996 99987
99994 99986
99993 99984
99992 99978
99991 99977
99990 99976
99989 99975
99988 99971
99985 99969
99983 99965
99982 99962
99981 99960
99980 99957
99979 99953
99974 99950
99973 99949
99972 99946
99970 99943
99968 99968
99967 99942
99966 99966
99964 99964
99963 ...

result:

ok da

Test #104:

score: 0
Accepted
time: 471ms
memory: 11428kb

input:

99999
2 4 8 1 9 10 3 13 5 14 6 7 18 11 12 29 32 34 15 41 42 16 17 19 20 21 43 47 54 22 23 24 56 25 26 57 27 58 59 28 30 61 31 63 33 35 36 65 66 37 38 69 70 39 40 74 44 75 45 46 48 49 50 51 52 53 55 60 76 62 64 77 78 79 67 81 68 85 87 88 93 94 98 102 105 110 112 113 114 115 71 116 72 118 73 121 122 1...

output:

50000
99999 99996
99995 99993
99991 99990
99989 99987
99986 99985
99983 99979
99978 99977
99975 99973
99972 99970
99968 99965
99964 99963
99958 99956
99955 99953
99952 99950
99949 99948
99947 99946
99943 99939
99937 99932
99931 99930
99927 99925
99924 99923
99919 99918
99915 99914
99913 99912
99907 ...

result:

ok da

Test #105:

score: 0
Accepted
time: 2565ms
memory: 11308kb

input:

100000
64268 66535 9758 42907 84212 83488 27748 86198 80658 11614 93419 2528 96160 79473 83517 43109 37111 46603 93665 54540 84236 62717 24719 57225 8333 15728 40821 31719 13096 75018 76890 46244 75863 59618 67460 10326 84775 11276 83363 72071 9353 94316 9469 3969 78568 53071 96835 50125 2728 46756 ...

output:

50000
100000 99999
99998 99984
99997 99995
99996 99994
99993 99991
99992 99990
99989 99987
99988 99986
99985 99981
99983 99980
99982 99979
99978 99968
99977 99975
99976 99974
99973 99972
99971 99970
99969 99967
99966 99965
99964 99961
99963 99962
99960 99959
99958 99957
99956 99830
99955 99954
99953...

result:

ok da

Test #106:

score: 0
Accepted
time: 1775ms
memory: 11108kb

input:

100000
99999 100000 99995 99998 99986 99984 99981 99974 99972 99997 99971 99967 99996 99965 99957 99956 99994 99955 99993 99992 99991 99990 99954 99989 99953 99952 99988 99987 99947 99940 99939 99938 99937 99985 99983 99982 99980 99927 99926 99979 99920 99978 99977 99976 99918 99975 99973 99970 9996...

output:

50194
100000 99999
99998 99995
99997 99986
99996 99984
99994 99981
99993 99974
99992 99972
99991 99971
99990 99967
99989 99965
99988 99957
99987 99956
99985 99955
99983 99954
99982 99953
99980 99952
99979 99947
99978 99940
99977 99939
99976 99938
99975 99937
99973 99927
99970 99926
99969 99920
99968...

result:

ok da

Test #107:

score: 0
Accepted
time: 463ms
memory: 11452kb

input:

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

output:

50000
100000 99999
99998 99997
99994 99992
99989 99987
99982 99981
99978 99973
99972 99971
99967 99966
99965 99964
99963 99960
99959 99958
99956 99954
99950 99948
99947 99946
99944 99943
99942 99941
99940 99935
99934 99932
99931 99930
99929 99926
99923 99918
99917 99914
99913 99911
99910 99909
99907...

result:

ok da

Test #108:

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

input:

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

output:

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

result:

ok da

Test #109:

score: -100
Wrong Answer
time: 1ms
memory: 8592kb

input:

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

output:

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

result:

wrong answer jury have better solution