QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#531411#2555. Two BulletsKinNaWA 630ms210048kbC++205.8kb2024-08-24 20:27:202024-08-24 20:27:21

Judging History

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

  • [2024-08-24 20:27:21]
  • 评测
  • 测评结果:WA
  • 用时:630ms
  • 内存:210048kb
  • [2024-08-24 20:27:20]
  • 提交

answer

/**
 * 论文题 :
 * ·首先,找到一个特殊的拓扑序。像一般的拓扑排序那样,每次删去一个入度为0的点并加到拓扑序中。
 * 	但此处,如果有多个入度为 0 的点,设 N(v) 为v的入边被删除的时间的集合。
 * 	我们将每个 N(v) 中的元素降序排列后寻找字典序最小的 N(v) (换句话说,尽可能早地被减小入度的 v ),
 * 	并在这一轮中选择 v.
 * ·然后,逆着拓扑序反着求答案。每次取两个在拓扑序中最靠后的,出度为 0 的点删去,并加到答案的前端。
*/

#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
using namespace std;
using PII = pair <int, int>;
const int N = 1e5 + 10;
const int inf = 1e9;

inline int R() {
	int x = 0; char c = getchar(); while (!isdigit(c)) c = getchar();
	while (isdigit(c)) x = x * 10 + c - '0', c = getchar(); return x;
}

int n;

struct BIT {
	int b[N];
	void upd(int x, int v) {while (x) {b[x] = max(b[x], v); x &= x - 1;}}
	int qry(int x) {int res = 0; while (x <= n) {res = max(res, b[x]); x += x & -x;} return res;}
} bit;

struct SegInSeg {
	struct Node {int mx, ls, rs;} t[N * 700]; int tot;
		#define mid (l + r >> 1)
		#define lrt (t[rt].ls)
		#define rrt (t[rt].rs)
		int Rt[N << 2];
		void upd_(int p, int v, int l, int r, int &rt) {
			if (!rt) rt = ++tot;
			if (l == r) {t[rt].mx = v; return ;}
			if (p <= mid) upd_(p, v, l, mid, lrt);
			else upd_(p, v, mid + 1, r, rrt);
			t[rt].mx = max(t[lrt].mx, t[rrt].mx);
		}
		void upd_(int p, int v, int rt) {upd_(p, v, 1, n, Rt[rt]);}

		int qry_(int ll, int rr, int l, int r, int rt) {
			if (!rt) return 0;
			if (ll <= l && r <= rr) return t[rt].mx;
			if (rr <= mid) return qry_(ll, rr, l, mid, lrt);
			if (mid < ll) return qry_(ll, rr, mid + 1, r, rrt);
			return max(qry_(ll, rr, l, mid, lrt), qry_(ll, rr, mid + 1, r, rrt));
		}
		int qry_(int l, int r, int rt) {return qry_(l, r, 1, n, Rt[rt]);}
		#undef mid
		#undef lrt
		#undef rrt
	#define mid (l + r >> 1)
	#define lrt (rt << 1)
	#define rrt (rt << 1 | 1)
	void upd(int x, int y, int v, int l = 1, int r = n, int rt = 1) {
		upd_(y, v, rt);
		if (l == r) return ;
		if (x <= mid) upd(x, y, v, l, mid, lrt);
		else upd(x, y, v, mid + 1, r, rrt);
	}

	int qry(int xl, int xr, int yl, int yr, int l = 1, int r = n, int rt = 1) {
		if (xl > xr || yl > yr) return 0;
		if (xl <= l && r <= xr) return qry_(yl, yr, rt);
		if (xr <= mid) return qry(xl, xr, yl, yr, l, mid, lrt);
		if (mid < xl) return qry(xl, xr, yl, yr, mid + 1, r, rrt);
		return max(qry(xl, xr, yl, yr, l, mid, lrt), qry(xl, xr, yl, yr, mid + 1, r, rrt));
	}
	#undef mid
	#undef lrt
	#undef rrt
} sis;

int h[N], a[N], b[N];
int level[N];

vector <PII> ans;
priority_queue <int> q;

struct Seg {
	struct Node {int mn; bool vis, tag;} t[N << 2];
	#define mid (l + r >> 1)
	#define lrt (rt << 1)
	#define rrt (rt << 1 | 1)

	void build(int l = 1, int r = n, int rt = 1) {
		if (l == r) {t[rt].mn = h[l]; return ;}
		build(l, mid, lrt); build(mid + 1, r, rrt);
		t[rt].mn = min(t[lrt].mn, t[rrt].mn);
	}

	/**
	 * @brief: 找 h[x] 前的第一个大于等于 h[x] 的数
	*/
	int prv(int x, int l = 1, int r = n, int rt = 1) {
		if (t[rt].mn >= h[x]) return 0;
		if (l == r) return l;
		if (x <= mid) return prv(x, l, mid, lrt);
		int res = prv(x, mid + 1, r, rrt);
		if (!res) res = prv(x, l, mid, lrt);
		return res;
	}

	// ---

	void pushdown(int rt) {
		if (t[rt].tag) {
			t[lrt].vis = t[rrt].vis = 0;
			t[lrt].tag = t[rrt].tag = 1;
			t[rt].tag = 0;
		}
	}

	/**
	 * @brief: 删除区间的 vis 标记
	*/
	void undo(int ll, int rr, int l = 1, int r = n, int rt = 1) {
		t[rt].vis = 0;
		if (ll <= l && r <= rr) {t[rt].tag = 1; return ;}
		pushdown(rt);
		if (ll <= mid) undo(ll, rr, l, mid, lrt);
		if (mid < rr) undo(ll, rr, mid + 1, r, rrt);
	}

	// 同下
	void erase(int x, int l, int r, int rt) {
		if (l == r) {t[rt].mn = inf; return ;}
		if (x <= mid) erase(x, l, mid, lrt);
		else erase(x, mid + 1, r, rrt);
		t[rt].mn = min(t[lrt].mn, t[rrt].mn);
	}
	/**
	 * @brief: 从序列中删除 h[x] (体现为 h[x] 置 inf), 并删除 (prv(x), x] 的标记 (使之可搜索)
	*/
	void erase(int x) {undo(prv(x) + 1, x); erase(x, 1, n, 1);}

	// 同下
	void search(vector <int> &res, int rmn, int l, int r, int rt) {
		if (t[rt].mn >= rmn || t[rt].vis) return ;
		t[rt].vis = 1;
		if (l == r) {res.push_back(l); return ;}
		pushdown(rt);
		search(res, rmn, mid + 1, r, rrt);
		search(res, min(rmn, t[rrt].mn), l, mid, lrt);
	}
	/**
	 * @brief: 查询后缀最小值
	*/
	vector <int> search() {vector <int> res; search(res, inf, 1, n, 1); return res;}

	#undef mid
	#undef lrt
	#undef rrt
} seg;

int main() {
	n = R();
	for (int i = 1; i <= n; ++i) {
		h[i] = R();
		level[i] = bit.qry(h[i] + 1);
		bit.upd(h[i], level[i] + 1);
		a[i] = i;
	}
	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) {
		r = l;
		while (r < n && level[r + 1] == level[l]) ++r;
		sort(a + l, a + r + 1, [](int x, int y) {
			bool flag = 0;
			if (x > y) swap(x, y), flag = 1;
			int X = sis.qry(1, x - 1, h[x] + 1, h[y]), Y = sis.qry(x + 1, y - 1, h[y] + 1, n);
			return X ^ Y ? (X < Y) ^ flag : 0;
		});
		for (int i = l; i <= r; ++i) sis.upd(a[i], h[a[i]], i);
	}
	for (int i = 1; i <= n; ++i)
		b[a[i]] = i;
	seg.build();
	while (1) {
		auto res = seg.search();
		for (auto i : res) q.push(b[i]);
		if (q.empty()) break;
		int x = q.top(); q.pop(); seg.erase(a[x]);
		int y = x;
		if (!q.empty()) y = q.top(), q.pop(), seg.erase(a[y]);
		ans.push_back({h[a[x]], h[a[y]]});
	}
	reverse(ans.begin(), ans.end());
	printf("%d\n", ans.size());
	for (auto i : ans)
		printf("%d %d\n", i.first, i.second);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 5884kb

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

input:

4
1 2 4 3

output:

2
4 1
3 2

result:

ok da

Test #4:

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

input:

2
1 2

output:

1
2 1

result:

ok da

Test #5:

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

input:

2
2 1

output:

2
2 2
1 1

result:

ok da

Test #6:

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

input:

3
1 2 3

output:

2
1 1
3 2

result:

ok da

Test #7:

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

input:

3
1 3 2

output:

2
3 3
2 1

result:

ok da

Test #8:

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

input:

3
2 1 3

output:

2
2 2
1 3

result:

ok da

Test #9:

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

input:

3
2 3 1

output:

2
3 2
1 1

result:

ok da

Test #10:

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

input:

3
3 1 2

output:

2
3 3
2 1

result:

ok da

Test #11:

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

input:

3
3 2 1

output:

3
3 3
2 2
1 1

result:

ok da

Test #12:

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

input:

4
1 2 3 4

output:

2
2 1
4 3

result:

ok da

Test #13:

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

input:

4
1 2 4 3

output:

2
4 1
3 2

result:

ok da

Test #14:

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

input:

4
1 3 2 4

output:

2
3 1
2 4

result:

ok da

Test #15:

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

input:

4
1 3 4 2

output:

2
4 3
2 1

result:

ok da

Test #16:

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

input:

4
1 4 2 3

output:

2
4 1
3 2

result:

ok da

Test #17:

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

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: 7896kb

input:

4
2 1 3 4

output:

2
3 2
1 4

result:

ok da

Test #19:

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

input:

4
2 1 4 3

output:

2
4 2
3 1

result:

ok da

Test #20:

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

input:

4
2 3 1 4

output:

2
3 2
1 4

result:

ok da

Test #21:

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

input:

4
2 3 4 1

output:

3
2 2
4 3
1 1

result:

ok da

Test #22:

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

input:

4
2 4 1 3

output:

2
4 2
1 3

result:

ok da

Test #23:

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

input:

4
2 4 3 1

output:

3
4 4
3 2
1 1

result:

ok da

Test #24:

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

input:

4
3 1 2 4

output:

2
4 3
2 1

result:

ok da

Test #25:

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

input:

4
3 1 4 2

output:

2
4 3
2 1

result:

ok da

Test #26:

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

input:

4
3 2 1 4

output:

3
3 3
2 2
1 4

result:

ok da

Test #27:

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

input:

4
3 2 4 1

output:

3
3 3
2 4
1 1

result:

ok da

Test #28:

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

input:

4
3 4 1 2

output:

2
4 3
2 1

result:

ok da

Test #29:

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

input:

4
3 4 2 1

output:

3
4 3
2 2
1 1

result:

ok da

Test #30:

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

input:

4
4 1 2 3

output:

3
4 4
1 1
3 2

result:

ok da

Test #31:

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

input:

4
4 1 3 2

output:

3
4 4
3 3
2 1

result:

ok da

Test #32:

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

input:

4
4 2 1 3

output:

3
4 4
2 2
1 3

result:

ok da

Test #33:

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

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: 5864kb

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: 5832kb

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

input:

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

output:

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

result:

ok da

Test #37:

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

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

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
6 3
7 11
12 8
13 15

result:

ok da

Test #39:

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

input:

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

output:

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

result:

ok da

Test #40:

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

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: 0ms
memory: 7940kb

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: 8140kb

input:

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

output:

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

result:

ok da

Test #43:

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

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

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
7 4
13 10

result:

ok da

Test #45:

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

input:

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

output:

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

result:

ok da

Test #46:

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

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
5 3
2 1

result:

ok da

Test #47:

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

input:

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

output:

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

result:

ok da

Test #48:

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

input:

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

output:

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

result:

ok da

Test #49:

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

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: 0ms
memory: 7936kb

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

input:

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

output:

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

result:

ok da

Test #52:

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

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

input:

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

output:

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

result:

ok da

Test #54:

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

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
237 494
454 495
493 345
489 357
442 488
491 490
450 201
478 486
485 431
487 300
476 155
484 475
477 449
409 483
129 402
393 343
473 295
482 316
480 418
288 113
465 386
430 198
395 384
471 285
373 296
14 79
375 416
328 11
481 427
468 293
336 474
64 472
470 355
412 363
320 326
421 423
415 ...

result:

ok da

Test #55:

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

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
484 475
483 472
482 471
479 468
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
443 446
442 445
444 437
441 436
440 435
434 439
438 433
432 429
431 427
430 426
...

result:

ok da

Test #56:

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

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
281 281
300 301
297 299
291 293
285 289
282 284
279 302
277 278
275 276
270 5
268 269
345 322
343 344
340 341
332 333
328 329
267 326
319 320
315 318
309 312
305 306
209 304
230 231
228 229
225 227
219 223
211 212
208 232
205 206
200 204
197 198
195 196
265 250
260 263
256 259
253 254
251 252
24...

result:

ok da

Test #57:

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

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
345 237
496 454
201 492
495 488
494 442
489 357
490 491
493 450
485 487
478 486
431 300
476 155
477 129
295 475
409 449
484 483
402 393
386 343
418 480
316 113
395 482
198 465
473 384
474 288
481 373
416 375
472 427
471 468
296 293
11 328
14 336
79 285
363 326
249 355
64 412
415 470
101 128
457 ...

result:

ok da

Test #58:

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

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
476 460
475 458
474 457
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: 4ms
memory: 8136kb

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
424 219
224 225
222 223
427 220
227 429
434 433
216 217
213 435
211 212
413 241
252 414
416 415
246 248
209 245
239 240
417 234
233 421
166 231
180 181
175 179
174 450
168 173
165 449
162 164
453 452
156 161
194 152
206 208
436 205
199 438
195 197
442 253
192 445
189 448
184 187
375 320
334 335
...

result:

ok da

Test #60:

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

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 497
454 345
492 237
201 496
490 495
442 491
357 488
489 494
486 485
487 478
155 450
431 493
449 300
484 129
295 409
475 402
393 476
477 483
395 343
473 482
465 418
288 384
113 316
386 198
468 480
472 373
285 481
375 79
416 11
293 471
328 296
474 14
427 336
355 412
415 326
64 320
421 479
101 ...

result:

ok da

Test #61:

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

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
496 497
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: 3ms
memory: 7904kb

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
245 245
433 258
252 253
434 251
248 249
432 247
241 242
235 240
230 231
229 437
272 268
270 416
420 269
427 424
228 429
430 267
262 264
260 261
431 259
447 451
196 200
191 192
189 190
202 449
186 187
184 185
182 183
181 452
227 440
224 226
222 223
216 217
414 439
214 443
209 211
445 207
204 205
...

result:

ok da

Test #63:

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

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
345 496
492 454
237 498
494 201
497 491
489 490
442 488
478 357
431 485
300 486
155 495
487 450
409 129
483 493
484 476
449 295
477 402
343 393
113 475
395 198
473 288
465 482
418 480
316 386
474 384
427 373
481 416
472 14
375 468
79 328
293 285
11 296
336 471
315 326
363 64
355 412
421 101
457 ...

result:

ok da

Test #64:

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

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: 8ms
memory: 6088kb

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
224 214
407 405
219 220
216 410
215 411
213 404
414 210
418 417
419 208
239 207
256 391
249 253
241 396
397 240
399 202
233 237
402 230
226 229
174 403
183 184
177 179
175 176
446 445
173 444
447 172
168 169
164 165
429 163
199 200
424 423
195 197
194 427
193 258
432 191
440 188
185 441
360 443
...

result:

ok da

Test #66:

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

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
237 237
345 498
492 454
496 499
489 201
488 497
491 490
357 442
478 494
486 485
487 300
431 495
450 155
129 484
409 483
475 493
477 402
449 393
476 343
395 295
482 473
480 418
288 465
113 386
384 316
468 198
79 481
375 285
373 416
11 14
296 293
427 328
336 472
471 474
415 320
326 355
363 412
64 ...

result:

ok da

Test #67:

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

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

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
436 436
259 261
257 258
431 253
432 250
248 268
244 246
242 243
438 241
426 280
287 289
282 286
281 427
240 428
274 275
273 429
430 271
190 269
444 210
198 199
446 195
191 194
189 214
450 449
182 186
176 178
239 440
237 238
234 236
439 232
425 231
229 441
222 226
216 218
387 215
352 353
350 351
...

result:

ok da

Test #69:

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

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
345 496
237 454
500 492
491 201
494 499
498 490
488 489
442 357
478 431
155 485
300 497
450 486
129 476
484 409
483 295
449 495
402 487
477 343
475 393
288 480
316 395
465 482
418 493
198 113
386 384
481 473
375 373
79 472
416 474
14 11
336 427
471 285
328 468
293 296
470 326
355 457
421 423
415...

result:

ok da

Test #70:

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

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: 3ms
memory: 7956kb

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
306 290
304 305
302 303
299 301
294 297
307 293
284 289
281 283
273 279
267 272
321 266
351 355
346 349
339 342
336 338
322 327
320 265
317 318
315 316
313 314
308 309
220 205
218 219
215 217
211 213
208 209
221 206
202 203
197 199
194 196
189 193
243 185
258 263
255 256
253 254
248 251
245 247
...

result:

ok da

Test #72:

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

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 7495
7275 6871
7078 4964
7396 7459
7293 7485
6851 7365
7195 7415
7469 7443
7494 7491
7466 7328
6223 6536
3768 7343
7362 650
7493 6512
6641 7486
6858 7404
7065 7216
7447 129
1551 7464
7468 6438
7492 3875
7360 6441
6194 7363
7341 7489
5102 7484
7490 7285
7168 7324
7397 6704
5015 7136
7475 74...

result:

ok da

Test #73:

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

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: 15ms
memory: 11444kb

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
4186 4186
4200 4203
4198 4199
4192 4194
4189 4191
4205 4188
4182 4185
4173 4175
4170 4171
4167 4168
4233 4165
4250 4251
4248 4249
4241 4244
4235 4236
4161 4234
4230 4232
4220 4221
4212 4219
4210 4211
4118 4101
4112 4113
4110 4111
4107 4109
4102 4103
4098 4121
4094 4096
4088 4093
4085 4087
4082 ...

result:

ok da

Test #75:

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

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
4964 6871
7293 7275
7459 7495
7396 7496
7485 7078
7343 7365
7469 7415
6851 7494
650 6223
7195 3768
7466 6536
7443 7491
7362 7328
6641 6858
7404 7492
7468 7065
7464 7360
6441 6512
7493 7486
7447 129
7216 1551
6438 3875
7490 7397
5015 7168
7472 6704
7463 7489
7324 7226
7475 7285
5102 7484
7182 61...

result:

ok da

Test #76:

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

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: 15ms
memory: 12332kb

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
4248 4225
4241 4247
4235 4240
4231 4233
4226 4227
4224 4249
4216 4218
4214 4215
4211 4213
4206 4208
4282 4264
4278 4281
4272 4275
4268 4270
4265 4267
4260 4204
4257 4259
4253 4256
4251 4252
4154 4250
4163 4164
4161 4162
4159 4160
4156 4158
4167 4155
4148 4152
4142 4144
4139 4140
4137 4138
4200 ...

result:

ok da

Test #78:

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

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
7495 7495
7497 7293
7459 7078
4964 7275
7485 7396
7469 6871
7415 7496
7443 7466
7491 7494
650 7365
6851 3768
7343 7328
6223 7195
7360 6536
7065 7493
6858 6512
6641 7216
7468 7464
7362 7447
1551 129
7492 3875
7404 6438
7486 6441
7341 7484
7463 6704
7397 7489
7475 7136
7324 7168
7472 7285
7490 72...

result:

ok da

Test #79:

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

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: 14ms
memory: 11744kb

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
4236 4236
4251 4254
4249 4250
4244 4245
4240 4242
4255 4237
4232 4235
4223 4224
4220 4221
4217 4218
4272 4216
4286 4290
4283 4285
4280 4282
4275 4279
4207 4273
4269 4270
4263 4268
4260 4261
4258 4259
4168 4155
4166 4167
4163 4164
4160 4162
4158 4159
4152 4171
4149 4151
4146 4148
4144 4145
4141 ...

result:

ok da

Test #81:

score: 0
Accepted
time: 25ms
memory: 17012kb

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
7078 7459
7495 7485
4964 7497
7498 7275
6871 7396
7365 7293
7343 7466
7415 7328
6851 7195
6536 7443
3768 650
6223 7496
7469 7494
7468 7491
7404 7360
7492 7216
7464 7065
6858 7362
6641 7447
7493 7486
6438 6441
6512 3875
1551 129
7285 5755
5102 7182
7168 7463
7136 7397
6704 7363
6194 7341
5456 74...

result:

ok da

Test #82:

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

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: 19ms
memory: 11476kb

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
4242 4227
4240 4241
4236 4239
4233 4235
4229 4232
4224 4244
4220 4221
4218 4219
4214 4217
4212 4213
4280 4258
4278 4279
4276 4277
4264 4266
4260 4263
4256 4211
4253 4255
4249 4251
4246 4248
4150 4245
4167 4170
4165 4166
4156 4160
4152 4154
4173 4151
4147 4149
4145 4146
4141 4142
4139 4140
4186 ...

result:

ok da

Test #84:

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

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
7485 7485
7293 7275
7396 7078
7497 7459
7499 4964
7495 6871
7491 7494
7195 6851
7328 7498
7365 7343
650 7415
7466 7443
6536 7469
3768 6223
7065 6512
1551 7447
6438 7496
6641 7216
7404 7468
7362 129
7492 7486
6858 3875
7360 6441
7136 7464
5015 7489
7472 6704
7324 7363
5755 7493
7226 7285
7471 71...

result:

ok da

Test #85:

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

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: 14ms
memory: 12344kb

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
3130 3130
6027 3147
3145 3146
3139 3141
3132 3137
6030 6023
3127 3128
6031 3124
6032 3121
3172 3158
6016 6013
3165 6017
6019 3160
6033 3159
6022 6020
3154 3156
3150 3153
3092 3149
3099 3100
3097 3098
6045 3095
3094 6046
3091 3101
6048 3089
6050 6049
6051 3088
6042 3174
3102 6041
3106 3103
6035 ...

result:

ok da

Test #87:

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

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
7459 7275
7396 7485
4964 7078
7499 7497
7500 7293
6871 7495
7195 6851
7443 7328
7365 7343
650 7415
7469 7466
7491 7494
6223 7498
6536 3768
7492 7362
129 6641
7496 6858
7404 7464
1551 7447
7468 6438
7486 7065
7360 7216
6441 6512
7489 3875
7341 7397
7136 7475
7490 7463
7484 7472
7363 6194
7168 67...

result:

ok da

Test #88:

score: 0
Accepted
time: 14ms
memory: 13952kb

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: 14ms
memory: 11204kb

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
4271 4246
4269 4270
4265 4267
4258 4263
4248 4250
4245 4272
4242 4244
4238 4240
4235 4237
4233 4234
4313 4294
4308 4312
4303 4305
4300 4301
4297 4299
4293 4232
4287 4292
4284 4286
4277 4282
4171 4275
4188 4189
4182 4183
4175 4181
4173 4174
4190 4172
4166 4170
4164 4165
4161 4163
4159 4160
4206 ...

result:

ok da

Test #90:

score: 0
Accepted
time: 617ms
memory: 209640kb

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
93419 93419
98466 97967
96835 64268
96160 99984
99991 99995
86198 99961
84212 98550
99987 99994
99959 66535
98979 96267
99993 94316
99981 99751
99956 99980
99830 99989
9758 99985
83488 97158
83517 42907
97606 93665
99979 94028
87183 99957
99796 84236
99678 99978
99958 99983
80658 94142
99968 2...

result:

ok da

Test #91:

score: 0
Accepted
time: 156ms
memory: 103560kb

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 99995
99994 99992
99993 99990
99991 99989
99988 99988
99987 99987
99986 99985
99984 99984
99983 99983
99982 99982
99981 99981
99980 99979
99978 99978
99977 99977
99976 99976
99975 99974
99973 99970
99972 99969
99971 99965
99968 99964
99967 99962
99966 99961
99963 99960
99959 99958
99957 ...

result:

ok da

Test #92:

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

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
41594 41594
41579 41578
41580 79871
79866 79869
41582 41581
41586 41585
41593 41588
41576 79865
79863 41600
79861 41602
41605 41603
41609 41607
41611 41610
41613 79860
41554 41615
79883 41537
41541 79882
41543 79881
79877 41545
41551 41546
79874 79876
79858 41552
79873 41556
41560 41558
41565 ...

result:

ok da

Test #93:

score: 0
Accepted
time: 546ms
memory: 209848kb

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
99995 96160
99991 64268
99961 99984
99987 99996
93419 99994
86198 98550
84212 96835
97967 98466
99751 66535
99959 94316
99830 99993
99989 98979
9758 97158
83488 42907
99956 96267
99985 83517
93665 97606
99980 99981
98264 99796
99992 87183
99990 94028
94211 99968
99978 99979
99958 99957
94142 9...

result:

ok da

Test #94:

score: 0
Accepted
time: 202ms
memory: 102600kb

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
99994 99994
99993 99993
99992 99995
99991 99990
99989 99988
99987 99987
99986 99981
99985 99978
99984 99975
99983 99974
99982 99973
99980 99970
99968 99979
99967 99967
99964 99964
99963 99977
99960 99976
99959 99972
99956 99971
99955 99969
99954 99966
99950 99950
99948 99965
99943 ...

result:

ok da

Test #95:

score: 0
Accepted
time: 240ms
memory: 102764kb

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
79656 41499
79645 79647
41492 79643
41494 79642
41495 79640
41497 79639
79636 79638
79633 79658
79626 41502
41503 79624
41506 41505
41508 41507
79620 79623
41511 41510
79684 41474
79678 79680
41457 79674
41461 79672
79668 41463
41467 41465
41473 41470
41475 41512
79666 41478
41481 79665
79662 ...

result:

ok da

Test #96:

score: 0
Accepted
time: 578ms
memory: 210048kb

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
66535 66535
99995 99994
99961 99997
98466 99984
96835 99987
97967 99991
93419 96160
84212 86198
64268 98550
99956 99980
9758 99959
99989 42907
94316 98979
97606 83488
99751 97158
99981 99996
99985 99830
96267 93665
83517 99993
87183 94028
99979 98264
99992 99983
99796 94142
94211 99968
99978 9...

result:

ok da

Test #97:

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

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
99993 99997
99996 99989
99995 99988
99994 99987
99992 99983
99991 99982
99981 99981
99979 99990
99978 99986
99977 99985
99976 99984
99974 99980
99972 99975
99970 99973
99968 99971
99967 99969
99966 99966
99965 99963
99964 99962
99961 99961
99960 99956
99955 99955
99954 99954
99952 99959
99951 ...

result:

ok da

Test #98:

score: 0
Accepted
time: 246ms
memory: 104396kb

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
55857 55857
55869 55870
55865 55867
55860 55864
55858 55859
55856 55871
55852 55855
55846 55848
55843 55845
55872 55840
55874 55873
55876 55875
55880 55877
55882 55881
55891 55883
55895 55893
55898 55896
55776 55808
55778 55777
55784 55780
55789 55786
55791 55790
55793 55792
55800 55798
55807 ...

result:

ok da

Test #99:

score: 0
Accepted
time: 549ms
memory: 209912kb

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
99984 66535
99961 99998
98550 64268
97967 98466
96160 96835
84212 86198
94316 93419
9758 99995
97158 96267
99997 83488
99994 99987
99751 97606
98979 99980
99959 99956
99991 99830
83517 93665
99678 42907
99796 98264
80658 99968
87183 94211
27748 99985
84775 99923
99979 94142
94028 99989
99957 9...

result:

ok da

Test #100:

score: 0
Accepted
time: 186ms
memory: 103268kb

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 99998
99997 99996
99995 99994
99993 99991
99992 99989
99988 99988
99986 99986
99985 99990
99982 99987
99980 99984
99979 99983
99978 99978
99977 99977
99973 99973
99972 99981
99971 99976
99969 99975
99968 99968
99966 99974
99965 99965
99959 99970
99958 99967
99957 99957
99956 99956
99954 ...

result:

ok da

Test #101:

score: 0
Accepted
time: 240ms
memory: 102852kb

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
41461 41478
41463 41462
41466 41464
41470 41468
41472 79723
41475 41474
79722 41476
41480 41458
41484 79721
41487 41486
41491 41490
41494 41492
41495 79718
41504 79717
79744 41449
41432 79742
41439 41437
41443 41441
41446 41444
79740 79741
41448 41447
79739 79716
41451 41450
79734 79735
79728 ...

result:

ok da

Test #102:

score: 0
Accepted
time: 560ms
memory: 209612kb

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
66535 66535
99998 99984
64268 99961
99999 98550
97967 98466
96160 96835
84212 93419
83488 86198
99830 99751
9758 94316
98979 99987
97606 42907
99980 97158
99991 99995
99994 99997
83517 99956
99959 96267
99985 93665
99968 99796
94028 98264
80658 94211
94142 87183
99979 99978
99923 99981
99996 2...

result:

ok da

Test #103:

score: 0
Accepted
time: 165ms
memory: 102952kb

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 99999
99998 99997
99996 99995
99994 99994
99993 99993
99992 99992
99991 99991
99990 99990
99989 99987
99988 99986
99985 99984
99983 99978
99982 99977
99981 99976
99980 99975
99979 99971
99974 99969
99973 99965
99972 99962
99970 99960
99968 99957
99967 99953
99966 99950
99964 99949
99963 ...

result:

ok da

Test #104:

score: 0
Accepted
time: 243ms
memory: 104108kb

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
56082 56082
56097 56098
56094 56095
56087 56093
56083 56084
56081 56101
56076 56079
56073 56075
56066 56068
56102 56064
56108 56104
56110 56109
56114 56113
56116 56115
56118 56117
56121 56119
56125 56124
55997 56028
55999 55998
56002 56000
56010 56004
56013 56012
56019 56018
56022 56020
56027 ...

result:

ok da

Test #105:

score: 0
Accepted
time: 630ms
memory: 209560kb

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 96160
64268 99998
99999 99961
98466 93419
98550 86198
84212 97967
96835 99984
94316 66535
99959 99751
99994 99980
99991 99987
99956 98979
97606 99995
99997 97158
93665 99830
42907 9758
83488 96267
87183 83517
99957 99958
99796 99978
99996 94028
99923 99968
94211 98264
94142 99981
84236 ...

result:

ok da

Test #106:

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

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
99999 100000
99998 99998
99997 99997
99996 99995
99994 99994
99993 99993
99992 99992
99991 99991
99990 99990
99989 99989
99988 99988
99987 99986
99985 99984
99983 99983
99982 99981
99980 99980
99979 99979
99978 99978
99977 99977
99976 99974
99975 99972
99973 99971
99970 99970
99969 99969
99968...

result:

ok da

Test #107:

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

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
55815 55792
55809 55810
55803 55808
55799 55800
55816 55797
55787 55790
55783 55784
55778 55780
55773 55777
55818 55817
55823 55821
55825 55824
55828 55826
55833 55829
55836 55834
55843 55841
55738 55845
55715 55712
55720 55717
55723 55722
55725 55724
55728 55726
55731 55730
55736 55733
55846 ...

result:

ok da

Test #108:

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

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: 0
Accepted
time: 1ms
memory: 8140kb

input:

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

output:

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

result:

ok da

Test #110:

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

input:

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

output:

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

result:

ok da

Test #111:

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

input:

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

output:

498
500 498
499 497
496 496
495 495
494 494
493 493
492 492
491 491
490 490
489 489
488 488
487 487
486 486
485 485
484 484
483 483
482 482
481 481
480 480
479 479
478 478
477 477
476 476
475 475
474 474
473 473
472 472
471 471
470 470
469 469
468 468
467 467
466 466
465 465
464 464
463 463
462 462
...

result:

ok da

Test #112:

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

input:

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

output:

496
497 500
499 498
496 494
493 495
492 492
491 491
490 490
489 489
488 488
487 487
486 486
485 485
484 484
483 483
482 482
481 481
480 480
479 479
478 478
477 477
476 476
475 475
474 474
473 473
472 472
471 471
470 470
469 469
468 468
467 467
466 466
465 465
464 464
463 463
462 462
461 461
460 460
...

result:

ok da

Test #113:

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

input:

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

output:

495
500 500
499 498
497 497
496 495
494 493
490 490
491 492
488 489
487 487
486 486
485 485
484 484
483 483
482 482
481 481
480 480
479 479
478 478
477 477
476 476
475 475
474 474
473 473
472 472
471 471
470 470
469 469
468 468
467 467
466 466
465 465
464 464
463 463
462 462
461 461
460 460
459 459
...

result:

ok da

Test #114:

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

input:

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

output:

490
499 500
498 498
496 496
495 497
494 494
493 493
492 492
490 490
489 491
488 487
486 485
484 484
483 483
482 481
480 480
479 477
476 478
475 474
473 473
472 471
470 470
469 469
468 468
467 467
466 466
465 465
464 464
463 463
462 462
461 461
460 460
459 459
458 458
457 457
456 456
455 455
454 454
...

result:

ok da

Test #115:

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

input:

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

output:

486
500 500
499 499
498 498
497 497
496 496
495 495
494 494
493 493
492 492
491 491
490 490
489 489
488 488
487 487
485 485
484 486
483 483
482 482
481 481
480 480
479 479
478 478
477 477
476 476
475 475
474 474
473 473
472 472
471 471
470 470
469 469
468 468
467 467
466 466
465 465
464 464
463 463
...

result:

ok da

Test #116:

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

input:

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

output:

7498
7500 7498
7499 7497
7496 7496
7495 7495
7494 7494
7493 7493
7492 7492
7491 7491
7490 7490
7489 7489
7488 7488
7487 7487
7486 7486
7485 7485
7484 7484
7483 7483
7482 7482
7481 7481
7480 7480
7479 7479
7478 7478
7477 7477
7476 7476
7475 7475
7474 7474
7473 7473
7472 7472
7471 7471
7470 7470
7469 ...

result:

ok da

Test #117:

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

input:

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

output:

7496
7497 7500
7499 7498
7496 7494
7493 7495
7492 7492
7491 7491
7490 7490
7489 7489
7488 7488
7487 7487
7486 7486
7485 7485
7484 7484
7483 7483
7482 7482
7481 7481
7480 7480
7479 7479
7478 7478
7477 7477
7476 7476
7475 7475
7474 7474
7473 7473
7472 7472
7471 7471
7470 7470
7469 7469
7468 7468
7467 ...

result:

ok da

Test #118:

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

input:

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

output:

7495
7500 7500
7499 7498
7497 7497
7496 7495
7494 7493
7490 7490
7491 7492
7489 7488
7487 7487
7486 7486
7485 7485
7484 7484
7483 7483
7482 7482
7481 7481
7480 7480
7479 7479
7478 7478
7477 7477
7476 7476
7475 7475
7474 7474
7473 7473
7472 7472
7471 7471
7470 7470
7469 7469
7468 7468
7467 7467
7466 ...

result:

ok da

Test #119:

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

input:

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

output:

7490
7499 7500
7498 7498
7496 7496
7495 7497
7494 7494
7493 7493
7492 7492
7490 7490
7491 7489
7488 7487
7486 7485
7484 7484
7483 7483
7482 7481
7480 7480
7479 7477
7476 7478
7475 7474
7473 7473
7472 7471
7470 7470
7469 7469
7468 7468
7467 7467
7466 7466
7465 7465
7464 7464
7463 7463
7462 7462
7461 ...

result:

ok da

Test #120:

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

input:

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

output:

7484
7500 7500
7499 7498
7497 7497
7496 7496
7495 7495
7494 7494
7493 7493
7492 7492
7491 7491
7490 7490
7489 7489
7488 7488
7487 7487
7486 7486
7485 7485
7484 7484
7483 7483
7482 7482
7481 7481
7480 7480
7479 7479
7478 7478
7477 7477
7476 7476
7475 7475
7474 7474
7473 7473
7472 7472
7471 7471
7470 ...

result:

ok da

Test #121:

score: 0
Accepted
time: 163ms
memory: 89504kb

input:

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

output:

99998
100000 99998
99999 99997
99996 99996
99995 99995
99994 99994
99993 99993
99992 99992
99991 99991
99990 99990
99989 99989
99988 99988
99987 99987
99986 99986
99985 99985
99984 99984
99983 99983
99982 99982
99981 99981
99980 99980
99979 99979
99978 99978
99977 99977
99976 99976
99975 99975
99974...

result:

ok da

Test #122:

score: 0
Accepted
time: 171ms
memory: 88392kb

input:

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

output:

99996
99997 100000
99999 99998
99996 99994
99993 99995
99992 99992
99991 99991
99990 99990
99989 99989
99988 99988
99987 99987
99986 99986
99985 99985
99984 99984
99983 99983
99982 99982
99981 99981
99980 99980
99979 99979
99978 99978
99977 99977
99976 99976
99975 99975
99974 99974
99973 99973
99972...

result:

ok da

Test #123:

score: 0
Accepted
time: 155ms
memory: 88352kb

input:

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

output:

99995
100000 100000
99999 99998
99997 99997
99996 99995
99994 99993
99990 99990
99991 99992
99989 99988
99987 99987
99986 99986
99985 99985
99984 99984
99983 99983
99982 99982
99981 99981
99980 99980
99979 99979
99978 99978
99977 99977
99976 99976
99975 99975
99974 99974
99973 99973
99972 99972
9997...

result:

ok da

Test #124:

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

input:

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

output:

99990
99999 100000
99998 99998
99996 99996
99995 99997
99994 99994
99993 99993
99992 99992
99990 99990
99991 99989
99988 99987
99986 99985
99984 99984
99983 99983
99982 99981
99980 99980
99977 99979
99976 99978
99974 99975
99973 99973
99972 99971
99970 99970
99969 99969
99968 99968
99967 99967
99966...

result:

ok da

Test #125:

score: 0
Accepted
time: 152ms
memory: 88504kb

input:

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

output:

99984
100000 100000
99999 99999
99998 99998
99997 99997
99996 99996
99995 99995
99994 99994
99993 99993
99992 99992
99991 99991
99990 99990
99989 99989
99988 99988
99987 99987
99986 99986
99985 99985
99984 99984
99983 99983
99982 99982
99981 99981
99980 99980
99979 99979
99978 99978
99977 99977
9997...

result:

ok da

Test #126:

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

input:

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

output:

364
499 499
500 498
496 496
495 497
494 494
493 493
492 492
491 491
490 489
488 488
487 487
484 484
486 485
483 483
482 482
481 481
480 480
479 478
475 475
477 476
474 474
473 472
471 471
470 470
469 468
467 467
466 466
464 464
463 465
462 462
461 461
460 459
458 457
456 456
455 455
454 454
453 452
...

result:

ok da

Test #127:

score: 0
Accepted
time: 5ms
memory: 11760kb

input:

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

output:

5701
7500 7500
7499 7498
7497 7496
7494 7495
7493 7493
7492 7492
7490 7491
7489 7489
7488 7488
7486 7487
7485 7485
7483 7483
7482 7484
7481 7481
7480 7480
7479 7478
7477 7477
7476 7476
7475 7475
7474 7474
7472 7473
7471 7470
7469 7469
7468 7468
7467 7467
7466 7466
7465 7465
7464 7463
7462 7462
7461 ...

result:

ok da

Test #128:

score: -100
Wrong Answer
time: 141ms
memory: 89116kb

input:

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

output:

79637
100000 100000
99999 99999
99998 99997
99995 99996
99994 99994
99993 99993
99992 99992
99991 99991
99990 99989
99988 99988
99987 99987
99986 99986
99985 99985
99984 99984
99983 99982
99981 99981
99979 99980
99978 99978
99977 99977
99975 99976
99974 99974
99973 99972
99971 99971
99970 99969
9996...

result:

wrong answer jury have better solution