QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#290504#2789. SortingMoRanSky100 ✓93ms20872kbC++232.0kb2023-12-25 05:03:052023-12-25 05:03:05

Judging History

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

  • [2023-12-25 05:03:05]
  • 评测
  • 测评结果:100
  • 用时:93ms
  • 内存:20872kb
  • [2023-12-25 05:03:05]
  • 提交

answer

#include "sorting.h"

// Skyqwq
#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

typedef long long LL;
typedef pair<int, int> PII;

template <typename T> void inline read(T &x) {
	x = 0; int f = 1; char s = getchar();
	while (s < '0' || s > '9') { if (s == '-') { f = -1; } s = getchar(); }
	while (s >= '0' && s <= '9') x = x * 10 + (s ^ 48), s = getchar();
	x *= f;
}

template <typename T> bool inline chkMin(T &x, T y) { return y < x ? x = y, 1 : 0; }
template <typename T> bool inline chkMax(T &x, T y) { return y > x ? x = y, 1 : 0; }

const int N = 2e5 + 5;

int n, a[N], m, x[N * 3], y[N * 3], b[N], pos[N], c[N];

bool vis[N];

vector<PII> z;

bool inline chk(int w) {
	for (int i = 0; i < n; i++) b[i] = a[i];
	for (int i = 0; i <= w; i++) swap(b[x[i]], b[y[i]]);
	for (int i = 0; i < n; i++) vis[i] = 0, c[b[i]] = i;
	int nd = n; z.clear();
	for (int i = 0; i < n; i++) {
		if (vis[i]) continue;
		int x = i;
		nd--;

		while (!vis[x]) {
			vis[x] = 1;
			if (!vis[c[x]]) z.pb(mp(x, c[x]));
			x = c[x];
		}
	}
	return nd <= w + 1;
}

void sw(int u, int v) {
	swap(pos[a[u]], pos[a[v]]);
	swap(a[u], a[v]);
}

int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
    n = N; m = M;
    bool ok = 1;
    for (int i = 0; i < n; i++) a[i] = S[i], ok &= a[i] == i;
    if (ok) return 0;
    for (int i = 0; i < m; i++) x[i] = X[i], y[i] = Y[i];
    int l = 0, r = m - 1;
	while (l < r) {
		int mid = (l + r) >> 1;
		if (chk(mid)) r = mid;
		else l = mid + 1;
	}
	chk(r);
	for (int i = 0; i < n; i++) pos[a[i]] = i;
//, cerr << b[i] << endl;
	for (int i = 0; i <= r; i++) {
		int u = x[i], v = y[i];
		sw(u, v);
		if (!z.size()) P[i] = Q[i] = 0;
		else {
			PII o = z.back(); z.pop_back();
			P[i] = pos[o.fi], Q[i] = pos[o.se];
			sw(P[i], Q[i]);
		}
	}
	//for (int i = 0; i < n; i++) cerr << a[i] << endl; 
		//assert(a[i] == i);
	return r + 1;
}

詳細信息

Subtask #1:

score: 8
Accepted

Test #1:

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

input:

1
0
1
0 0

output:

0

result:

ok correct

Test #2:

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

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

input:

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

output:

1
1 0

result:

ok correct

Test #4:

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

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

result:

ok correct

Test #5:

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

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

result:

ok correct

Test #6:

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

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

result:

ok correct

Test #7:

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

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

result:

ok correct

Subtask #2:

score: 12
Accepted

Test #8:

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

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

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

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
66 8
79 8
57 8
36 8
53 8
35 8
56 8
24 8
58 8
33 8
25 8
78 8
16 8
96 8
54 8
76 8
97 8
89 8
68 8
62 8
38 8
32 8
94 8
44 8
9 8
27 4
39 4
86 4
14 4
46 4
65 4
15 4
7 4
90 4
19 4
85 4
42 4
37 4
13 4
91 4
82 0
41 0
20 0
34 0
61 0
29 0
48 0
18 0
63 0
5 0
51 0
59 0
3 0
12 0
74 0
43 0
73 0
95 0
81 0
60 0
1...

result:

ok correct

Test #11:

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

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
84 53
80 12
28 12
59 12
78 12
89 12
58 12
40 12
45 12
15 12
79 12
47 12
18 6
66 6
98 4
64 4
94 4
17 4
31 4
14 1
54 1
11 1
23 1
83 1
32 1
68 1
33 1
5 1
74 1
86 1
21 1
36 1
34 1
70 1
52 1
77 1
43 1
48 1
87 1
16 1
90 1
44 1
29 1
62 1
96 1
91 1
76 1
92 1
57 1
24 1
39 1
27 1
71 1
75 1
20 1
81 1
73 1
8...

result:

ok correct

Test #12:

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

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
12 0
82 0
72 0
65 0
2 0
75 0
66 0
3 0
59 0
51 0
56 0
46 0
90 0
71 0
6 0
52 0
20 0
80 0
14 0
85 0
18 0
57 0
22 0
34 0
32 0
89 0
73 0
92 0
48 0
35 0
70 0
5 0
30 0
81 0
86 0
38 0
43 0
36 0
26 0
47 0
42 0
94 0
61 0
69 0
76 0
15 0
78 0
10 0
93 0
29 0
21 0
67 0
58 0
77 0
95 0
16 0
50 0
62 0
1 0
91 0
74...

result:

ok correct

Subtask #3:

score: 16
Accepted

Test #13:

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

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

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

result:

ok correct

Test #15:

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

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
12 2
56 2
4 2
11 2
80 2
75 2
17 2
6 2
20 2
7 0
42 1
3 0
95 1
23 0
15 0
66 1
91 0
18 1
64 0
31 1
61 0
67 1
49 0
78 1
85 0
89 1
26 0
69 1
43 0
57 1
33 0
94 1
72 0
87 1
13 0
71 1
8 0
81 1
92 0
82 1
74 0
16 1
44 0
34 1
14 0
63 1
41 0
37 1
86 0
30 1
60 0
62 1
77 0
46 1
10 0
58 1
38 0
68 1
51 0
93 1
83...

result:

ok correct

Test #16:

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

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 23
89 23
59 12
90 7
71 7
51 7
19 7
86 7
95 3
91 3
20 3
97 3
93 3
26 3
67 3
85 3
37 3
87 3
63 3
74 3
10 3
82 3
80 3
64 3
88 3
52 3
58 3
45 3
5 3
6 3
30 3
36 3
34 3
76 3
75 3
25 3
35 3
47 3
17 3
29 3
44 3
68 3
84 3
21 3
56 3
53 3
24 3
38 3
65 3
77 3
31 3
72 3
94 3
43 3
55 3
48 3
61 3
2 1
16 0
33...

result:

ok correct

Test #17:

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

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
52 1
81 0
7 1
75 0
5 1
87 0
19 1
56 0
72 1
3 0
91 1
90 0
61 1
53 0
14 1
62 0
6 1
65 0
45 1
46 0
63 1
37 0
66 1
96 0
10 1
64 0
44 1
4 0
38 1
12 0
95 1
73 0
82 1
27 0
68 1
2 0
59 1
88 0
54 1
50 0
42 1
43 0
40 1
92 0
89 1
18 0
47 1
57 0
34 1
15 0
79 1
41 0
84 1
20 0
33 1
24 0
78 1
26 0
13 1
71 0
55 ...

result:

ok correct

Test #18:

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

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
3 2
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: 3864kb

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

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

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
249 125
475 125
327 125
433 125
75 125
399 125
172 125
187 125
473 418
333 418
340 325
189 325
315 325
235 325
135 325
159 325
116 325
369 325
395 325
166 325
1 325
22 325
348 325
417 325
346 325
268 325
149 325
129 325
479 325
248 325
112 325
128 325
385 325
257 325
81 325
355 325
34 325
224 32...

result:

ok correct

Test #22:

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

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
139 219
293 219
171 219
214 219
185 219
457 219
391 219
215 205
477 205
248 205
371 205
260 205
153 205
431 205
321 205
449 205
163 205
450 205
346 205
477 205
104 205
146 205
228 205
54 205
267 205
209 205
436 205
319 205
302 205
40 205
210 205
148 205
403 205
265 205
217 205
148 205
83 205
118...

result:

ok correct

Test #23:

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

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
60 313
150 158
70 158
300 158
47 158
399 338
419 338
379 338
449 338
202 338
342 338
396 338
404 338
361 338
183 338
196 338
103 338
171 338
186 338
254 338
212 338
341 338
89 338
235 338
176 338
340 338
392 338
164 338
131 338
35 338
442 338
479 338
440 338
178 338
325 165
294 165
207 165
118 1...

result:

ok correct

Test #24:

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

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

result:

ok correct

Test #25:

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

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

result:

ok correct

Test #26:

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

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

result:

ok correct

Test #27:

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

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
257 475
217 153
413 153
348 153
420 153
412 153
83 153
285 361
136 361
121 361
219 361
282 361
137 361
444 361
77 361
152 361
273 361
264 361
316 361
156 361
313 361
167 361
388 361
314 361
35 361
42 361
57 361
329 361
274 361
127 361
146 361
199 361
337 361
408 361
141 361
111 361
357 361
233 3...

result:

ok correct

Subtask #5:

score: 20
Accepted

Test #28:

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

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
1723 1153
987 1153
1020 1153
369 1153
883 1153
537 1153
1535 1153
835 1153
391 1153
1130 1153
660 1153
1784 1153
734 1153
387 1153
1013 1153
1192 1153
310 1153
1716 1153
799 1153
1002 1153
266 1153
1596 1153
1493 1153
1019 1153
183 1153
975 1153
1447 1153
978 1153
1628 1153
1247 1153
991 1153
4...

result:

ok correct

Test #29:

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

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
1937 276
930 276
1274 276
1608 276
951 276
1141 276
743 276
522 276
685 276
1280 276
1620 276
1219 276
192 73
1209 64
464 64
1666 64
272 64
1653 64
791 64
1675 64
788 64
1939 64
556 64
1397 64
1080 4
466 4
1482 4
177 4
321 4
933 4
1318 4
1201 4
1101 4
1428 4
424 4
1776 4
405 4
1774 4
445 4
836 ...

result:

ok correct

Test #30:

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

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
1048 1116
5 1116
628 1116
1767 1116
739 1116
460 1116
1764 1116
1083 1116
487 1116
426 1116
1401 1116
953 1116
267 1116
1303 1116
1314 1116
170 1116
1154 1116
1139 1116
1186 1687
1808 1687
114 1687
588 1687
1614 1687
1567 1687
1377 1687
1460 1687
943 1687
900 1687
1012 68
863 68
610 68
190 68
1...

result:

ok correct

Test #31:

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

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

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

result:

ok correct

Test #33:

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

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

result:

ok correct

Test #34:

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

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

result:

ok correct

Test #35:

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

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
544 1871
1837 1871
739 1871
923 1871
917 1871
1216 1871
393 900
1558 900
1374 900
1142 900
587 900
724 900
1741 900
236 900
121 900
713 900
1187 900
1525 900
901 900
495 900
962 900
1513 900
716 900
244 900
400 900
693 900
1206 900
1482 900
1860 900
1079 900
873 900
1119 900
287 900
1406 900
15...

result:

ok correct

Test #36:

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

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
1458 289
1155 289
1217 289
1449 314
1739 314
122 314
1710 314
10 314
1100 314
1518 314
1275 314
151 314
1615 314
989 314
1624 314
1697 314
1640 314
402 314
1124 314
915 314
1024 314
1532 314
1401 314
647 314
650 314
1064 314
1749 314
466 314
1262 1541
1515 1541
908 1541
1388 1541
1750 1541
326 ...

result:

ok correct

Test #37:

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

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
1640 1116
1505 1116
586 1116
607 1116
1023 1116
1108 1116
613 275
1775 275
750 275
136 275
1444 275
1265 275
307 275
1596 275
659 275
1890 275
1887 275
1844 275
1933 275
1934 275
1535 1290
291 1290
423 1290
1929 1290
1425 1290
1703 1290
1012 1290
476 1290
102 1290
1506 1290
496 1290
1184 1290
5...

result:

ok correct

Test #38:

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

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

result:

ok correct

Test #39:

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

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

result:

ok correct

Test #40:

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

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
1322 723
1256 723
564 723
1813 59
1624 59
902 59
107 59
837 59
1669 59
12 59
1280 59
1006 59
1690 59
386 59
134 59
583 59
1261 59
1176 59
1908 59
183 59
866 59
596 59
229 59
1796 59
1565 59
447 507
59 507
352 507
153 507
1703 507
1818 507
398 507
1917 507
1882 507
939 507
1340 507
1170 507
1095...

result:

ok correct

Test #41:

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

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

result:

ok correct

Subtask #6:

score: 26
Accepted

Dependency #5:

100%
Accepted

Test #42:

score: 26
Accepted
time: 68ms
memory: 18428kb

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
102573 39598
89122 39598
126079 39598
159877 39598
56119 39598
97714 39598
134640 39598
71910 39598
77945 39598
104261 39598
60677 39598
55048 39598
48858 39598
90753 39598
68238 39598
121360 39598
20813 18875
86906 18875
154790 18875
94091 18875
167239 18875
19338 18875
57491 18875
83409 188...

result:

ok correct

Test #43:

score: 0
Accepted
time: 77ms
memory: 18580kb

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
47370 44129
101818 44129
146067 44129
176290 44129
47149 44129
139968 29572
67660 29572
62004 9496
91017 9496
157997 9496
115919 9496
82461 9496
177316 9455
24392 9455
146552 9455
67038 9455
117184 9455
84676 9455
95763 9455
33545 9455
12655 9455
76383 9455
31205 9455
105801 9455
142577 9455
...

result:

ok correct

Test #44:

score: 0
Accepted
time: 79ms
memory: 19328kb

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
138720 159896
169815 159896
63873 159896
57634 159896
103344 159896
31093 159896
6903 159896
118975 159896
168298 159896
101121 33837
4793 33837
180691 33837
63070 33837
65465 33837
186442 33837
66303 33837
102394 33837
1349 33837
72208 33837
178846 33837
110790 33837
153252 33837
34993 33837...

result:

ok correct

Test #45:

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

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: 86ms
memory: 18936kb

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
194769 195053
194248 194876
193043 194145
192558 193128
192461 194753
192420 193497
191215 191525
191062 193076
190586 192404
189570 195384
189330 191650
189303 191513
189154 190837
189003 190097
188786 195093
188314 194407
188154 190112
187741 192767
187720 193820
187608 189383
187215 193703
...

result:

ok correct

Test #47:

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

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

result:

ok correct

Test #48:

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

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

result:

ok correct

Test #49:

score: 0
Accepted
time: 72ms
memory: 20872kb

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
164781 78179
113516 78179
115614 78179
121697 78179
124318 78179
104966 47298
129893 47298
124089 47298
100238 26042
37693 26042
79568 26042
83593 26042
120266 26042
146073 26042
66327 26042
104599 26042
146660 18037
90446 18037
181579 18037
102381 18037
126997 18037
23866 18037
70271 18037
6...

result:

ok correct

Test #50:

score: 0
Accepted
time: 78ms
memory: 19832kb

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
128658 121350
126690 27187
153229 27187
41765 27187
115358 27187
43471 27187
47307 27187
96126 27187
49059 27187
181414 27187
75396 27187
118349 11220
58483 11220
61062 11220
84554 11220
51621 11220
128434 11220
132776 11220
94185 11220
171932 11220
45514 11220
121087 11220
111710 11220
16634...

result:

ok correct

Test #51:

score: 0
Accepted
time: 93ms
memory: 19360kb

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
94475 15056
47454 15056
82045 15056
35738 15056
155722 15056
24096 95472
69251 95472
121630 95472
145755 95472
179769 95472
19202 95472
44222 95472
39133 95472
178619 95472
151088 95472
124043 95472
84003 95472
165772 95472
187587 95472
116560 95472
42700 95472
187009 95472
149561 3719
143058...

result:

ok correct

Test #52:

score: 0
Accepted
time: 88ms
memory: 19336kb

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
28682 149198
106922 149198
117329 149198
137926 149198
106076 149198
82866 149198
190222 149198
21065 149198
108329 149198
176731 149198
18175 149198
153078 149198
151519 149198
166992 149198
55465 149198
178828 149198
173533 149198
107965 149198
74456 149198
14502 149198
37232 149198
144967 ...

result:

ok correct

Test #53:

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

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

result:

ok correct

Test #54:

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

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
195142 169178
167832 54008
43845 41132
62327 194088
126574 190700
192176 149356
132816 78975
169219 186106
50648 186045
169797 83721
161616 109611
187458 162170
187439 52979
120887 184359
189396 23759
186090 33702
138915 134784
101930 126622
101818 113340
190706 182683
159568 182097
182855 181...

result:

ok correct

Test #55:

score: 0
Accepted
time: 85ms
memory: 19136kb

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
191799 191140
192162 190598
188895 187286
189240 186636
187321 185595
194074 185426
188517 185235
193819 185125
189805 184171
189559 184171
188152 183446
185188 182991
184123 182834
185507 182451
190149 182062
186635 182017
190295 181633
192975 181408
184465 181408
188805 180989
181133 180440...

result:

ok correct

Test #56:

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

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
191263 189832
190354 189170
188395 188135
188161 187095
192125 186826
190721 186826
188383 186561
185557 185466
191187 184794
185950 184610
191262 184390
192455 184101
186269 184083
185762 183416
187474 183410
186005 183358
192859 183314
189117 182545
189294 182188
188962 182155
190127 181770...

result:

ok correct

Test #57:

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

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

result:

ok correct

Test #58:

score: 0
Accepted
time: 77ms
memory: 20800kb

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
196304 195455
194764 194735
194215 193737
193663 193601
194756 193396
196617 193177
196286 193088
194192 192993
194606 192924
196094 192855
194060 192802
192816 192771
195600 192422
192965 192253
196394 192177
196661 192168
194933 191884
192425 191753
194283 191655
194116 191625
196203 191471...

result:

ok correct

Test #59:

score: 0
Accepted
time: 88ms
memory: 19400kb

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
159418 16063
165518 16063
111000 16063
25578 16063
47643 16063
184079 16063
135336 16063
68315 16063
87742 16063
26470 16063
110891 16063
107129 5925
180895 5925
135345 5925
19460 5925
85033 5925
104648 2195
41986 2195
53964 2195
124785 2195
118095 2195
76869 2195
28154 2195
96583 2195
150678...

result:

ok correct

Test #60:

score: 0
Accepted
time: 85ms
memory: 19588kb

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
73119 40600
182673 7695
112684 7695
74952 7695
162942 7695
46317 7695
53278 7695
105101 35195
56431 9486
192503 9486
42781 9486
65772 9486
70637 9486
185173 9486
137176 9486
172815 9486
40162 9486
7818 9486
105479 9486
116549 9486
10812 9486
39673 9486
145841 9486
80460 9486
176582 9486
14439...

result:

ok correct

Test #61:

score: 0
Accepted
time: 86ms
memory: 19492kb

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
83169 1558
119100 1558
103460 1558
103449 1558
77787 1558
64253 1558
175552 1558
189918 1558
106140 1558
40397 1558
123568 1558
81162 1558
37960 1558
28473 1558
94231 1558
172991 1558
144550 1558
153029 1558
23163 1558
113589 1558
121604 1558
123075 1558
129138 1558
94389 1558
64666 1558
1619...

result:

ok correct

Test #62:

score: 0
Accepted
time: 86ms
memory: 18604kb

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

result:

ok correct

Test #63:

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

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

result:

ok correct

Test #64:

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

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
96742 148622
77106 112395
131593 112395
198207 112395
11975 112395
36824 112395
91202 112395
104627 112395
110565 112395
168736 112395
36713 112395
131592 112395
171328 112395
72621 112395
119521 112395
123217 112395
135224 112395
100300 112395
79986 112395
39504 112395
106460 112395
159952 1...

result:

ok correct

Test #65:

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

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
4736 116041
65969 116041
165860 116041
56506 116041
51970 116041
99690 116041
134498 116041
23485 116041
186552 116041
12143 116041
146678 116041
88993 116041
35251 116041
83053 116041
88030 116041
154345 116041
189090 116041
79270 116041
68513 116041
161876 116041
39490 116041
63512 116041
4...

result:

ok correct

Test #66:

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

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 19165
18119 19165
6132 72968
142820 72968
187849 72968
11553 72968
170029 72968
85400 72968
73274 72968
182336 72968
137290 72968
145093 72968
51170 72968
79846 72968
129627 72968
39424 72968
103424 72968
6833 72968
62840 72968
143822 72968
139214 72968
176553 72968
163924 72968
4873 72...

result:

ok correct