QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#61323#2555. Two Bulletsalpha1022WA 3967ms208780kbC++145.2kb2022-11-12 09:59:012022-11-12 09:59:03

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-12 09:59:03]
  • 评测
  • 测评结果:WA
  • 用时:3967ms
  • 内存:208780kb
  • [2022-11-12 09:59:01]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

const int inf = 0x3f3f3f3f;

const int N = 1e5;

int n, p[N + 5], q[N + 5];
int level[N + 5];
int a[N + 5], b[N + 5];

struct BinaryIndexedTree {
  int c[N + 5];
  void update(int x, int k) {
    for (; x <= n; x += x & -x) c[x] = max(c[x], k);
  }
  int query(int x) {
    int ret = 0;
    for (; x; x &= x - 1) ret = max(ret, c[x]);
    return ret;
  }
} bit;

struct TreeOfTree {
  struct segnode {
    int max;
    int ls, rs;
  } seg[N * 700 + 5];
  void insert(int x, int k, int &u, int tl, int tr) {
    static int tot = 0;
    if (!u) u = ++tot;
    seg[u].max = max(seg[u].max, k);
    if (tl == tr) return ;
    int mid = (tl + tr) >> 1;
    if (x <= mid) insert(x, k, seg[u].ls, tl, mid);
    else insert(x, k, seg[u].rs, mid + 1, tr);
  }
  int query(int l, int r, int u, int tl, int tr) {
    if (!u || (l <= tl && tr <= r)) return seg[u].max;
    int mid = (tl + tr) >> 1;
    int ret = 0;
    if (l <= mid) ret = max(ret, query(l, r, seg[u].ls, tl, mid));
    if (r > mid) ret = max(ret, query(l, r, seg[u].rs, mid + 1, tr));
    return ret;
  }
  #define ls (u << 1)
  #define rs (ls | 1)
  int rt[N * 4 + 5];
  void insert(int x, int y, int k, int u, int tl, int tr) {
    insert(y, k, rt[u], 1, n);
    if (tl == tr) return ;
    int mid = (tl + tr) >> 1;
    if (x <= mid) insert(x, y, k, ls, tl, mid);
    else insert(x, y, k, rs, mid + 1, tr);
  }
  void insert(int x, int y, int k) { insert(x, y, k, 1, 1, n); }
  int query(int l, int r, int x, int y, int u, int tl, int tr) {
    if (l <= tl && tr <= r) return query(x, y, rt[u], 1, n);
    int mid = (tl + tr) >> 1;
    int ret = 0;
    if (l <= mid) ret = max(ret, query(l, r, x, y, ls, tl, mid));
    if (r > mid) ret = max(ret, query(l, r, x, y, rs, mid + 1, tr));
    return ret;
  }
  int query(int l, int r, int x, int y) { return l <= r && x <= y ? query(l, r, x, y, 1, 1, n) : 0; }
  #undef ls
  #undef rs
} tr;

struct SegmentTree {
  #define ls (u << 1)
  #define rs (ls | 1)
  struct node {
    int min;
    bool vis, tag;
  } seg[N * 4 + 5];
  void build(int u, int tl, int tr) {
    if (tl == tr) { seg[u].min = p[tl]; return ; }
    int mid = (tl + tr) >> 1;
    build(ls, tl, mid), build(rs, mid + 1, tr);
    seg[u].min = min(seg[ls].min, seg[rs].min);
  }
  void build() { build(1, 1, n); }
  int prev(int x, int u, int tl, int tr) {
    if (seg[u].min >= p[x]) return 0;
    if (tl == tr) return tl;
    int mid = (tl + tr) >> 1;
    if (x <= mid) return prev(x, ls, tl, mid);
    int ret = prev(x, rs, mid + 1, tr);
    if (!ret) ret = prev(x, ls, tl, mid);
    return ret;
  }
  int prev(int x) { return prev(x, 1, 1, n); }
  void pushDown(int u) {
    if (seg[u].tag) {
      seg[ls].vis = 0, seg[ls].tag = 1;
      seg[rs].vis = 0, seg[rs].tag = 1;
      seg[u].tag = 0;
    }
  }
  void undo(int l, int r, int u, int tl, int tr) {
    seg[u].vis = 0;
    if (l <= tl && tr <= r) { seg[u].tag = 1; return ; }
    pushDown(u);
    int mid = (tl + tr) >> 1;
    if (l <= mid) undo(l, r, ls, tl, mid);
    if (r > mid) undo(l, r, rs, mid + 1, tr);
  }
  void undo(int l, int r) { undo(l, r, 1, 1, n); }
  void erase(int x, int u, int tl, int tr) {
    if (tl == tr) { seg[u].min = inf; return ; }
    int mid = (tl + tr) >> 1;
    if (x <= mid) erase(x, ls, tl, mid);
    else erase(x, rs, mid + 1, tr);
    seg[u].min = min(seg[ls].min, seg[rs].min);
  }
  void erase(int x) {
    int y = prev(x, 1, 1, n);
    undo(y + 1, x, 1, 1, n), erase(x, 1, 1, n);
  }
  void search(vector<int> &ret, int rmin, int u, int tl, int tr) {
    if (seg[u].min >= rmin || seg[u].vis) return ;
    seg[u].vis = 1;
    if (tl == tr) { ret.push_back(tl); return ; }
    pushDown(u);
    int mid = (tl + tr) >> 1;
    search(ret,  rmin, rs, mid + 1, tr);
    search(ret, min(rmin, seg[rs].min), ls, tl, mid);
  }
  vector<int> search() {
    vector<int> ret;
    search(ret, inf, 1, 1, n);
    return ret;
  }
  #undef ls
  #undef rs
} seg;

vector<pair<int, int>> ans;
priority_queue<int> que;

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", p + i), q[p[i]] = i;
  for (int i = n; i; --i)
    bit.update(p[i], (level[i] = bit.query(p[i] - 1)) + 1);
  iota(a + 1, a + n + 1, 1), sort(a + 1, a + n + 1, [](int x, int y) { return level[x] > level[y]; });
  for (int l = 1, r; l <= n; l = r + 1) {
    for (r = l; r < n && level[a[r + 1]] == level[a[l]]; ++r);
    sort(a + l, a + r + 1, [](int x, int y) {
      bool flag = 0;
      if (x > y) flag = 1, swap(x, y);
      int a = tr.query(1, x - 1, p[x] + 1, p[y]), b = tr.query(x + 1, y - 1, p[y] + 1, n);
      return a != b ? (a < b) ^ flag : 0;
    });
    for (int i = l; i <= r; ++i) tr.insert(a[i], p[a[i]], i);
  }
  for (int i = 1; i <= n; ++i) b[a[i]] = i;
  seg.build();
  for (;;) {
    auto res = seg.search();
    for (int i: res) que.push(b[i]);
    if (que.empty()) break;
    int x = que.top(); que.pop(), seg.erase(a[x]);
    int y = x;
    if (!que.empty()) y = que.top(), que.pop(), seg.erase(a[y]);
    ans.emplace_back(p[a[x]], p[a[y]]);
  }
  reverse(ans.begin(), ans.end());
  printf("%d\n", ans.size());
  for (auto i: ans) printf("%d %d\n", i.first, i.second);
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3620kb

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: 2ms
memory: 3620kb

input:

8
5 6 7 1 2 8 3 4

output:

4
6 5
8 7
2 1
4 3

result:

ok da

Test #3:

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

input:

4
1 2 4 3

output:

2
1 4
3 2

result:

ok da

Test #4:

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

input:

2
1 2

output:

1
2 1

result:

ok da

Test #5:

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

input:

2
2 1

output:

2
2 2
1 1

result:

ok da

Test #6:

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

input:

3
1 2 3

output:

2
1 1
3 2

result:

ok da

Test #7:

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

input:

3
1 3 2

output:

2
3 3
2 1

result:

ok da

Test #8:

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

input:

3
2 1 3

output:

2
2 2
1 3

result:

ok da

Test #9:

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

input:

3
2 3 1

output:

2
3 2
1 1

result:

ok da

Test #10:

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

input:

3
3 1 2

output:

2
3 3
2 1

result:

ok da

Test #11:

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

input:

3
3 2 1

output:

3
3 3
2 2
1 1

result:

ok da

Test #12:

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

input:

4
1 2 3 4

output:

2
2 1
4 3

result:

ok da

Test #13:

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

input:

4
1 2 4 3

output:

2
1 4
3 2

result:

ok da

Test #14:

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

input:

4
1 3 2 4

output:

2
1 3
2 4

result:

ok da

Test #15:

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

input:

4
1 3 4 2

output:

2
4 3
2 1

result:

ok da

Test #16:

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

input:

4
1 4 2 3

output:

2
1 4
3 2

result:

ok da

Test #17:

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

input:

4
1 4 3 2

output:

3
4 4
3 3
2 1

result:

ok da

Test #18:

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

input:

4
2 1 3 4

output:

2
3 2
1 4

result:

ok da

Test #19:

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

input:

4
2 1 4 3

output:

2
4 2
3 1

result:

ok da

Test #20:

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

input:

4
2 3 1 4

output:

2
3 2
1 4

result:

ok da

Test #21:

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

input:

4
2 3 4 1

output:

3
2 2
4 3
1 1

result:

ok da

Test #22:

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

input:

4
2 4 1 3

output:

2
4 2
1 3

result:

ok da

Test #23:

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

input:

4
2 4 3 1

output:

3
4 4
3 2
1 1

result:

ok da

Test #24:

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

input:

4
3 1 2 4

output:

2
4 3
2 1

result:

ok da

Test #25:

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

input:

4
3 1 4 2

output:

2
4 3
2 1

result:

ok da

Test #26:

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

input:

4
3 2 1 4

output:

3
3 3
2 2
1 4

result:

ok da

Test #27:

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

input:

4
3 2 4 1

output:

3
3 3
2 4
1 1

result:

ok da

Test #28:

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

input:

4
3 4 1 2

output:

2
4 3
2 1

result:

ok da

Test #29:

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

input:

4
3 4 2 1

output:

3
4 3
2 2
1 1

result:

ok da

Test #30:

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

input:

4
4 1 2 3

output:

3
4 4
1 1
3 2

result:

ok da

Test #31:

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

input:

4
4 1 3 2

output:

3
4 4
3 3
2 1

result:

ok da

Test #32:

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

input:

4
4 2 1 3

output:

3
4 4
2 2
1 3

result:

ok da

Test #33:

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

input:

4
4 2 3 1

output:

3
4 4
3 2
1 1

result:

ok da

Test #34:

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

input:

4
4 3 1 2

output:

3
4 4
3 3
2 1

result:

ok da

Test #35:

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

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: 1ms
memory: 3624kb

input:

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

output:

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

result:

ok da

Test #37:

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

input:

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

output:

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

result:

ok da

Test #38:

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

input:

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

output:

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

result:

ok da

Test #39:

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

input:

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

output:

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

result:

ok da

Test #40:

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

input:

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

output:

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

result:

ok da

Test #41:

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

input:

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

output:

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

result:

ok da

Test #42:

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

input:

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

output:

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

result:

ok da

Test #43:

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

input:

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

output:

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

result:

ok da

Test #44:

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

input:

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

output:

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

result:

ok da

Test #45:

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

input:

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

output:

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

result:

ok da

Test #46:

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

input:

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

output:

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

result:

ok da

Test #47:

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

input:

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

output:

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

result:

ok da

Test #48:

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

input:

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

output:

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

result:

ok da

Test #49:

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

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: 2ms
memory: 3820kb

input:

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

output:

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

result:

ok da

Test #51:

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

input:

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

output:

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

result:

ok da

Test #52:

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

input:

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

output:

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

result:

ok da

Test #53:

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

input:

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

output:

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

result:

ok da

Test #54:

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

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
492 492
488 454
494 489
490 491
450 442
431 478
476 475
486 449
473 485
345 418
393 357
409 402
430 465
471 468
300 416
395 384
427 386
470 457
343 412
373 295
415 375
456 448
397 452
423 421
316 462
336 328
355 288
441 363
392 370
296 455
320 293
315 326
429 285
388 333
379 390
483 391
451 477
...

result:

ok da

Test #55:

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

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

result:

ok da

Test #56:

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

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
57 57
398 399
396 397
391 392
29 390
137 97
144 143
120 30
405 150
152 151
31 56
119 27
26 69
114 154
96 156
92 47
353 99
379 380
376 378
373 374
370 372
367 389
364 365
355 360
126 354
346 350
424 408
422 423
420 421
418 419
409 411
407 6
77 106
112 167
178 9
180 7
48 111
183 5
110 80
90 160
15...

result:

ok da

Test #57:

score: 0
Accepted
time: 4ms
memory: 3984kb

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
488 454
491 489
494 490
450 442
431 478
476 475
486 449
473 485
345 418
393 357
409 402
468 465
416 471
384 300
386 395
457 427
412 470
295 343
375 373
448 415
452 456
421 397
462 423
328 316
288 336
363 355
370 441
455 392
293 296
326 320
285 315
333 429
390 388
391 379
477 483
318 451
...

result:

ok da

Test #58:

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

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 496
495 495
494 493
492 491
490 490
489 489
488 488
487 486
485 485
484 481
483 473
482 472
480 469
479 468
478 464
477 463
460 476
458 475
457 474
456 471
455 455
454 470
453 453
452 467
449 449
448 448
447 447
446 466
437 465
436 436
433 433
432 432
430 430
428 462
426 461
425 425
424 424
...

result:

ok da

Test #59:

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

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
482 90
58 484
94 56
110 475
104 107
100 101
96 476
92 485
89 59
86 88
85 477
29 496
24 26
19 21
494 493
284 16
390 392
297 300
391 294
289 290
186 288
287 393
285 394
396 31
68 281
83 480
77 81
75 76
70 74
67 478
147 60
111 464
463 134
462 136
461 133
459 139
457 140
456 142
131 143
149 455
123 ...

result:

ok da

Test #60:

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

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
492 492
488 454
496 489
442 490
478 450
494 491
449 431
476 475
345 418
486 357
402 485
409 393
473 465
300 416
395 384
427 386
471 468
343 412
373 295
415 375
470 457
421 397
316 423
336 328
355 288
448 363
452 456
392 370
296 462
320 293
315 326
441 285
388 333
390 379
455 391
303 318
278 306
...

result:

ok da

Test #61:

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

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
488 488
486 486
485 485
484 484
480 491
478 487
475 483
474 482
471 471
468 468
465 465
464 464
460 460
459 481
458 458
457 479
456 477
455 476
453 473
450 472
444 470
443 469
440 467
439 466
435 463
433 462
432 461
430 454
429 452
428 451
425 449
420 448
419 447
...

result:

ok da

Test #62:

score: 0
Accepted
time: 4ms
memory: 3996kb

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
98 98
489 61
111 490
129 130
120 125
117 118
112 113
104 59
488 102
89 91
87 88
32 18
31 496
26 30
21 25
495 19
397 17
316 317
309 312
305 306
391 389
303 199
392 301
300 394
16 295
486 294
180 82
79 80
77 78
72 485
69 85
67 68
456 63
149 148
168 150
464 465
472 173
463 458
151 154
152 153
473 4...

result:

ok da

Test #63:

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

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
454 492
489 488
490 496
450 442
491 478
431 494
475 449
418 476
357 345
486 485
393 402
465 409
416 473
384 300
386 395
468 427
412 471
295 343
375 373
457 415
397 470
423 421
328 316
288 336
363 355
456 448
370 452
462 392
293 296
326 320
285 315
333 441
379 388
391 390
318 455
306 303
429 278
...

result:

ok da

Test #64:

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

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

result:

ok da

Test #65:

score: 0
Accepted
time: 4ms
memory: 3932kb

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
484 55
63 485
59 61
477 56
102 103
99 100
98 475
94 97
93 65
91 478
85 88
81 84
494 497
27 28
22 24
286 21
259 261
302 288
297 300
293 294
369 290
180 370
378 375
17 287
381 285
281 282
80 67
76 481
75 482
70 72
480 69
469 161
470 455
456 118
144 105
461 123
141 142
121 119
156 137
107 117
159 4...

result:

ok da

Test #66:

score: 0
Accepted
time: 4ms
memory: 4180kb

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
492 492
488 454
496 489
442 490
478 450
494 491
449 431
476 475
345 418
485 357
402 486
409 393
473 465
300 416
395 384
427 386
471 468
343 412
373 295
415 375
470 457
421 397
316 423
336 328
355 288
448 363
452 456
392 370
296 462
320 293
315 326
441 285
388 333
390 379
455 391
303 318
278 306
...

result:

ok da

Test #67:

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

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

result:

ok da

Test #68:

score: 0
Accepted
time: 4ms
memory: 3884kb

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
98 98
112 484
116 474
475 115
476 114
477 113
103 51
100 102
52 99
89 91
22 88
31 498
27 29
25 26
24 499
20 32
322 81
408 323
325 324
328 326
330 406
331 405
67 332
18 86
79 478
75 78
71 74
87 68
65 480
54 59
483 482
137 164
144 143
117 145
155 467
160 159
465 153
162 463
461 163
459 468
166 456...

result:

ok da

Test #69:

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

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
454 492
489 488
490 496
450 442
491 478
431 494
475 449
418 476
357 345
486 485
393 402
465 409
416 473
384 300
386 395
468 427
412 471
295 343
375 373
457 415
397 470
421 500
316 423
336 328
355 288
448 363
370 452
462 392
293 296
326 320
285 315
333 441
379 388
391 390
318 455
306 303
429 278
...

result:

ok da

Test #70:

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

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

result:

ok da

Test #71:

score: 0
Accepted
time: 4ms
memory: 3892kb

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
101 138
146 59
140 69
31 58
147 139
100 133
403 400
405 404
409 407
60 127
99 78
149 79
155 153
184 118
30 112
55 37
358 53
385 390
381 382
370 374
368 397
366 367
363 364
360 362
49 359
435 420
431 432
427 430
424 425
422 423
4 421
414 417
183 410
82 157
18 81
63 115
10 62
181 83
91 65
90 180
9...

result:

ok da

Test #72:

score: 0
Accepted
time: 89ms
memory: 13548kb

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
7485 7485
7459 7396
7365 7466
7443 7415
7469 7293
7343 7328
7447 7464
7404 7360
7275 7362
7397 7463
7285 7324
7363 7341
7216 7195
7454 7226
7232 7366
7336 7241
7182 7273
7203 7438
7320 7240
7265 7168
7385 7180
7238 7183
7314 7239
7449 7136
7331 7299
7150 7382
7300 7236
7370 7078
7122 7139
7282 ...

result:

ok da

Test #73:

score: 0
Accepted
time: 15ms
memory: 9484kb

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
7490 7490
7488 7488
7486 7494
7481 7481
7480 7480
7478 7493
7477 7492
7475 7491
7463 7489
7460 7487
7459 7485
7458 7484
7457 7483
7455 7482
7454 7479
7453 7476
7452 7474
7450 7473
7448 7472
7444 7471
7442 7470
7440 7469
7435 7468
7431 7467
7426 7466
7423 7465
7422 7464
7421 7462
7418 ...

result:

ok da

Test #74:

score: 0
Accepted
time: 47ms
memory: 9480kb

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
482 482
1452 496
1450 1451
2027 1449
498 2029
488 493
485 486
484 1442
2031 890
478 2034
2004 1462
504 2005
502 2006
2007 1463
2008 882
5888 2009
5831 5833
5828 5830
5885 5826
5902 5903
5899 5900
5894 5898
5891 5893
3 2015
5881 5882
5878 5879
5868 5873
5865 5867
2019 494
1453 2026
2066 473
2067...

result:

ok da

Test #75:

score: 0
Accepted
time: 90ms
memory: 13700kb

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
7485 7396
7365 7459
7415 7466
7293 7443
7343 7328
7360 7469
7447 7464
7404 7362
7463 7275
7285 7324
7341 7397
7195 7363
7226 7216
7232 7454
7366 7241
7273 7336
7438 7182
7240 7203
7168 7320
7180 7265
7183 7385
7239 7238
7136 7314
7299 7449
7382 7331
7236 7150
7078 7300
7139 7370
7179 7122
7094 ...

result:

ok da

Test #76:

score: 0
Accepted
time: 17ms
memory: 9636kb

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 7496
7495 7495
7494 7493
7492 7490
7491 7489
7488 7488
7487 7487
7486 7486
7485 7484
7483 7483
7482 7482
7481 7481
7480 7480
7479 7479
7478 7476
7477 7473
7475 7471
7474 7470
7472 7468
7469 7467
7466 7465
7464 7464
7463 7462
7461 7461
7460 7460
7459 7459
7458 7456
7457 7455
7454 7453
7452 ...

result:

ok da

Test #77:

score: 0
Accepted
time: 54ms
memory: 9444kb

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
5858 1369
5855 5857
5850 5852
5844 5847
412 5843
423 1370
1962 422
8 1971
1972 420
417 418
1959 415
1367 862
411 1975
410 864
5817 408
5838 5840
5836 5837
5833 5834
5829 5830
5842 5828
5822 5824
5819 5821
5816 405
5812 5815
5884 5864
5876 5883
5873 5875
5867 5872
5865 5866
1362 381
1359 386
385...

result:

ok da

Test #78:

score: 0
Accepted
time: 101ms
memory: 13508kb

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
7396 7396
7459 7485
7466 7365
7443 7415
7328 7293
7469 7343
7464 7360
7362 7447
7275 7404
7324 7463
7397 7285
7363 7341
7216 7195
7454 7226
7241 7232
7336 7366
7182 7273
7203 7438
7320 7240
7265 7168
7385 7180
7238 7183
7314 7239
7449 7136
7331 7299
7150 7382
7300 7236
7370 7078
7122 7139
7282 ...

result:

ok da

Test #79:

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

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
7493 7493
7490 7490
7489 7489
7488 7488
7487 7487
7486 7497
7485 7496
7482 7495
7481 7481
7480 7494
7479 7492
7478 7491
7477 7484
7470 7483
7469 7476
7468 7475
7466 7466
7462 7474
7461 7473
7458 7458
7457 7457
7455 7472
7454 7454
7453 7453
7450 7471
7447 7467
7445 7465
7444 7464
7443 7443
7442 ...

result:

ok da

Test #80:

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

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
6918 6918
6888 1438
6923 1363
1348 1345
6920 1351
1353 1352
1356 1355
1358 6919
1359 1435
1362 1361
1367 6968
1370 1368
6917 1372
1373 6913
1376 1375
6904 6912
1406 1408
1405 6893
1403 6894
6895 1401
6901 1411
1396 1399
6903 1395
1394 1377
6892 1383
1419 1418
1425 1423
1429 1428
6889 6891
1433 ...

result:

ok da

Test #81:

score: 0
Accepted
time: 92ms
memory: 13704kb

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
7485 7396
7365 7459
7415 7466
7293 7443
7343 7328
7360 7469
7447 7464
7404 7362
7463 7275
7285 7324
7341 7397
7195 7363
7226 7216
7232 7454
7366 7241
7273 7336
7438 7182
7240 7203
7168 7320
7180 7265
7183 7385
7239 7238
7136 7314
7299 7449
7382 7331
7236 7150
7078 7300
7139 7370
7179 7122
7094 ...

result:

ok da

Test #82:

score: 0
Accepted
time: 17ms
memory: 9560kb

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
7495 7495
7494 7494
7492 7498
7488 7497
7487 7487
7486 7486
7485 7496
7484 7493
7483 7491
7482 7490
7480 7489
7478 7478
7477 7477
7473 7473
7472 7481
7469 7479
7465 7476
7464 7475
7463 7463
7462 7462
7459 7459
7458 7474
7457 7471
7456 7470
7454 7454
7452 7452
7450 7450
7447 7468
7446 7467
7444 ...

result:

ok da

Test #83:

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

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
572 1718
570 1765
566 567
563 1766
1767 562
601 1770
608 611
1764 1716
606 1720
1723 1722
604 1725
1729 1728
1771 1730
1731 598
1736 1735
5936 584
5934 5935
5932 5
5927 5930
5923 5924
5917 5919
1757 5916
1737 585
582 583
1749 581
1751 1750
1754 1753
580 1756
1743 579
578 1758
518 552
1823 517
1...

result:

ok da

Test #84:

score: 0
Accepted
time: 96ms
memory: 13704kb

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
7396 7396
7459 7485
7466 7365
7443 7415
7343 7293
7469 7328
7464 7360
7362 7447
7275 7404
7324 7463
7397 7285
7363 7341
7216 7195
7454 7226
7241 7232
7336 7366
7182 7273
7203 7438
7320 7240
7265 7168
7385 7180
7238 7183
7314 7239
7449 7136
7331 7299
7150 7382
7300 7236
7370 7078
7122 7139
7282 ...

result:

ok da

Test #85:

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

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
7498 7499
7497 7497
7496 7496
7495 7495
7494 7494
7493 7493
7492 7491
7490 7490
7489 7489
7488 7487
7486 7485
7484 7484
7483 7481
7482 7479
7480 7477
7478 7476
7475 7475
7474 7474
7473 7471
7472 7470
7469 7464
7468 7463
7467 7460
7466 7459
7465 7454
7462 7452
7461 7451
7458 7450
7457 7449
7456 ...

result:

ok da

Test #86:

score: 0
Accepted
time: 46ms
memory: 9364kb

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
6888 6888
6861 1444
1447 1446
1452 1450
1364 1392
1369 1367
1372 1371
1380 1373
1382 6862
1386 1384
1389 1387
1391 6887
6885 6942
1396 1393
6883 6884
1427 6882
1323 6923
1432 1325
6877 1413
1419 1417
1421 6876
1424 1422
6875 1426
1430 1399
6873 6874
1412 1431
1437 1436
1439 6870
1440 6868
1442 ...

result:

ok da

Test #87:

score: 0
Accepted
time: 92ms
memory: 13500kb

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
7485 7396
7365 7459
7415 7466
7293 7443
7328 7343
7360 7469
7447 7464
7404 7362
7463 7275
7285 7324
7341 7397
7195 7363
7226 7216
7232 7454
7366 7241
7273 7336
7438 7182
7240 7203
7168 7320
7180 7265
7183 7385
7239 7238
7136 7314
7299 7449
7382 7331
7236 7150
7078 7300
7139 7370
7179 7122
7094 ...

result:

ok da

Test #88:

score: 0
Accepted
time: 21ms
memory: 9416kb

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 7496
7495 7495
7494 7494
7493 7492
7491 7490
7489 7488
7487 7487
7486 7485
7484 7484
7483 7483
7482 7481
7480 7479
7478 7478
7477 7476
7475 7475
7474 7471
7473 7470
7472 7469
7468 7468
7467 7466
7465 7465
7464 7460
7463 7459
7462 7458
7461 7456
7457 7455
7454 ...

result:

ok da

Test #89:

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

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
2056 2063
931 930
2060 2059
1491 2062
475 935
1485 1490
470 2054
473 469
2064 468
464 467
2065 937
1483 2066
1502 925
489 2036
2038 921
5853 5879
5830 5834
5825 5829
5821 5823
5819 5820
5892 5872
5887 5888
2043 5883
5876 5878
5874 5875
5871 6
5868 5870
5861 5866
5856 5857
2067 5855
1462 2090
14...

result:

ok da

Test #90:

score: -100
Wrong Answer
time: 3967ms
memory: 208780kb

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:

49999
99961 99961
99751 99751
99678 99678
98550 98466
99830 99956
99667 98979
98264 99796
99220 99375
99532 99598
98813 97967
99133 97983
99366 99585
98460 98447
99593 99634
97735 97606
99289 98558
99704 99923
98756 99273
97578 98386
99274 98410
99592 99699
98557 98604
98106 97524
99045 98232
97158 ...

result:

wrong answer jury have better solution