QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#124452#2789. Sortingvalerikk#100 ✓81ms32008kbC++172.1kb2023-07-14 20:04:552024-07-04 00:40:38

Judging History

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

  • [2024-07-04 00:40:38]
  • 评测
  • 测评结果:100
  • 用时:81ms
  • 内存:32008kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-14 20:04:55]
  • 提交

answer

#include "sorting.h"
#include <bits/stdc++.h>

using namespace std;

namespace {

const int N = 2e5 + 7;
const int M = 6e5 + 7;

int n, s[N];
int m, x[M], y[M];
int ansp[M], ansq[M];
int ansr;
int curs[N], s1[N];
bool used[N];
int pos[N];

}

int findSwapPairs(int grdn, int grds[], int grdm, int grdx[], int grdy[], int grdp[], int grdq[]) {
	n = grdn;
	for (int i = 0; i < n; ++i) {
		s[i] = grds[i];
	}
	m = grdm;
	for (int i = 0; i < m; ++i) {
		x[i] = grdx[i];
		y[i] = grdy[i];
	}
	int l = -1, r = m + 1;
	while (r - l > 1) {
		int mid = (l + r) / 2;
		for (int i = 0; i < n; ++i) {
			curs[i] = s[i];
		}
		for (int i = 0; i < mid; ++i) {
			swap(curs[x[i]], curs[y[i]]);
		}
		int cnt = 0;
		for (int i = 0; i < n; ++i) {
			used[i] = 0;
		}
		for (int i = 0; i < n; ++i) {
			if (!used[i]) {
				int v = i;
				while (!used[v]) {
					used[v] = 1;
					v = curs[v];
				}
				++cnt;
			}
		}
		if (n - cnt <= mid) {
			r = mid;
		} else {
			l = mid;
		}
	}
	for (int i = 0; i < n; ++i) {
		curs[i] = s[i];
	}
	for (int i = 0; i < r; ++i) {
		swap(curs[x[i]], curs[y[i]]);
	}
	vector<vector<int>> kek;
	for (int i = 0; i < n; ++i) {
		used[i] = 0;
	}
	for (int i = 0; i < n; ++i) {
		if (!used[i]) {
			int v = i;
			vector<int> lol;
			while (!used[v]) {
				used[v] = 1;
				lol.push_back(v);
				v = curs[v];
			}
			kek.push_back(lol);
		}
	}
	assert(r >= n - (int)kek.size());
	ansr = r;
	for (int i = 0; i < n; ++i) {
		s1[i] = curs[i];
	}
	vector<pair<int, int>> swaps;
	for (auto lol : kek) {
		for (int i = 1; i < (int)lol.size(); ++i) {
			swaps.push_back({s1[lol[0]], s1[lol[i]]});
			swap(s1[lol[0]], s1[lol[i]]);
		}
	}
	while ((int)swaps.size() < r) {
		swaps.push_back({0, 0});
	}
	assert((int)swaps.size() == r);
	for (int i = 0; i < n; ++i) {
		s1[i] = curs[i];
	}
	for (int i = 0; i < n; ++i) {
		pos[s1[i]] = i;
	}
	for (int i = r - 1; i >= 0; --i) {
		int x1 = swaps[r - i - 1].first;
		int y1 = swaps[r - i - 1].second;
		int px1 = pos[x1];
		int py1 = pos[y1];
		ansp[i] = px1;
		ansq[i] = py1;
		swap(pos[s1[x[i]]], pos[s1[y[i]]]);
		swap(s1[x[i]], s1[y[i]]);
	}
	for (int i = 0; i < ansr; ++i) {
		grdp[i] = ansp[i];
		grdq[i] = ansq[i];
	}
	return ansr;
}



詳細信息

Subtask #1:

score: 8
Accepted

Test #1:

score: 8
Accepted
time: 1ms
memory: 9924kb

input:

1
0
1
0 0

output:

0

result:

ok correct

Test #2:

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

input:

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

output:

0

result:

ok correct

Test #3:

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

input:

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

output:

1
0 1

result:

ok correct

Test #4:

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

input:

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

output:

1
0 1

result:

ok correct

Test #5:

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

input:

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

output:

3
1 2
3 1
0 3

result:

ok correct

Test #6:

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

input:

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

output:

2
1 4
0 1

result:

ok correct

Test #7:

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

input:

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

output:

3
1 2
4 3
0 4

result:

ok correct

Subtask #2:

score: 12
Accepted

Test #8:

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

input:

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

output:

0

result:

ok correct

Test #9:

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

input:

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

output:

0

result:

ok correct

Test #10:

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

input:

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

output:

93
44 9
94 44
32 94
38 32
62 38
68 62
89 68
97 89
76 97
54 76
96 54
16 96
78 16
25 78
33 25
58 33
24 58
56 24
35 56
53 35
36 53
57 36
79 57
66 79
8 66
13 91
37 13
42 37
85 42
19 85
90 19
7 90
15 7
65 15
46 65
14 46
86 14
39 86
27 39
4 27
6 84
93 6
45 93
70 45
1 70
92 1
69 92
83 69
23 83
77 23
28 77
...

result:

ok correct

Test #11:

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

input:

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

output:

92
53 84
79 47
15 79
45 15
40 45
58 40
89 58
78 89
59 78
28 59
80 28
12 80
18 66
6 18
17 31
94 17
64 94
98 64
4 98
41 61
60 41
85 60
55 85
95 55
37 95
88 37
72 88
35 72
82 35
73 82
81 73
20 81
75 20
71 75
27 71
39 27
24 39
57 24
92 57
76 92
91 76
96 91
62 96
29 62
44 29
90 44
16 90
87 16
48 87
43 48...

result:

ok correct

Test #12:

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

input:

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

output:

95
13 60
9 13
37 9
41 37
8 41
19 8
87 19
24 87
23 24
44 23
4 44
83 4
28 83
45 28
55 45
54 55
64 54
88 64
68 88
84 68
53 84
17 53
25 17
49 25
33 49
27 33
79 27
11 79
40 11
31 40
63 31
7 63
39 7
74 39
91 74
1 91
62 1
50 62
16 50
95 16
77 95
58 77
67 58
21 67
29 21
93 29
10 93
78 10
15 78
76 15
69 76
6...

result:

ok correct

Subtask #3:

score: 16
Accepted

Test #13:

score: 16
Accepted
time: 1ms
memory: 11932kb

input:

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

output:

0

result:

ok correct

Test #14:

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

input:

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

output:

2
4 2
1 4

result:

ok correct

Test #15:

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

input:

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

output:

91
6 20
17 6
75 17
80 75
11 80
4 11
56 4
12 56
2 12
95 23
3 95
42 3
7 42
0 7
40 79
90 40
70 90
76 70
48 76
65 48
35 65
45 35
28 45
27 28
25 27
29 25
9 29
36 9
84 36
54 84
73 54
22 73
21 22
50 21
5 50
32 5
39 32
19 39
52 19
55 52
59 55
88 59
47 88
83 47
93 83
51 93
68 51
38 68
58 38
10 58
46 10
77 46...

result:

ok correct

Test #16:

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

input:

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

output:

92
96 89
23 96
12 59
19 86
51 19
71 51
90 71
7 90
48 61
55 48
43 55
94 43
72 94
31 72
77 31
65 77
38 65
24 38
53 24
56 53
21 56
84 21
68 84
44 68
29 44
17 29
47 17
35 47
25 35
75 25
76 75
34 76
36 34
30 36
6 30
5 6
45 5
58 45
52 58
88 52
64 88
80 64
82 80
10 82
74 10
63 74
87 63
37 87
85 37
67 85
26...

result:

ok correct

Test #17:

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

input:

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

output:

97
35 83
29 35
85 29
49 85
16 49
21 16
98 21
80 98
32 80
93 32
76 93
70 76
58 70
97 58
94 97
22 94
74 22
30 74
17 30
48 17
8 48
23 8
86 23
69 86
67 69
60 67
11 60
9 11
28 9
36 28
25 36
51 25
39 51
77 39
31 77
55 31
71 55
13 71
26 13
78 26
24 78
33 24
20 33
84 20
41 84
79 41
15 79
34 15
57 34
47 57
1...

result:

ok correct

Test #18:

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

input:

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

output:

2
1 1
2 3

result:

ok correct

Subtask #4:

score: 18
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #19:

score: 18
Accepted
time: 1ms
memory: 12164kb

input:

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

output:

0

result:

ok correct

Test #20:

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

input:

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

output:

0

result:

ok correct

Test #21:

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

input:

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

output:

473
172 187
399 172
75 399
433 75
327 433
475 327
249 475
125 249
473 333
418 473
80 261
360 80
296 360
226 296
258 226
223 258
184 223
161 184
147 161
459 147
180 459
215 180
16 215
288 16
141 288
464 141
71 464
339 71
324 339
192 324
61 192
278 61
59 278
458 59
102 458
368 102
46 368
287 46
289 28...

result:

ok correct

Test #22:

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

input:

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

output:

476
253 253
457 391
185 457
214 185
171 214
293 171
139 293
219 139
364 425
227 364
0 227
98 0
372 98
459 372
38 459
275 38
307 275
137 307
343 137
292 343
218 292
156 218
251 156
29 251
129 29
160 129
42 160
285 42
266 285
196 266
30 196
92 30
216 92
2 216
320 2
200 320
26 200
392 26
159 392
155 15...

result:

ok correct

Test #23:

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

input:

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

output:

490
403 403
313 60
300 47
70 300
150 70
158 150
440 178
479 440
442 479
253 442
131 253
164 131
392 164
340 392
176 340
235 176
89 235
341 89
212 341
254 212
186 254
171 186
103 171
196 103
183 196
361 183
404 361
396 404
342 396
202 342
449 202
379 449
419 379
433 419
338 433
0 123
269 0
346 269
39...

result:

ok correct

Test #24:

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

input:

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

output:

422
380 450
336 422
315 385
304 314
440 421
292 440
281 343
276 466
254 369
222 328
217 370
208 467
361 418
204 361
198 267
194 354
182 395
393 182
342 393
346 342
179 56
177 200
446 356
174 446
306 365
170 306
163 390
157 348
301 231
144 301
258 416
137 258
383 430
238 383
136 238
134 444
298 420
1...

result:

ok correct

Test #25:

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

input:

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

output:

145
270 270
484 488
482 483
146 481
442 473
421 162
93 450
69 441
404 413
440 386
380 440
374 394
372 452
369 456
365 388
361 464
358 100
144 416
352 494
346 461
321 129
316 403
312 273
307 299
234 304
294 431
495 301
293 495
284 478
279 385
276 490
274 276
255 384
357 340
247 357
298 393
243 31
241...

result:

ok correct

Test #26:

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

input:

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

output:

270
0 0
400 392
428 359
412 334
403 328
416 323
398 299
322 284
469 279
338 252
420 338
343 244
441 343
466 242
253 218
445 200
404 181
371 175
460 168
248 167
395 248
237 155
201 147
476 201
357 476
292 357
364 140
133 296
405 129
208 119
473 208
341 273
115 341
217 107
375 217
397 375
424 397
259 ...

result:

ok correct

Test #27:

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

input:

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

output:

473
475 257
412 83
420 412
348 420
413 348
217 413
153 217
269 0
258 269
159 258
276 159
55 276
333 55
250 333
454 250
425 454
147 425
452 147
419 452
411 419
291 411
379 291
169 379
392 169
56 392
142 56
224 142
80 224
48 80
353 48
349 353
238 349
407 238
263 407
23 263
315 23
11 315
393 11
154 393...

result:

ok correct

Subtask #5:

score: 20
Accepted

Test #28:

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

input:

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

output:

1794
328 1512
694 328
1288 694
595 1288
1036 595
121 1036
1420 121
1260 1420
780 1260
330 780
442 330
991 442
1247 991
1628 1247
978 1628
1447 978
975 1447
183 975
1019 183
1493 1019
1596 1493
266 1596
1002 266
799 1002
1716 799
310 1716
1192 310
1013 1192
387 1013
734 387
1784 734
660 1784
1130 660...

result:

ok correct

Test #29:

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

input:

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

output:

1944
1620 1219
1280 1620
685 1280
522 685
743 522
1141 743
951 1141
1608 951
1274 1608
930 1274
1937 930
276 1937
73 192
556 1397
1939 556
788 1939
1675 788
791 1239
1653 791
272 1653
1666 272
464 1666
1209 464
64 1209
1441 1770
1046 1441
1286 1046
319 1286
1650 319
985 1650
1465 985
1045 1465
115 1...

result:

ok correct

Test #30:

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

input:

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

output:

1844
1354 1354
1154 1139
170 1154
1314 170
1303 1314
267 1303
953 267
1401 953
426 1401
487 426
1083 487
1764 1083
460 1764
739 460
1767 739
628 1767
5 628
1048 5
1116 1048
943 900
1460 943
1377 1460
1567 1377
1614 1567
588 1614
114 588
1808 114
1186 1808
1687 1186
177 579
928 177
451 928
428 451
61...

result:

ok correct

Test #31:

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

input:

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

output:

0

result:

ok correct

Test #32:

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

input:

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

output:

134
1987 1828
1934 1778
1770 1753
1706 1694
1774 1587
1548 1494
1741 1455
1755 1434
1478 1415
1690 1360
1290 1473
1395 1264
1283 1258
1430 1216
1711 1430
1595 1189
1954 1184
1938 1126
1571 1068
1321 1054
1875 1017
1007 1895
1312 982
972 1733
1008 963
960 1911
1743 959
1842 946
939 1066
1747 939
1777...

result:

ok correct

Test #33:

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

input:

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

output:

377
1902 1877
1862 1854
1804 1803
1747 1741
1806 1705
1916 1621
1904 1563
1608 1546
1852 1525
1644 1439
1846 1430
1827 1846
1494 1827
1579 1425
1710 1395
1703 1322
1629 1318
1468 1292
1536 1291
1706 1290
1303 1272
1667 1265
1261 1361
1606 1246
1509 1235
1224 1730
1376 1204
1867 1195
1433 1183
1718 1...

result:

ok correct

Test #34:

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

input:

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

output:

1080
0 0
1895 1870
1753 1731
1724 1679
1643 1616
1915 1614
1936 1587
1940 1936
1847 1564
1628 1561
1762 1557
1799 1542
1750 1499
1602 1750
1702 1492
1676 1489
1790 1676
1966 1478
1545 1462
1853 1457
1664 1448
1845 1418
1758 1374
1479 1362
1892 1325
1784 1321
1690 1316
1360 1275
1257 1251
1308 1201
1...

result:

ok correct

Test #35:

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

input:

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

output:

1897
917 1216
923 917
739 923
1837 739
544 1837
1871 544
894 383
866 894
1120 866
1360 1120
1149 1360
156 1149
449 156
1724 449
1064 1724
122 1064
677 122
1773 677
1749 1773
890 1749
1295 890
224 1295
1189 224
736 1189
1597 736
785 1597
690 785
1335 690
369 1335
264 369
1567 264
72 1567
1214 72
1458...

result:

ok correct

Test #36:

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

input:

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

output:

1923
1155 1217
1458 1155
289 1458
1749 466
1064 1749
650 1064
647 650
1401 647
1532 1401
1024 1532
915 1024
1124 915
402 1124
1640 402
1697 1640
1624 1697
989 1624
1615 989
151 1615
1275 151
1518 1275
1100 1518
10 1100
1710 10
122 1710
1739 122
1449 1739
314 1449
1263 195
175 1263
250 175
729 250
10...

result:

ok correct

Test #37:

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

input:

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

output:

1928
1460 1460
1023 1108
607 1023
586 607
1505 586
1640 1505
1116 1640
1933 1934
1844 1933
1887 1844
1890 1887
659 1890
1596 659
307 1596
1265 307
1444 1265
136 1444
750 136
1775 750
613 1775
275 613
496 1184
1506 496
102 1506
476 102
1012 476
1703 1012
1425 1703
1929 1425
423 1929
291 423
1535 291
...

result:

ok correct

Test #38:

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

input:

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

output:

1693
47 47
1639 1853
1637 1985
1829 1663
1531 1829
1520 1596
1506 1988
1490 1570
1659 1968
1470 1659
1459 1848
1859 1789
1325 1859
1302 1785
1286 1609
1282 1793
1855 1993
1278 1855
1591 1415
1267 1591
1733 1783
1238 1733
1236 1507
1211 1331
1210 1775
1251 1201
1954 1251
1184 1700
1757 1879
1113 1757...

result:

ok correct

Test #39:

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

input:

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

output:

1091
1861 1753
1970 1730
1808 1687
1843 1679
1919 1678
1771 1653
1981 1627
1640 1623
1931 1568
1660 1548
1812 1520
1768 1498
1741 1768
1879 1741
1699 1488
1460 1459
1493 1456
1661 1438
1889 1428
1566 1420
1531 1386
1755 1382
1490 1330
1938 1309
1715 1938
1352 1304
1602 1274
1280 1272
1369 1270
1268 ...

result:

ok correct

Test #40:

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

input:

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

output:

1959
0 0
1256 564
1322 1256
723 1322
928 0
331 928
43 331
744 43
1575 744
932 1575
1847 932
782 1847
211 782
401 211
668 401
1960 668
74 1960
1701 74
1919 1701
16 1919
1804 16
50 1804
1464 50
555 1464
361 555
984 361
1010 984
1788 1010
749 1788
1709 749
1289 1709
340 1289
1583 340
1070 1583
1479 107...

result:

ok correct

Test #41:

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

input:

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

output:

2
0 0
1086 1779

result:

ok correct

Subtask #6:

score: 26
Accepted

Dependency #5:

100%
Accepted

Test #42:

score: 26
Accepted
time: 67ms
memory: 24112kb

input:

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

output:

176885
68238 121360
90753 68238
48858 90753
55048 48858
60677 55048
104261 60677
77945 104261
71910 77945
134640 71910
97714 134640
56119 97714
159877 56119
126079 159877
89122 126079
102573 89122
39598 102573
51174 163270
67951 51174
57154 67951
161254 57154
35892 161254
83409 35892
57491 83409
193...

result:

ok correct

Test #43:

score: 0
Accepted
time: 71ms
memory: 25004kb

input:

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

output:

180588
176290 47149
146067 176290
101818 146067
47370 101818
44129 47370
139968 67660
29572 139968
115919 82461
157997 115919
91017 157997
62004 91017
9496 62004
156866 135572
140957 156866
16600 140957
157316 16600
50749 157316
142577 50749
105801 142577
31205 105801
76383 31205
12655 76383
33545 1...

result:

ok correct

Test #44:

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

input:

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

output:

189985
118975 168298
6903 118975
31093 6903
103344 31093
57634 103344
63873 57634
169815 63873
138720 169815
159896 138720
153252 34993
110790 153252
178846 110790
72208 178846
1349 72208
102394 1349
66303 102394
186442 66303
65465 186442
63070 65465
180691 63070
4793 180691
101121 4793
33837 101121...

result:

ok correct

Test #45:

score: 0
Accepted
time: 38ms
memory: 27648kb

input:

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

output:

0

result:

ok correct

Test #46:

score: 0
Accepted
time: 74ms
memory: 31420kb

input:

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

output:

89748
0 0
195053 194769
194876 194248
194145 193043
193128 192558
194753 192461
193497 192420
191525 191215
193076 191062
192404 190586
195384 189570
191650 189330
191513 189303
190837 189154
190097 189003
195093 188786
194407 188314
190112 188154
192767 187741
193820 187720
189383 187608
193703 187...

result:

ok correct

Test #47:

score: 0
Accepted
time: 69ms
memory: 29920kb

input:

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

output:

100444
198488 198059
198310 197168
197451 197135
199367 196986
198083 195931
198557 195641
197167 195160
195392 194946
196336 194796
195499 194470
195805 194098
197282 194078
194976 193554
195794 193240
195986 193014
199275 192827
197337 192067
199073 191996
192105 191789
196136 191757
198842 191717...

result:

ok correct

Test #48:

score: 0
Accepted
time: 80ms
memory: 29380kb

input:

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

output:

102949
199158 197979
198265 195579
196140 195328
198371 194763
197672 194521
194453 194191
196849 193975
195375 193874
197268 193756
196613 193361
197229 193279
198188 193083
196780 192989
196883 192829
194547 192821
199221 192720
194921 192672
199125 192601
196865 192061
199901 192040
192775 191638...

result:

ok correct

Test #49:

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

input:

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

output:

193113
121697 124318
115614 121697
113516 115614
164781 113516
78179 164781
129893 124089
104966 129893
47298 104966
66327 104599
146073 66327
120266 146073
83593 120266
79568 83593
37693 79568
100238 37693
26042 100238
185503 144002
100878 185503
76434 100878
108221 76434
81302 108221
60365 81302
1...

result:

ok correct

Test #50:

score: 0
Accepted
time: 70ms
memory: 27668kb

input:

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

output:

197073
121350 128658
181414 75396
49059 181414
96126 49059
47307 96126
43471 47307
115358 43471
41765 115358
153229 41765
126690 153229
27187 126690
147051 29059
55799 147051
145497 55799
76499 145497
118811 76499
81575 118811
16634 81575
111710 16634
121087 111710
45514 121087
171932 45514
94185 17...

result:

ok correct

Test #51:

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

input:

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

output:

194290
49723 49723
35738 155722
82045 35738
47454 82045
94475 47454
15056 94475
42700 187009
116560 42700
187587 116560
165772 187587
84003 165772
124043 84003
151088 124043
178619 151088
39133 178619
44222 39133
19202 44222
179769 19202
145755 179769
121630 145755
69251 121630
24096 69251
95472 240...

result:

ok correct

Test #52:

score: 0
Accepted
time: 64ms
memory: 25100kb

input:

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

output:

191732
46257 92907
117123 46257
152639 117123
85578 152639
177824 85578
176084 177824
41080 176084
18731 41080
129275 18731
88964 129275
43549 88964
116599 43549
177163 116599
135086 177163
92514 135086
101482 92514
67067 101482
29225 67067
178222 29225
164293 178222
95769 164293
122661 95769
170678...

result:

ok correct

Test #53:

score: 0
Accepted
time: 80ms
memory: 29392kb

input:

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

output:

99996
8716 116224
105003 42910
95119 195373
36599 37922
82519 192209
13755 178496
97533 197007
902 151397
110452 60256
2158 199163
7953 74370
190092 178412
189978 110826
137605 106051
26402 196933
137213 198812
170285 191755
188102 23683
132204 194712
172559 198917
192561 162462
187414 192561
168683...

result:

ok correct

Test #54:

score: 0
Accepted
time: 60ms
memory: 29932kb

input:

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

output:

84206
0 0
169178 195142
54008 167832
41132 43845
194088 62327
190700 126574
149356 192176
78975 132816
186106 169219
186045 50648
83721 169797
109611 161616
162170 187458
52979 187439
184359 120887
23759 189396
33702 186090
134784 138915
126622 101930
113340 101818
182683 190706
182097 159568
181837...

result:

ok correct

Test #55:

score: 0
Accepted
time: 75ms
memory: 25976kb

input:

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

output:

182153
190730 190730
191140 191799
190598 192162
187286 188895
186636 189240
185595 187321
185426 194074
185235 188517
185125 193819
189805 189559
184171 189805
183446 188152
182991 185188
182834 184123
182451 185507
182062 190149
182017 186635
181633 190295
192975 184465
181408 192975
180989 188805...

result:

ok correct

Test #56:

score: 0
Accepted
time: 81ms
memory: 27444kb

input:

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

output:

165493
81100 81100
189832 191263
189170 190354
188135 188395
187095 188161
192125 190721
186826 192125
186561 188383
185466 185557
184794 191187
184610 185950
184390 191262
184101 192455
184083 186269
183416 185762
183410 187474
183358 186005
183314 192859
182545 189117
182188 189294
182155 188962
1...

result:

ok correct

Test #57:

score: 0
Accepted
time: 65ms
memory: 30412kb

input:

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

output:

49301
196472 196506
196157 196449
194904 196893
194778 195537
194672 194965
194530 195674
194303 196310
194238 196932
194208 197068
193915 196761
193808 193865
193684 194819
193641 195531
193631 195047
193492 197079
193306 194251
193267 195749
193244 197024
193130 195002
192901 195912
192881 195379
...

result:

ok correct

Test #58:

score: 0
Accepted
time: 64ms
memory: 26220kb

input:

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

output:

168671
84406 84406
195455 196304
194735 194764
193737 194215
193601 193663
193396 194756
193177 196617
193088 196286
192993 194192
192924 194606
192855 196094
192802 194060
192771 192816
192422 195600
192253 192965
192177 196394
192168 196661
191884 194933
191753 192425
191655 194283
191625 194116
1...

result:

ok correct

Test #59:

score: 0
Accepted
time: 76ms
memory: 26660kb

input:

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

output:

190706
26470 110891
87742 26470
68315 87742
135336 68315
184079 135336
47643 184079
25578 47643
111000 25578
165518 111000
159418 165518
16063 159418
19460 85033
135345 19460
180895 135345
107129 180895
5925 107129
64001 32066
176863 64001
28625 176863
190035 28625
65970 190035
153601 65970
149946 1...

result:

ok correct

Test #60:

score: 0
Accepted
time: 66ms
memory: 25424kb

input:

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

output:

193877
40600 73119
46317 53278
162942 46317
74952 162942
112684 74952
182673 112684
7695 182673
35195 105101
187423 76893
99389 187423
62502 99389
67708 62502
108753 67708
144393 108753
176582 144393
80460 176582
145841 80460
39673 145841
10812 39673
116549 10812
105479 116549
7818 105479
40162 7818...

result:

ok correct

Test #61:

score: 0
Accepted
time: 64ms
memory: 24916kb

input:

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

output:

193228
126017 126017
36101 50634
107184 36101
46196 107184
5347 46196
177152 5347
108559 177152
178239 108559
121112 178239
37032 121112
92621 37032
21282 92621
96637 21282
67546 96637
65042 67546
148442 65042
142275 148442
138736 142275
149848 138736
36445 149848
52149 36445
39411 52149
175853 3941...

result:

ok correct

Test #62:

score: 0
Accepted
time: 75ms
memory: 28860kb

input:

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

output:

95351
191284 191008
190486 190316
191725 190040
191387 189499
188608 188021
190972 187948
188432 187728
188725 187434
190044 187353
190338 186768
190602 186662
187911 186232
188268 186023
189283 185890
188173 185354
186565 184870
187610 184844
188416 187610
188908 184485
190988 184228
190979 184153
...

result:

ok correct

Test #63:

score: 0
Accepted
time: 37ms
memory: 32008kb

input:

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

output:

2
0 0
50474 139084

result:

ok correct

Test #64:

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

input:

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

output:

199698
0 0
148622 96742
111889 0
108898 111889
58719 108898
115518 58719
70187 115518
164611 70187
173316 164611
52572 173316
76597 52572
109329 76597
90947 109329
171226 90947
88443 171226
140194 88443
90269 140194
1603 90269
93624 1603
6081 93624
63513 6081
1635 63513
92948 1635
53809 92948
39020 ...

result:

ok correct

Test #65:

score: 0
Accepted
time: 71ms
memory: 25536kb

input:

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

output:

191784
0 0
63512 4121
39490 63512
161876 39490
68513 161876
79270 68513
189090 79270
154345 189090
88030 154345
83053 88030
35251 83053
88993 35251
146678 88993
12143 146678
186552 12143
23485 186552
134498 23485
99690 134498
51970 99690
56506 51970
165860 56506
65969 165860
4736 65969
116041 4736
8...

result:

ok correct

Test #66:

score: 0
Accepted
time: 74ms
memory: 25540kb

input:

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

output:

193069
67602 18119
19165 67602
163924 4873
176553 163924
139214 176553
143822 139214
62840 143822
6833 62840
103424 6833
39424 103424
129627 39424
79846 129627
51170 79846
145093 51170
137290 145093
182336 137290
73274 182336
85400 73274
170029 85400
11553 170029
187849 11553
142820 187849
6132 1428...

result:

ok correct