QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#236535#2789. SortingCamillus100 ✓75ms15644kbC++201.3kb2023-11-04 01:34:252023-11-04 01:34:26

Judging History

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

  • [2023-11-04 01:34:26]
  • 评测
  • 测评结果:100
  • 用时:75ms
  • 内存:15644kb
  • [2023-11-04 01:34:25]
  • 提交

answer

#include "bits/stdc++.h"
#include "sorting.h"
using namespace std;

int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
	int l = -1, r = M;
	while (r - l > 1) {
		int m = (l + r) / 2;

		vector<int> s(S, S + N);
		vector<int> pos(N);

		for (int i = 0; i < m; i++) {
			swap(s[X[i]], s[Y[i]]);
		}

		for (int i = 0; i < N; i++) {
			pos[s[i]] = i;
		}

		int cnt = 0;
		for (int i = 0; i < N; i++) {
			if (pos[i] != i) {
				cnt++;
				swap(s[i], s[pos[i]]);
				swap(pos[s[i]], pos[s[pos[i]]]);
			}
		}

		if (cnt <= m) {
			r = m;
		} else {
			l = m;
		}
	}

	vector<int> s(S, S + N);

	for (int i = 0; i < r; i++) {
		swap(s[X[i]], s[Y[i]]);
	}

	vector<int> pos(N);
	for (int i = 0; i < N; i++) {
		pos[s[i]] = i;
	}

	vector<pair<int, int>> t;
	for (int i = 0; i < N; i++) {
		if (i != pos[i]) {
			t.emplace_back(s[i], s[pos[i]]);
			swap(s[i], s[pos[i]]);
			swap(pos[s[i]], pos[s[pos[i]]]);
		}
	}

	s = vector<int>(S, S + N);

	pos = vector<int>(N);
	for (int i = 0; i < N; i++) {
		pos[s[i]] = i;
	}

	for (int i = 0; i < r; i++) {
		swap(s[X[i]], s[Y[i]]);
		swap(pos[s[X[i]]], pos[s[Y[i]]]);

		auto [x, y] = t[i];

		P[i] = pos[x];
		Q[i] = pos[y]; 

		swap(s[pos[x]], s[pos[y]]);
		swap(pos[x], pos[y]);
	}
	return r;
}

詳細信息

Subtask #1:

score: 8
Accepted

Test #1:

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

input:

1
0
1
0 0

output:

0

result:

ok correct

Test #2:

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

input:

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

output:

0

result:

ok correct

Test #3:

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

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

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

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

result:

ok correct

Test #6:

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

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
0 4
1 4

result:

ok correct

Test #7:

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

input:

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

output:

3
0 3
1 2
3 4

result:

ok correct

Subtask #2:

score: 12
Accepted

Test #8:

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

input:

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

output:

0

result:

ok correct

Test #9:

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

input:

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

output:

0

result:

ok correct

Test #10:

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

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
0 84
1 92
2 30
3 59
4 91
5 63
6 93
7 15
8 9
9 44
10 87
11 49
12 59
13 37
14 86
15 65
16 78
17 60
18 48
19 90
20 41
21 64
22 80
23 77
24 56
25 33
27 91
28 47
29 61
30 67
31 67
32 38
33 58
34 41
35 53
36 57
37 42
38 62
39 91
40 55
41 82
42 85
43 74
44 94
45 70
46 86
47 88
48 61
49 87
50 64
51 63
52...

result:

ok correct

Test #11:

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

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
0 3
1 61
2 13
3 13
4 31
5 33
6 66
7 25
8 13
9 26
10 25
11 54
12 47
13 69
14 61
15 45
16 87
17 94
18 66
19 65
20 75
21 86
22 49
23 54
24 57
25 38
26 50
27 39
28 80
29 44
30 56
31 94
32 83
33 68
34 36
35 82
36 86
37 88
38 65
39 57
40 58
41 60
42 49
43 77
44 90
45 58
47 79
48 77
49 65
50 69
51 97
52...

result:

ok correct

Test #12:

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

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
0 60
1 62
2 65
3 66
4 83
5 70
6 71
7 39
8 19
9 37
10 78
11 40
12 60
13 37
14 80
15 76
16 95
17 25
18 85
19 87
20 52
21 29
22 57
23 44
24 44
25 49
26 36
27 79
28 45
29 93
30 70
31 63
32 34
33 79
34 57
35 48
36 43
37 41
38 86
39 74
40 63
41 87
42 47
43 86
44 83
45 55
46 56
47 86
48 92
49 79
50 95
5...

result:

ok correct

Subtask #3:

score: 16
Accepted

Test #13:

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

input:

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

output:

0

result:

ok correct

Test #14:

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

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
0 2
2 4

result:

ok correct

Test #15:

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

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
0 79
0 23
2 20
3 42
4 56
5 32
6 17
7 23
8 71
9 36
10 46
11 56
12 20
13 87
14 34
15 79
16 74
17 75
18 91
19 52
20 75
21 50
22 50
23 95
25 29
26 89
27 29
28 29
29 36
30 86
31 64
32 39
33 57
34 44
35 45
36 84
37 41
38 58
39 52
40 90
41 63
42 95
43 69
44 74
45 84
46 77
47 83
48 65
49 67
50 52
51 68
5...

result:

ok correct

Test #16:

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

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
1 42
1 81
2 81
3 61
4 13
5 45
6 45
7 86
8 62
9 39
10 74
11 98
12 59
13 66
14 50
15 27
16 81
17 47
18 62
19 51
20 91
21 84
23 89
24 53
25 75
26 93
27 79
28 42
29 47
30 45
31 77
32 46
33 81
34 36
35 75
36 45
37 85
38 53
39 60
40 50
41 81
42 69
43 94
44 47
45 58
46 60
47 75
48 55
49 79
50 79
51 71
5...

result:

ok correct

Test #17:

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

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
1 83
2 68
3 72
4 44
5 75
6 62
7 81
8 23
9 28
10 96
11 28
12 38
13 26
14 53
15 34
16 21
17 48
18 89
19 87
20 84
21 98
22 74
23 86
24 33
25 51
26 78
27 82
28 36
29 85
30 48
31 55
32 93
33 84
34 57
35 85
36 51
37 63
38 44
39 77
40 43
41 79
42 50
43 50
44 64
45 65
46 65
47 89
48 86
49 98
50 54
51 77
...

result:

ok correct

Test #18:

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

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
2 3
0 0

result:

ok correct

Subtask #4:

score: 18
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #19:

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

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

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

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
118 426
279 225
301 263
347 214
407 110
133 251
168 221
196 250
8 139
9 247
191 158
11 130
93 247
114 139
405 58
201 342
87 173
154 427
325 261
72 169
260 47
303 342
22 1
2 122
161 147
271 383
6 7
297 153
382 364
41 328
18 97
296 226
165 207
37 442
56 230
392 285
218 237
54 212
322 398
251 119
3...

result:

ok correct

Test #22:

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

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
374 253
261 386
55 386
161 195
247 367
49 424
370 309
362 288
89 140
9 165
102 471
202 207
428 77
8 263
205 425
330 359
16 268
409 328
282 387
445 337
259 380
191 325
424 157
338 57
199 254
469 382
138 349
219 391
28 404
160 42
30 92
56 59
254 384
195 119
401 5
71 402
266 196
37 256
27 15
5 230
...

result:

ok correct

Test #23:

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

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
106 403
38 162
2 114
388 6
246 349
166 295
288 374
146 284
8 310
304 277
109 159
362 321
351 138
463 262
5 76
15 312
165 123
394 119
30 411
251 223
203 114
446 182
22 459
458 125
447 36
182 218
143 471
426 349
287 437
125 316
337 190
205 193
49 57
33 333
34 363
387 412
240 459
338 178
64 55
309 ...

result:

ok correct

Test #24:

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

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
0 31
412 321
438 213
3 404
4 181
5 209
213 437
7 2
8 355
9 458
10 146
11 477
368 221
13 111
14 320
15 291
23 248
17 103
240 316
19 125
20 363
21 189
22 436
145 392
141 379
120 122
30 299
27 345
28 335
403 197
26 69
31 171
32 470
33 366
34 419
232 428
360 459
37 211
209 249
202 221
40 308
41 187
...

result:

ok correct

Test #25:

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

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
2 465
228 198
4 235
12 438
14 392
470 471
19 239
20 283
21 240
23 165
71 258
27 32
263 282
30 24
32 158
33 37
34 110
35 476
38 319
40 363
42 342
43 89
45 435
46 113
50 70
195 95
54 148
55 417
303 406
58 265
61 330
65 446
102 325
67 117
68 25
70 317
74 305
52 320
76 122
444 480
80 288
315 169
86 ...

result:

ok correct

Test #26:

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

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
246 1
277 2
192 3
84 5
6 327
235 8
30 9
158 10
170 11
117 12
180 14
285 15
233 17
199 18
211 21
29 24
281 25
179 26
130 27
270 28
131 24
407 9
283 31
15 32
461 34
38 35
176 36
41 35
260 39
378 35
409 47
137 48
302 49
94 327
363 53
3 54
366 55
202 56
12 57
54 59
317 231
335 64
433 67
297 70
71 41...

result:

ok correct

Test #27:

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

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
361 0
95 1
26 2
76 328
318 4
66 5
307 6
73 7
337 8
306 9
87 10
315 11
16 96
340 13
368 14
25 15
60 96
345 17
61 18
365 19
75 20
203 21
331 22
238 23
428 24
377 15
449 2
107 27
187 132
17 29
323 30
113 31
327 32
335 33
31 34
42 35
81 435
92 37
39 38
226 38
396 40
241 41
57 35
89 43
293 44
462 45
...

result:

ok correct

Subtask #5:

score: 20
Accepted

Test #28:

score: 20
Accepted
time: 1ms
memory: 3772kb

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
0 688
1 1504
2 1217
3 39
4 753
5 320
6 1476
7 53
8 1026
9 477
10 1684
11 197
12 1693
13 1546
14 1661
221 277
16 361
17 1336
18 1040
19 1414
20 1149
21 1344
22 1014
23 1758
24 193
25 918
26 42
27 1314
29 1022
30 804
31 269
32 199
33 860
34 745
35 1554
36 955
37 681
38 1309
39 820
40 296
41 67
42...

result:

ok correct

Test #29:

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

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
0 1223
1 633
2 500
3 716
4 1770
5 19
6 1772
7 751
8 875
9 448
10 332
11 1886
12 619
13 1285
14 220
15 54
16 931
17 919
18 1830
19 1739
20 797
21 487
22 734
23 661
24 781
25 1903
26 546
27 1476
28 41
29 410
30 958
31 1670
32 1238
33 1160
34 173
35 1685
36 907
37 1662
38 866
39 910
40 243
41 253
...

result:

ok correct

Test #30:

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

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
1804 1354
1365 660
2 498
1339 308
930 1363
1828 1113
436 28
195 1347
1623 1839
1287 602
1357 931
1194 1713
1780 963
418 92
1071 673
1400 1437
459 1291
1559 1217
1842 1363
1562 230
129 772
21 941
1102 503
290 1413
362 649
25 1157
1564 1707
1066 877
431 1161
29 1007
306 1192
1607 452
891 523
1388...

result:

ok correct

Test #31:

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

input:

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

output:

0

result:

ok correct

Test #32:

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

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
540 5
1610 25
1604 27
1305 39
831 65
679 66
776 67
1991 68
121 69
1306 71
1381 81
101 90
1892 93
133 113
115 955
885 124
563 157
1479 169
1256 200
1739 201
1580 205
1896 206
1912 210
1583 213
214 1486
1057 230
460 237
271 245
248 1383
1006 250
1957 263
245 1156
66 295
1676 303
1867 305
949 309
1...

result:

ok correct

Test #33:

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

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
475 0
1156 1
355 5
1612 18
883 20
247 26
62 27
1504 34
855 39
554 43
1259 46
514 53
1017 54
389 56
870 59
1205 60
1638 27
178 63
250 65
961 66
563 68
633 72
804 75
1512 80
201 81
1921 82
756 85
1380 88
1172 89
1906 90
824 91
1455 93
596 96
215 97
1628 110
1459 99
1800 100
532 101
105 1362
1363 1...

result:

ok correct

Test #34:

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

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
1901 2
866 3
921 4
125 5
248 6
84 7
1303 8
1957 10
557 11
345 13
785 14
586 15
1013 16
54 19
355 20
897 22
204 23
1508 24
277 25
1903 26
677 27
475 28
1204 30
469 31
1310 32
1283 35
496 36
1077 37
380 39
1166 41
975 42
262 43
1701 44
1476 45
1449 46
377 47
1673 48
1770 49
1642 127
1373 1260
159...

result:

ok correct

Test #35:

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

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
245 1790
1347 1021
1475 1190
1722 204
4 1759
989 247
722 175
1747 541
1209 1531
986 755
688 1717
1592 1274
12 1088
900 383
14 231
654 67
1302 1670
959 111
1145 1463
1441 1899
632 1273
1269 184
477 53
1867 845
1335 369
888 523
438 1205
18 1083
79 138
522 784
777 614
1603 386
32 838
1871 1216
578...

result:

ok correct

Test #36:

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

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
722 1611
1898 652
1406 383
789 1915
1197 134
181 819
922 1589
1905 1919
8 840
227 316
1152 1884
104 1229
536 877
483 1588
677 1179
1719 1026
1039 436
17 717
18 137
794 1192
34 491
224 1369
45 1525
1419 1392
1833 1549
6 370
30 1730
1453 1452
1071 755
1491 1780
288 222
969 1029
32 1819
450 1045
1...

result:

ok correct

Test #37:

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

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
1202 1460
1806 1564
1687 1335
1900 765
1271 444
950 873
1443 1850
800 419
1689 1700
27 1533
1634 598
263 1111
131 1111
13 942
1602 856
15 663
16 601
896 1744
371 702
358 1601
200 1281
1768 89
1763 1050
1470 746
671 894
1824 294
469 1144
417 1730
724 809
1379 1650
1123 1297
1925 796
289 1682
192...

result:

ok correct

Test #38:

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

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
0 47
1 137
2 1603
3 852
4 1245
5 996
6 483
7 470
8 1631
9 862
970 1811
449 1371
12 61
13 1631
1763 1028
15 892
1745 1191
17 435
18 1268
19 309
953 435
21 1809
742 870
23 1491
159 1538
115 155
964 1878
1746 1152
1626 508
47 1228
31 577
32 840
232 1247
1903 1561
132 1349
36 1417
1672 855
1190 128...

result:

ok correct

Test #39:

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

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
1898 1
1286 2
723 3
114 6
504 7
1806 8
538 10
1857 11
1913 12
369 13
1275 15
1869 16
771 17
18 502
736 20
1418 21
169 23
588 24
1473 26
713 27
1532 28
1258 29
793 31
812 33
727 34
16 38
1814 40
976 44
1810 45
1858 46
289 47
1902 48
788 49
1373 55
210 56
1036 57
258 60
1442 61
1604 64
759 66
930...

result:

ok correct

Test #40:

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

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
59 0
863 1
2 511
68 3
423 4
307 1271
1433 6
700 7
1518 8
978 9
69 10
473 11
1280 12
171 13
349 14
1418 15
1919 16
135 17
1953 18
1510 19
1916 20
787 21
322 22
1661 23
1201 24
1331 25
983 26
1588 27
1473 28
1025 29
1885 30
1264 31
1580 32
497 33
203 34
784 35
1615 36
791 37
145 38
514 39
1939 40...

result:

ok correct

Test #41:

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

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
1471 1779
0 0

result:

ok correct

Subtask #6:

score: 26
Accepted

Dependency #5:

100%
Accepted

Test #42:

score: 26
Accepted
time: 40ms
memory: 13068kb

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
0 5823
1 126529
2 16148
3 137055
4 143649
5 42639
6 41860
7 150035
8 145964
9 171796
10 44381
11 168692
12 46804
13 100977
14 14484
15 90405
16 14695
17 20995
18 13623
19 131824
20 140836
21 42862
22 138045
23 105532
24 48959
25 81207
26 68576
27 118152
28 13164
29 31936
30 14609
31 115785
32...

result:

ok correct

Test #43:

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

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
0 124503
1 141199
2 82512
3 95044
4 59024
5 49263
6 159257
7 159890
8 107651
9 137731
10 23082
11 124969
12 165705
13 117544
14 139861
15 160384
16 174579
17 840
18 31820
19 175800
20 34000
21 58757
22 146338
23 140838
24 140254
25 172872
26 102762
27 152831
28 127279
29 49622
30 110222
31 60...

result:

ok correct

Test #44:

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

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
6338 128206
21318 27929
69996 71245
1772 118708
4 181845
60253 157999
127733 72368
92547 178086
8 168289
17468 168295
87405 166780
93950 177461
90982 161624
109580 70923
66122 27485
40272 24846
16 75367
103646 8971
55821 46725
30039 187566
99954 49635
135567 33732
94576 113667
98763 76464
477...

result:

ok correct

Test #45:

score: 0
Accepted
time: 29ms
memory: 10344kb

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: 57ms
memory: 12588kb

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
78364 2
178167 3
32977 4
161202 5
58329 7
174714 11
43328 12
136083 14
174261 15
170674 16
12217 20
50861 21
42256 22
132768 25
55923 27
182483 29
16279 31
151600 34
175161 36
87252 40
128173 42
77063 45
186120 46
43979 49
146585 52
159217 55
115982 56
80801 58
45521 60
31443 62
112574 66
9752...

result:

ok correct

Test #47:

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

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
43027 1
172194 3
86326 4
171623 5
115683 6
138308 7
55776 8
174772 9
77834 11
151392 14
41487 15
182753 17
23950 20
66739 22
103585 23
88461 25
11620 26
115642 28
50953 30
48200 31
55943 34
36591 35
65528 38
50255 40
73321 41
111504 42
80388 44
27011 45
23752 47
60176 48
99292 50
68057 52
130...

result:

ok correct

Test #48:

score: 0
Accepted
time: 61ms
memory: 14528kb

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
45437 0
82218 1
23204 2
12788 4
106408 5
3604 7
34034 8
163083 10
20361 13
7007 17
177229 21
101048 24
193036 25
81085 27
38885 28
189002 29
24244 30
110207 31
85171 32
143323 34
162904 35
96298 36
53416 37
25795 38
16688 41
91231 43
170895 44
19736 46
94604 47
137514 48
124223 50
13669 51
17...

result:

ok correct

Test #49:

score: 0
Accepted
time: 35ms
memory: 13908kb

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
0 109966
0 152840
2 118657
3 131726
4 84996
5 158142
6 145467
7 184260
8 4542
9 56577
10 157134
11 111088
12 185973
13 122429
14 129803
15 185543
16 30815
17 37605
18 4354
19 148871
20 80865
21 159813
22 69900
23 10225
24 115197
25 113705
26 158108
27 44346
28 119154
29 75224
30 106858
31 128...

result:

ok correct

Test #50:

score: 0
Accepted
time: 44ms
memory: 14100kb

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
0 145461
1 37053
2 93114
3 1303
4 130833
5 156548
6 65729
7 77032
8 96715
9 9972
10 68442
11 53868
12 30050
13 77901
14 73568
15 27920
16 181622
17 75946
18 188967
19 9796
20 23810
21 78604
22 61386
23 112758
24 106372
25 38509
26 47037
27 121655
28 79697
29 177433
30 159600
31 42759
32 19367...

result:

ok correct

Test #51:

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

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
0 49723
79957 45442
125107 168770
3 10796
112739 111371
76853 192452
87617 108953
7 16880
3941 116648
123612 57596
105048 55000
127569 129775
63802 42129
133604 100668
14 147380
15 83297
187115 178862
8452 192896
146652 19845
94295 208
46383 172060
14192 4508
40473 126336
113300 175417
33353 ...

result:

ok correct

Test #52:

score: 0
Accepted
time: 62ms
memory: 13760kb

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
63702 150103
19029 188956
2 146625
11008 125498
2257 3672
18566 62988
161053 77701
7 182327
16726 79711
74777 3603
87419 28796
53648 23849
20563 181980
28565 173130
98069 136541
121525 78995
22293 133025
116609 162222
122068 164630
14607 85336
70806 5033
169270 6987
85040 96224
6027 152113
15...

result:

ok correct

Test #53:

score: 0
Accepted
time: 52ms
memory: 14540kb

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
0 99339
6 70296
7 50715
183086 139359
9 39850
10 58168
12 108308
13 116940
15 11336
94525 29134
19 91229
20 148926
21 93284
96232 74315
24 191071
27 85969
30 184960
33 51942
36 86498
39 172801
34718 147156
42 57282
43 2666
44 10616
45 158
34879 10025
47 40793
48 127892
49 163561
50 12612
53 53...

result:

ok correct

Test #54:

score: 0
Accepted
time: 58ms
memory: 14320kb

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
1 56335
121696 178904
3 27717
182010 171206
5 102847
6 158951
7 190747
12 34624
14 14561
15 184862
17 64279
23 130052
96972 172478
30 49686
190553 16787
34 11198
37 58280
38 164962
70864 96976
44 155670
46 123646
48 2876
52 147217
54 133221
51811 147305
59 86143
61 38538
63 90470
64 69289
66 1...

result:

ok correct

Test #55:

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

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
0 190730
1 193700
2 188631
3 69262
4 170297
120852 194823
6 18337
7 30040
8 69802
9 184163
10 138956
11 7824
5673 11114
13 85190
14 188897
15 71665
16 187735
17 180798
18 122383
19 7168
20 101055
21 39643
22 82362
23 3551
24 99230
25 41926
26 50582
27 62542
28 16265
29 173589
30 47585
98830 1...

result:

ok correct

Test #56:

score: 0
Accepted
time: 57ms
memory: 13268kb

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
0 81100
1 66570
2 121427
3 175601
4 131814
5 80717
83295 79924
7 133380
90736 8
113766 118003
90855 84971
68040 52369
177581 104155
13 17112
23005 41512
15 37113
16 6890
169649 186652
18 187392
101334 178317
21375 42488
21 160907
22 128410
129343 13753
24 93053
25 122429
26 75137
27 58040
28 ...

result:

ok correct

Test #57:

score: 0
Accepted
time: 48ms
memory: 12072kb

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
1 7278
2 144655
3 44140
4 100294
5 77302
6 123723
8 104856
9 173242
11 67899
13 171145
15 47079
17 152021
19 5911
22 173932
24 62863
26 59669
27 47193
31 89688
32 184321
33 178761
35 26558
37 120349
38 3492
39 76839
43 16086
45 191702
47 87915
48 101863
49 13181
50 283
52 178223
55 69114
56 43...

result:

ok correct

Test #58:

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

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
0 84406
1 80027
2 110287
3 44746
4 131371
66828 146934
108015 42426
144421 65970
8 150332
128738 170783
76715 65657
11 1953
83562 162645
13 190993
23105 109274
15 124958
111068 51133
83699 84371
192882 52975
19 45289
20 169245
102270 91663
22 107556
23 94239
24 181471
25 104596
34860 71086
16...

result:

ok correct

Test #59:

score: 0
Accepted
time: 56ms
memory: 13844kb

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
0 3201
1 21903
2 156766
3 53767
4 80932
5 179027
6 118233
7 122907
8 154481
9 51239
10 13465
11 185863
12 133977
13 37915
14 91026
15 70283
16 52407
17 57631
18 85537
19 22942
20 127969
21 96356
22 175394
23 11948
24 83133
25 171048
26 142374
27 159488
28 137645
29 165577
30 95527
31 101962
3...

result:

ok correct

Test #60:

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

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
59438 175527
1 51518
18095 11294
153078 29470
4 56519
115576 12803
6 95082
7 31727
183329 159235
82631 150631
10 165564
14794 11149
139936 115788
143212 49321
49900 51106
85717 75021
16 146012
28318 98130
163175 80862
59347 80913
20 154348
10583 75451
59216 158972
176014 26208
13796 140805
14...

result:

ok correct

Test #61:

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

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
0 126017
1 174003
2 91592
3 147645
4 21682
5 149017
6 83648
7 29018
8 62390
9 131945
10 94419
11 90743
12 18088
13 179549
14 182880
15 155670
16 142543
17 168758
18 99278
19 116059
20 144764
21 44606
22 83352
23 18451
24 148577
25 61718
26 172960
27 100941
28 37300
29 117214
30 103730
31 4494...

result:

ok correct

Test #62:

score: 0
Accepted
time: 57ms
memory: 12268kb

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
159419 0
113849 2
30017 3
110186 4
42143 5
153864 6
73919 8
33187 10
62253 12
36950 14
19764 15
22058 16
128968 17
59706 19
62779 20
109543 22
46530 25
84995 26
180252 28
127561 29
48701 30
37351 31
105040 33
51781 34
57388 35
16200 37
13030 39
190055 40
167848 41
118181 43
162199 44
27025 46
...

result:

ok correct

Test #63:

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

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
152764 139084
0 0

result:

ok correct

Test #64:

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

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
112395 0
59503 1
159653 2
112515 3
55994 4
141218 5
82560 6
21802 7
66526 8
159062 9
88179 10
112285 11
75942 12
142014 13
136232 14
6258 15
55694 16
98626 17
197641 18
72167 19
169865 20
45418 21
176458 22
93747 23
15412 24
152931 25
43525 26
90426 27
15153 28
118140 29
74088 30
180499 31
16...

result:

ok correct

Test #65:

score: 0
Accepted
time: 59ms
memory: 15380kb

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
117979 0
170938 1
104863 2
137881 3
153588 4
102199 5
107338 6
182767 7
124358 8
148574 9
184416 10
93136 11
8681 12
62558 13
111238 14
162080 15
67360 16
142829 17
16635 18
104198 19
128838 20
181099 21
34404 22
102933 23
45417 24
168801 25
134590 26
182614 27
51707 28
1008 29
145795 30
1143...

result:

ok correct

Test #66:

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

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
162746 0
59119 1
142950 2
96114 3
190946 4
76681 5
168697 6
31690 7
61002 8
58796 9
93421 10
44340 11
162169 12
105151 13
70920 14
157331 15
93891 16
151341 17
127675 18
44588 19
2975 20
123841 21
181746 22
99528 23
62740 24
73400 25
185338 26
133896 27
146459 28
123314 29
52420 30
147398 31
...

result:

ok correct