QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#341992#437. Fun TourAbdelmagedNour#100 ✓149ms24288kbC++201.4kb2024-03-01 02:12:352024-07-04 03:27:13

Judging History

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

  • [2024-07-04 03:27:13]
  • 评测
  • 测评结果:100
  • 用时:149ms
  • 内存:24288kb
  • [2024-03-01 02:12:35]
  • 提交

answer

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
#include "fun.h"
//#include "grader.cpp"

vector<int>createFunTour(int N,int Q){
	vector<int>dis(N),sz(N),g(N),ans,parts,f[3];
	int R=0;
	sz[0]=N;
	for(int i=1;i<N;i++){
		sz[i]=attractionsBehind(0,i);
		if(sz[i]>N/2&&sz[i]<sz[R])R=i;
	}
	for(int i=0;i<N;i++){
		dis[i]=hoursRequired(R,i);
		if(dis[i]==1)parts.push_back(i);
	}
	for(int i=0;i<N;i++){
		if(i==R)continue;
		while(g[i]+1<parts.size()&&hoursRequired(parts[g[i]],i)>dis[i])g[i]++;
		f[g[i]].push_back(i);
	}
	for(int i=0;i<3;i++){
		sort(f[i].begin(),f[i].end(),[&](int u,int v){return dis[u]<dis[v];});
	}
	int p[3]={0,1,2},lst=-1;
	while(1){
		sort(p,p+3,[&](int x,int y){return f[x].size()>f[y].size();});
		if(f[p[0]].size()<f[p[1]].size()+f[p[2]].size()){
			sort(p,p+3,[&](int x,int y){return dis[f[x].back()]>dis[f[y].back()];});
			int idx=(p[0]==lst);
			ans.push_back(f[p[idx]].back());
			f[p[idx]].pop_back();
			lst=p[idx];
		}else break;
	}
	f[p[1]].insert(f[p[1]].end(),f[p[2]].begin(),f[p[2]].end());
	sort(f[p[1]].begin(),f[p[1]].end(),[&](int u,int v){return dis[u]<dis[v];});
	int blst=(ans.size()>1?ans[ans.size()-2]:-1);
	lst=(ans.size()>1&&g[blst]!=p[0]&&dis[f[p[1]].back()]>dis[ans.back()]);
	for(;f[p[lst]].size();lst^=1){
		ans.push_back(f[p[lst]].back());
		f[p[lst]].pop_back();
	}
	ans.push_back(R);
	return ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Accepted

Test #1:

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

input:

2 400000
1 0

output:

1 0

result:

ok correct

Test #2:

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

input:

3 400000
1 0
2 0

output:

1 2 0

result:

ok correct

Subtask #2:

score: 0
Accepted

Test #3:

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

input:

4 400000
1 0
2 0
3 1

output:

3 2 1 0

result:

ok correct

Test #4:

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

input:

9 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3

output:

6 8 5 7 2 4 0 3 1

result:

ok correct

Test #5:

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

input:

14 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6

output:

10 13 9 12 8 11 7 6 4 5 3 2 1 0

result:

ok correct

Test #6:

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

input:

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

output:

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

result:

ok correct

Test #7:

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

input:

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

output:

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

result:

ok correct

Test #8:

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

input:

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

output:

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

result:

ok correct

Subtask #3:

score: 0
Accepted

Test #9:

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

input:

4 400000
1 0
2 1
3 2

output:

3 0 2 1

result:

ok correct

Test #10:

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

input:

12 400000
5 4
6 5
7 6
10 9
8 10
11 8
7 11
3 7
2 3
1 2
0 1

output:

0 9 1 10 4 8 5 2 11 3 6 7

result:

ok correct

Test #11:

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

input:

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

output:

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

result:

ok correct

Test #12:

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

input:

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

output:

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

result:

ok correct

Subtask #4:

score: 0
Accepted

Test #13:

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

input:

4 400000
0 1
0 2
0 3

output:

1 2 3 0

result:

ok correct

Test #14:

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

input:

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

output:

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

result:

ok correct

Test #15:

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

input:

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

output:

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

result:

ok correct

Test #16:

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

input:

14 400000
1 11
3 1
2 3
8 2
9 8
13 8
12 13
0 12
5 13
10 5
4 10
7 11
6 7

output:

6 4 7 10 11 0 1 12 3 5 9 13 2 8

result:

ok correct

Test #17:

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

input:

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

output:

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

result:

ok correct

Test #18:

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

input:

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

output:

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

result:

ok correct

Test #19:

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

input:

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

output:

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

result:

ok correct

Subtask #5:

score: 0
Accepted

Test #20:

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

input:

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

output:

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

result:

ok correct

Test #21:

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

input:

27 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12

output:

26 18 25 22 24 21 23 17 14 16 13 20 12 19 11 15 6 8 5 10 2 9 7 0 3 4 1

result:

ok correct

Test #22:

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

input:

31 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14

output:

22 30 21 29 20 28 19 27 18 26 17 25 16 24 15 23 10 14 9 13 8 12 7 11 4 6 3 5 1 2 0

result:

ok correct

Test #23:

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

input:

500 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 26
...

output:

413 285 414 349 415 348 416 284 417 283 418 347 419 346 420 282 421 281 422 345 423 344 424 280 425 279 441 343 427 342 428 278 429 277 430 341 431 340 432 276 433 275 434 339 435 338 436 274 437 273 438 337 439 336 440 272 426 271 383 335 384 350 385 286 386 269 387 333 388 332 389 268 390 267 391 ...

result:

ok correct

Test #24:

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

input:

33 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15

output:

30 32 29 31 28 22 27 21 26 20 25 19 24 18 23 17 14 16 13 15 12 10 11 9 6 8 5 7 2 4 0 3 1

result:

ok correct

Test #25:

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

input:

119 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 26
...

output:

95 63 96 79 97 80 98 64 99 65 100 81 101 82 102 66 103 67 104 83 105 84 106 68 117 69 116 85 115 86 114 70 113 71 112 87 111 88 110 72 109 73 108 89 118 90 107 74 54 75 47 91 48 92 49 76 50 77 51 93 52 94 53 78 55 31 56 39 57 40 58 32 60 33 61 41 62 42 59 34 23 36 24 44 25 45 26 37 28 38 29 46 30 43...

result:

ok correct

Test #26:

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

input:

174 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 26
...

output:

95 127 96 128 97 129 98 130 99 131 100 132 101 133 102 134 103 135 104 136 105 137 106 138 107 139 108 140 109 141 110 142 125 157 124 156 123 159 122 160 121 155 120 154 119 161 118 162 117 153 116 152 115 163 114 164 113 151 112 150 126 165 111 166 149 167 148 168 147 169 146 170 145 171 144 172 1...

result:

ok correct

Subtask #6:

score: 0
Accepted

Test #27:

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

input:

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

output:

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

result:

ok correct

Test #28:

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

input:

500 400000
8 7
9 8
9 10
11 9
13 12
13 14
15 13
15 16
11 15
17 11
20 19
20 21
18 20
22 18
24 23
24 25
26 24
28 27
26 28
22 26
17 22
29 17
30 31
32 30
33 34
32 33
35 32
37 36
38 39
37 38
35 37
40 35
29 40
41 29
42 41
43 42
45 44
45 46
47 45
49 48
49 50
47 49
51 47
53 52
53 54
55 53
57 56
57 58
55 57
5...

output:

499 393 498 397 0 399 497 402 496 405 156 407 154 409 152 411 74 413 77 415 148 441 79 419 146 421 144 423 81 425 142 427 140 429 72 431 70 433 158 435 160 437 68 439 162 417 66 340 164 342 166 344 64 346 62 348 170 350 172 352 83 354 106 356 108 358 110 360 102 305 112 245 100 391 114 364 116 269 1...

result:

ok correct

Test #29:

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

input:

59 400000
1 0
2 1
3 2
4 3
5 4
6 5
7 6
8 7
9 8
10 9
11 10
12 11
13 12
14 13
15 14
16 15
17 16
18 17
19 18
20 19
21 20
22 21
23 22
24 23
25 24
26 25
27 26
28 27
29 28
30 29
31 30
32 31
33 32
34 33
35 34
36 35
37 36
38 37
39 38
40 39
41 40
42 41
43 42
44 43
45 44
46 45
47 46
48 47
49 48
50 49
51 50
52 ...

output:

0 58 1 57 2 56 3 55 4 54 5 53 6 52 7 51 8 50 9 49 10 48 11 47 12 46 13 45 14 44 15 43 16 42 17 41 18 40 19 39 20 38 21 37 22 36 23 35 24 34 25 33 26 32 27 31 28 30 29

result:

ok correct

Test #30:

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

input:

204 400000
13 12
13 14
15 13
16 17
15 16
18 15
20 19
20 21
22 20
23 24
22 23
18 22
11 18
25 11
26 25
27 26
28 27
10 28
9 10
8 9
7 8
29 7
32 31
30 32
29 30
33 29
6 33
34 6
35 34
5 35
36 5
4 36
37 4
48 47
48 49
50 48
51 50
53 52
54 53
56 55
54 56
51 54
57 51
59 58
59 60
61 59
63 62
61 63
64 61
66 65
6...

output:

24 116 21 114 12 112 14 147 17 149 19 120 23 110 13 151 16 156 20 122 22 108 15 158 18 160 11 106 25 126 26 162 27 164 65 104 67 101 47 166 62 168 60 131 58 91 55 170 70 173 49 99 52 93 28 176 59 179 10 134 63 97 66 191 69 193 53 136 48 129 56 189 68 145 54 138 31 95 61 183 9 195 50 140 51 187 64 18...

result:

ok correct

Test #31:

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

input:

273 400000
15 14
15 16
17 15
19 18
19 20
17 19
21 17
23 22
23 24
25 23
21 25
26 21
28 27
28 29
30 28
32 31
32 33
30 32
34 30
36 35
36 37
38 36
40 39
40 41
38 40
34 38
26 34
13 26
42 13
43 42
12 43
11 12
10 11
44 10
9 44
45 9
46 47
45 46
8 45
48 8
50 51
49 50
52 49
48 52
7 48
6 7
53 6
58 59
60 58
61 ...

output:

246 132 244 130 242 128 240 126 235 122 233 77 231 119 229 117 227 115 225 79 223 113 248 111 217 134 215 109 213 107 209 105 207 103 205 83 202 101 200 99 198 96 195 85 192 94 221 92 258 87 262 81 256 146 254 144 190 150 188 142 252 152 260 140 250 148 184 59 222 138 261 72 218 136 191 62 214 124 2...

result:

ok correct

Test #32:

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

input:

136 400000
19 18
19 20
17 19
16 17
15 16
14 15
21 14
22 21
13 22
23 13
12 23
24 12
11 24
10 11
9 10
8 9
7 8
6 7
25 6
26 25
5 26
4 5
27 4
28 27
29 28
40 39
40 41
42 40
44 43
44 45
42 44
46 42
47 48
49 47
51 50
51 52
49 51
46 49
53 46
55 54
56 55
57 56
58 59
60 58
62 61
62 63
60 62
57 60
53 57
64 53
6...

output:

20 79 18 81 19 83 17 85 16 87 15 89 14 91 21 94 22 96 13 98 23 100 12 105 24 54 11 39 10 107 9 109 8 59 7 52 6 112 25 120 0 61 26 63 5 125 1 114 135 50 4 65 2 102 27 118 28 67 3 69 29 123 134 45 30 71 31 43 133 74 132 41 131 48 32 121 130 93 129 97 33 117 128 86 34 101 47 78 55 124 51 104 44 115 40 ...

result:

ok correct

Subtask #7:

score: 0
Accepted

Test #33:

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

input:

500 400000
33 414
398 33
254 398
400 254
376 400
302 376
466 302
362 466
301 362
267 301
417 267
413 417
14 413
305 14
353 305
83 353
227 83
57 227
446 57
406 446
154 406
336 154
195 336
405 195
264 405
76 264
203 76
459 203
178 459
72 178
296 72
488 296
404 488
60 404
156 60
393 156
108 393
216 108...

output:

414 212 33 88 398 124 254 399 400 190 376 10 302 366 466 234 362 432 301 28 267 188 417 237 413 64 14 268 305 39 353 349 83 345 227 125 57 70 446 276 406 420 154 369 336 48 195 211 405 482 264 8 76 22 203 487 459 9 178 230 72 339 296 95 488 340 404 50 60 102 156 174 393 47 108 461 216 424 106 181 31...

result:

ok correct

Test #34:

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

input:

500 400000
243 472
21 472
171 243
31 243
419 21
366 21
474 171
246 171
363 31
201 31
317 419
458 419
59 366
7 366
417 474
394 474
351 246
191 246
431 363
202 363
397 201
81 201
28 317
237 317
71 458
221 458
239 59
429 59
0 7
60 7
418 417
18 417
240 394
341 394
440 351
485 351
373 191
487 191
261 431...

output:

242 249 238 146 236 280 234 252 231 254 222 288 220 138 219 260 218 273 325 293 206 298 205 285 200 286 199 303 186 304 176 291 172 359 165 115 158 311 207 307 324 310 320 134 314 316 312 332 309 334 306 132 302 331 300 338 295 340 251 130 281 129 279 347 278 348 274 116 272 305 264 357 262 296 257 ...

result:

ok correct

Test #35:

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

input:

500 400000
207 176
385 207
343 385
196 343
261 196
50 261
481 343
295 176
148 207
34 176
144 34
72 481
24 295
351 24
84 351
329 84
25 84
134 25
286 134
11 329
321 11
121 286
428 121
475 121
170 475
362 428
412 24
234 351
123 234
299 234
405 196
64 405
297 72
13 297
472 13
332 72
65 332
218 362
46 14...

output:

444 45 48 377 139 26 472 195 13 289 65 356 241 273 50 125 365 330 206 450 332 473 64 477 297 175 415 395 72 456 405 340 261 406 221 191 284 53 196 308 224 374 146 358 132 344 49 73 426 457 481 167 102 165 202 266 47 333 259 372 239 408 46 78 343 222 105 249 385 265 68 489 148 306 420 411 144 379 52 ...

result:

ok correct

Test #36:

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

input:

113 400000
78 45
67 45
40 67
25 40
54 67
3 54
44 54
70 3
15 25
37 15
11 15
27 11
102 37
110 102
97 110
41 97
31 41
9 11
24 9
87 24
46 24
84 46
109 46
95 27
49 97
101 49
71 49
94 41
29 25
55 29
99 55
22 55
17 99
33 17
75 33
60 33
32 70
63 32
88 63
39 32
51 39
36 88
57 51
19 57
65 19
50 65
26 51
43 26...

output:

10 62 106 58 30 81 6 104 0 68 61 92 2 91 80 28 1 38 42 69 56 23 76 83 59 79 96 7 4 21 82 50 66 108 111 86 14 73 77 65 64 72 48 100 16 19 8 52 98 43 103 57 47 26 18 36 105 51 112 88 93 63 85 39 5 60 89 75 107 32 90 33 20 70 34 44 74 78 12 17 13 3 35 109 53 84 71 45 31 54 101 99 94 87 41 46 49 22 97 5...

result:

ok correct

Test #37:

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

input:

479 400000
217 361
375 361
370 217
138 217
393 138
297 138
263 297
119 263
202 119
247 202
376 247
285 376
101 285
236 101
351 285
409 351
197 409
11 236
97 11
122 409
189 122
391 189
232 391
88 391
160 197
272 160
313 272
335 313
14 97
193 88
410 193
116 193
348 11
341 348
281 335
198 281
455 410
4...

output:

388 306 67 468 149 415 73 37 93 439 363 252 109 170 372 469 378 68 65 460 276 222 242 162 102 84 259 124 133 324 29 179 441 362 151 307 176 167 258 209 142 22 371 403 296 432 268 381 99 16 412 464 472 79 126 434 39 54 233 31 111 128 274 369 256 42 141 419 205 360 303 219 13 315 235 422 156 200 41 25...

result:

ok correct

Test #38:

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

input:

269 400000
75 180
56 180
78 180
231 75
127 231
244 127
16 244
113 16
178 113
85 16
20 85
74 20
249 74
134 249
248 249
96 134
109 74
17 109
164 96
32 109
265 32
253 265
120 265
82 120
4 253
28 4
150 28
53 120
165 53
137 53
31 137
206 31
123 206
102 123
168 17
33 168
174 253
162 174
243 174
193 243
10...

output:

130 102 77 123 214 56 222 78 5 206 230 180 241 150 1 193 8 75 242 31 10 137 71 162 197 165 52 231 118 28 34 243 156 178 49 174 194 82 218 127 73 53 105 4 11 253 181 33 57 113 263 120 224 244 233 16 175 265 51 168 185 17 151 85 39 32 255 109 84 20 264 248 92 74 259 249 63 134 114 177 112 96 187 21 13...

result:

ok correct

Test #39:

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

input:

347 400000
305 85
97 305
161 97
125 161
200 125
317 200
140 317
211 140
88 161
174 88
256 174
135 256
148 135
272 148
116 272
269 116
228 272
131 228
141 131
327 135
232 327
43 232
191 43
313 191
80 313
150 80
214 150
23 214
126 80
215 126
10 215
156 10
1 156
79 10
284 79
114 284
316 156
335 316
119...

output:

165 211 55 140 268 317 90 85 328 200 281 305 221 97 234 141 189 125 242 269 245 131 11 161 206 88 9 116 183 228 219 272 46 174 177 148 170 256 322 135 338 327 134 232 20 43 262 23 107 122 168 273 308 191 28 214 323 169 199 222 182 150 62 313 236 187 61 334 84 80 146 152 288 114 343 17 159 171 180 28...

result:

ok correct

Test #40:

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

input:

189 400000
101 23
8 101
123 8
24 123
134 123
119 134
2 134
105 2
161 105
72 161
126 72
53 126
9 53
138 9
188 53
98 188
136 98
78 136
69 98
4 78
66 4
145 66
91 66
132 91
49 188
17 49
87 138
154 87
184 91
131 184
108 131
3 108
56 184
183 108
62 183
173 62
0 173
185 173
110 185
164 110
83 164
135 62
46...

output:

128 23 47 92 68 125 150 179 35 101 107 155 159 169 143 41 1 102 25 8 176 186 44 24 76 123 80 119 11 71 153 45 156 165 93 51 158 139 77 79 64 166 75 95 106 97 141 168 19 99 160 171 172 58 149 134 146 112 157 181 57 142 42 12 163 147 109 177 115 2 40 48 117 29 152 20 74 154 170 27 61 100 103 182 7 43 ...

result:

ok correct

Subtask #8:

score: 0
Accepted

Test #41:

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

input:

501 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 26
...

output:

413 285 414 349 415 348 416 284 417 283 418 347 419 346 420 282 421 281 422 345 423 344 424 280 425 279 441 343 427 342 428 278 429 277 430 341 431 340 432 276 433 275 434 339 435 338 436 274 437 273 438 337 439 336 440 272 426 271 383 335 384 350 385 286 386 269 387 333 388 332 389 268 390 267 391 ...

result:

ok correct

Test #42:

score: 0
Accepted
time: 31ms
memory: 12312kb

input:

58961 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 2...

output:

52425 35487 52424 43679 52423 43680 52422 35488 52421 35489 52420 43681 52419 43682 52418 35490 54055 35491 52416 43683 52415 43684 52414 35492 52413 35493 52412 43685 52411 43686 52410 35494 52409 35495 52408 43687 52417 43688 52444 35496 52443 35497 52442 43689 52441 43690 52440 35498 52439 35499 ...

result:

ok correct

Test #43:

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

input:

511 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 26
...

output:

287 494 288 509 289 508 290 507 291 506 292 505 293 504 294 503 295 502 296 501 297 500 298 499 299 498 300 497 301 496 318 479 303 478 304 493 305 492 306 491 307 490 308 489 309 488 310 487 311 486 312 485 313 484 314 483 315 482 316 481 317 480 302 495 255 462 256 463 257 464 258 465 259 466 260 ...

result:

ok correct

Test #44:

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

input:

100000 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 ...

output:

98861 71005 98862 87389 98863 87388 98864 71004 98865 71003 98866 87387 98867 87386 98868 71002 98869 71001 98870 87385 98871 87384 98872 71000 99151 70999 98874 87383 98875 87382 98876 70998 98877 70997 98878 87381 98879 87380 98880 70996 98881 70995 98882 87379 98883 87378 98884 70994 98885 70993 ...

result:

ok correct

Test #45:

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

input:

887 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 26
...

output:

797 543 798 671 799 672 800 544 801 545 802 673 803 674 804 546 805 547 806 675 807 676 808 548 809 549 810 677 826 678 812 550 813 551 814 679 815 680 816 552 817 553 818 681 819 682 820 554 821 555 822 683 823 684 824 556 825 557 811 685 767 702 768 574 769 559 770 687 771 688 772 560 773 561 774 ...

result:

ok correct

Test #46:

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

input:

2027 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 26...

output:

1689 1117 1690 1373 1691 1372 1692 1116 1693 1115 1694 1371 1695 1370 1696 1114 1697 1113 1698 1369 1699 1368 1700 1112 1701 1111 1702 1367 1780 1366 1704 1110 1705 1109 1706 1365 1707 1364 1708 1108 1709 1107 1710 1363 1711 1362 1712 1106 1713 1105 1714 1361 1715 1360 1716 1104 1717 1103 1703 1359 ...

result:

ok correct

Test #47:

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

input:

3070 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 26...

output:

1695 2207 1696 2208 1697 2719 1698 2720 1699 2209 1700 2210 1701 2721 1702 2722 1703 2211 1704 2212 1705 2723 1706 2724 1707 2213 1708 2214 1709 2725 1790 2726 1711 2215 1712 2216 1713 2727 1714 2728 1715 2217 1716 2218 1717 2729 1718 2730 1719 2219 1720 2220 1721 2731 1722 2732 1723 2221 1724 2302 ...

result:

ok correct

Test #48:

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

input:

6956 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 26...

output:

6421 4445 6420 5469 6419 5468 6418 4444 6417 4443 6416 5467 6415 5466 6414 4442 6413 4441 6412 5465 6411 5464 6549 4440 6409 4439 6408 5463 6407 5462 6406 4438 6405 4437 6404 5461 6403 5460 6402 4436 6401 4435 6400 5459 6399 5458 6398 4434 6410 4433 6446 5457 6445 5456 6444 4432 6443 4431 6442 5455 ...

result:

ok correct

Test #49:

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

input:

13690 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 2...

output:

12748 8863 12749 10911 12750 10912 12751 8864 12752 8865 12753 10913 12754 10914 12755 8866 12756 8867 12988 10915 12758 10916 12759 8868 12760 8869 12761 10917 12762 10918 12763 8870 12764 8871 12765 10919 12766 10920 12767 8872 12757 8873 12726 10921 12727 10922 12728 8874 12729 8875 12730 10923 1...

result:

ok correct

Test #50:

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

input:

18091 400000
1 0
2 0
3 1
4 1
5 2
6 2
7 3
8 3
9 4
10 4
11 5
12 5
13 6
14 6
15 7
16 7
17 8
18 8
19 9
20 9
21 10
22 10
23 11
24 11
25 12
26 12
27 13
28 13
29 14
30 14
31 15
32 15
33 16
34 16
35 17
36 17
37 18
38 18
39 19
40 19
41 20
42 20
43 21
44 21
45 22
46 22
47 23
48 23
49 24
50 24
51 25
52 25
53 2...

output:

13661 16944 13660 16945 13659 16946 13658 16947 13657 16948 13656 16949 13655 16950 13654 16951 13653 16952 13652 16953 13651 16954 13650 16955 13649 17236 13648 16957 13647 16958 14334 16959 13645 16960 13644 16961 13643 16962 13642 16963 13641 16964 13640 16965 13639 16966 13638 16967 13637 16968 ...

result:

ok correct

Subtask #9:

score: 0
Accepted

Test #51:

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

input:

1000 400000
6 5
7 8
6 7
9 6
11 10
11 12
13 11
14 15
13 14
9 13
16 9
18 17
18 19
20 18
22 21
22 23
20 22
24 20
26 25
26 27
28 26
30 29
30 31
28 30
24 28
16 24
32 16
33 32
35 34
35 36
37 35
39 38
39 40
37 39
41 37
43 42
43 44
45 43
47 46
47 48
45 47
41 45
49 41
50 51
52 50
54 53
54 55
52 54
56 52
58 5...

output:

139 684 141 682 323 680 321 510 143 678 319 676 145 526 147 674 149 672 151 559 312 502 153 668 114 666 155 664 307 512 305 662 158 660 303 561 160 658 301 656 299 654 162 652 297 670 164 722 166 550 310 504 116 717 357 715 118 552 355 713 353 711 121 506 351 709 349 707 123 686 347 703 125 554 345 ...

result:

ok correct

Test #52:

score: 0
Accepted
time: 6ms
memory: 4668kb

input:

10000 400000
7 6
7 8
9 7
11 10
11 12
9 11
13 9
15 14
15 16
17 15
19 18
19 20
17 19
13 17
21 13
23 22
23 24
25 23
27 26
27 28
25 27
29 25
30 31
32 30
34 33
34 35
32 34
29 32
21 29
36 21
38 37
38 39
40 38
42 41
42 43
40 42
44 40
46 45
46 47
48 46
50 49
50 51
48 50
44 48
52 44
54 53
54 55
56 54
58 57
5...

output:

9708 5301 9453 5299 9710 5297 9712 5295 9451 5293 9714 5291 9449 5289 9237 5287 9235 5285 9719 6183 9447 5281 9799 5279 9443 5277 9441 5275 9726 5273 9439 5271 9728 5269 9437 5267 9730 5265 9732 5283 9435 5342 9734 5340 9433 5338 9736 5336 9445 5334 9678 5332 9473 5330 9680 5328 9682 5326 9471 5303 ...

result:

ok correct

Test #53:

score: 0
Accepted
time: 63ms
memory: 18776kb

input:

100000 400000
10 9
10 11
12 10
14 13
14 15
12 14
16 12
18 17
18 19
20 18
22 21
22 23
20 22
16 20
24 16
26 25
26 27
28 26
30 29
30 31
28 30
32 28
34 33
34 35
36 34
38 37
38 39
36 38
32 36
24 32
40 24
42 41
42 43
44 42
46 45
46 47
44 46
48 44
50 49
50 51
52 50
54 53
54 55
52 54
48 52
56 48
58 57
58 59...

output:

82546 25221 90617 37035 90614 37037 90612 25219 90610 37039 90608 25217 90606 37041 90604 22861 82548 25215 82550 37045 94150 25213 90597 37047 90595 37049 90593 25211 90591 37051 90589 25209 90587 37043 90585 25235 82552 37015 90582 25233 90580 37017 90599 37019 90661 25231 90659 37021 90657 37033 ...

result:

ok correct

Test #54:

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

input:

98793 400000
7 6
7 8
9 7
11 10
11 12
9 11
13 9
15 14
15 16
17 15
19 18
19 20
17 19
13 17
21 13
23 22
23 24
25 23
27 26
27 28
25 27
29 25
31 30
31 32
33 31
35 34
35 36
33 35
29 33
21 29
37 21
39 38
39 40
41 39
43 42
43 44
41 43
45 41
47 46
47 48
49 47
51 50
51 52
49 51
45 49
53 45
55 54
55 56
57 55
5...

output:

82049 12424 67726 12426 82051 12428 82053 12430 67724 12432 82055 12434 57359 12436 82057 18512 67722 12440 82059 12442 86795 12444 55392 12446 82063 12448 67720 12450 82065 12452 67718 12454 82067 12438 82069 12388 67716 12390 82071 12392 82073 12394 67714 12396 82061 12398 82023 12400 67740 12402 ...

result:

ok correct

Test #55:

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

input:

24452 400000
9 8
9 10
11 9
13 12
13 14
11 13
15 11
17 16
17 18
19 17
21 20
21 22
19 21
15 19
23 15
25 24
25 26
27 25
29 28
29 30
27 29
31 27
33 32
33 34
35 33
37 36
37 38
35 37
31 35
23 31
39 23
41 40
41 42
43 41
45 44
45 46
43 45
47 43
49 48
49 50
51 49
53 52
53 54
51 53
47 51
55 47
57 56
57 58
59 ...

output:

24451 9751 17955 6870 17959 9749 17961 6872 17963 9747 17965 9745 17967 6874 17969 9743 17971 6876 17973 9741 17975 9739 17977 6878 17979 9737 17981 6880 17983 9735 17985 10578 17987 6882 17989 9731 17991 6884 17993 9729 17995 9727 17997 6886 17999 9725 18001 6888 18003 9723 18005 9721 18007 6890 18...

result:

ok correct

Test #56:

score: 0
Accepted
time: 31ms
memory: 10100kb

input:

46432 400000
6 5
6 7
8 6
10 9
10 11
8 10
12 8
14 13
14 15
16 14
18 17
16 18
12 16
19 12
21 20
21 22
23 21
25 24
25 26
23 25
27 23
29 28
29 30
31 29
33 32
33 34
31 33
27 31
19 27
35 19
37 36
37 38
39 37
41 40
41 42
39 41
43 39
45 44
45 46
47 45
49 48
49 50
47 49
43 47
51 43
53 52
53 54
55 53
57 56
57...

output:

41012 4129 32983 10011 41014 10013 41016 4127 32981 10015 41018 4125 36902 10017 41020 10019 41022 4123 36900 10021 41024 4121 32979 10023 41026 10025 34207 4119 42524 10027 36898 2919 41030 10047 41032 4105 32977 10045 41034 4107 36896 10043 41036 10041 34209 4109 41038 4117 36894 4111 41040 10037 ...

result:

ok correct

Test #57:

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

input:

77532 400000
8 7
8 9
10 8
12 11
12 13
10 12
14 10
16 15
16 17
18 16
20 19
20 21
18 20
14 18
22 14
24 23
24 25
26 24
28 27
28 29
26 28
30 26
32 31
32 33
34 32
36 35
36 37
34 36
30 34
22 30
38 22
40 39
40 41
42 40
44 43
44 45
42 44
46 42
48 47
48 49
50 48
52 51
52 53
50 52
46 50
54 46
56 55
56 57
58 5...

output:

23095 50829 10630 50831 23097 50833 23099 50835 10628 50837 23101 50839 10626 50841 23103 50843 669 50845 23105 57987 23107 50849 10624 50851 23109 50853 10622 50855 23111 50857 23113 50859 10620 50861 23115 50863 930 50865 932 50847 23073 50789 23075 50791 10644 50793 23077 50795 10642 50797 23079 ...

result:

ok correct

Test #58:

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

input:

4093 400000
12 11
12 13
14 12
16 15
14 16
17 14
18 19
20 18
22 21
22 23
20 22
17 20
24 17
26 25
26 27
28 26
30 29
30 31
28 30
32 28
34 33
34 35
36 34
38 37
38 39
36 38
32 36
24 32
40 24
42 41
42 43
44 42
44 45
46 44
47 48
49 47
51 50
51 52
49 51
46 49
53 46
55 54
55 56
57 55
59 58
59 60
57 59
61 57
...

output:

3600 2660 3833 1905 3598 2658 3835 1907 3837 2656 3596 2654 3839 1909 3594 2652 3841 1911 3843 2650 3915 2648 3590 1913 3846 2646 3848 1915 3588 1761 3850 2642 3586 1917 3852 2640 3854 1919 3584 2638 3856 2636 3592 1921 3805 2634 3618 1923 3807 2632 3809 1925 3616 2629 3811 1927 3614 2626 3814 1929 ...

result:

ok correct

Subtask #10:

score: 0
Accepted

Test #59:

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

input:

99999 400000
11681 58292
11681 63929
49752 11681
30596 74400
30596 39261
49752 30596
19390 49752
89694 31923
19390 89694
54297 19390
42389 12902
42389 60328
72803 42389
69881 43761
69881 95741
72803 69881
96271 72803
63872 20658
63872 93588
35833 63872
48418 44153
35833 48418
96271 35833
54297 96271...

output:

62996 87115 26009 87113 62998 3726 26002 87217 26001 87247 63008 87245 25999 87243 63016 87237 63017 87234 25997 87233 25996 16065 73666 3688 63031 87226 63033 87223 63036 87222 25989 3693 63040 3727 25986 87215 25985 87214 63062 87211 63064 87210 63065 87209 63066 87230 25968 87154 63030 87187 2606...

result:

ok correct

Test #60:

score: 0
Accepted
time: 137ms
memory: 24288kb

input:

99999 400000
22911 42906
55177 22911
45848 55177
42077 45848
72422 42077
18572 72422
32391 18572
50776 32391
37509 50776
1803 37509
22729 1803
59931 22729
86437 59931
75596 86437
97533 75596
84264 97533
79370 84264
73290 79370
17059 73290
60073 17059
604 60073
89686 604
45405 89686
1176 45405
25995 ...

output:

51189 47838 98765 35392 10953 24097 74641 86378 63142 64069 12491 63565 15883 41516 29984 81204 96124 24446 7825 57155 44605 38765 8178 83778 12111 80741 8868 38750 62058 9034 10292 55306 29953 74995 631 8781 42499 42162 60664 33045 90314 4539 70754 8531 74033 30489 4047 69102 3482 44685 54859 52236...

result:

ok correct

Test #61:

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

input:

100000 400000
35357 73932
35357 71898
53297 35357
20900 39284
20900 36611
53297 20900
24574 53297
3496 19078
3496 63896
60776 3496
51617 31031
51617 73962
60776 51617
24574 60776
41273 24574
2824 85006
2824 22935
88300 2824
21588 95516
21588 81144
88300 21588
1650 88300
68562 25267
68562 31658
62356...

output:

62518 45245 62523 45424 26066 45422 62530 45242 62531 45241 26065 45411 26064 45386 62534 45238 62536 45234 26062 45385 26060 45368 26051 45197 73219 45191 26050 45361 62549 45351 26048 45185 62556 45170 26045 45330 62564 45310 62565 45164 26043 45146 26039 45299 26030 45298 62582 45143 62583 45137 ...

result:

ok correct

Test #62:

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

input:

100000 400000
49749 56050
49749 40208
54907 49749
38195 98216
38195 14892
54907 38195
56213 54907
53116 48113
53116 80410
17137 53116
23663 52076
23663 81699
17137 23663
56213 17137
26079 56213
91162 31575
91162 87334
39593 91162
1938 59342
1938 19586
39593 1938
77110 39593
53644 54722
53644 51522
7...

output:

56161 44971 7628 44925 61213 44918 34331 44961 64120 44960 69214 44908 3621 44900 15524 44959 33060 44950 44985 44892 79185 44890 51845 44940 1092 44939 75372 44879 81319 44872 49149 44926 91382 44919 14464 44867 66598 44860 53774 44906 60636 44899 21308 44854 24991 44844 50593 44893 84728 44880 554...

result:

ok correct

Test #63:

score: 0
Accepted
time: 117ms
memory: 21960kb

input:

100000 400000
9655 96550
75626 9655
54376 75626
11841 54376
73169 11841
41885 73169
84310 41885
12127 84310
19301 12127
70458 38257
5041 70458
84680 5041
50387 84680
73867 50387
11702 73867
89735 11702
29414 89735
75189 29414
41008 75189
39369 41008
43391 39369
6443 43391
4723 6443
24708 4723
48499 ...

output:

38257 45195 70458 45200 5041 45208 84680 45209 50387 45210 73867 45211 11702 45224 89735 45225 29414 45231 75189 45242 41008 45253 39369 45257 43391 45258 6443 45261 4723 67807 24708 45264 48499 45269 58708 45272 90323 45284 40282 45285 90401 45286 63104 45287 87927 45290 29496 45292 4641 45298 8220...

result:

ok correct

Test #64:

score: 0
Accepted
time: 105ms
memory: 22628kb

input:

100000 400000
85640 47421
88305 85640
5714 88305
12158 5714
21045 12158
4595 21045
59201 4595
70325 59201
12459 70325
75946 12459
59593 75946
73653 59593
36224 73653
37034 36224
11349 37034
78127 11349
80935 78127
44355 80935
50188 44355
6163 50188
35432 6163
32717 35432
44709 32717
20567 44709
6362...

output:

83961 49511 37115 49513 6830 49516 20166 49521 22010 7055 65522 49535 34999 49540 73277 49545 44759 49546 4456 49551 50254 49554 58018 49557 51236 49559 3907 49560 99753 68394 7524 49566 61002 49573 56145 49588 93290 49591 96427 49593 8591 49601 28331 49602 2056 49612 2602 49621 26459 49623 64873 49...

result:

ok correct

Test #65:

score: 0
Accepted
time: 149ms
memory: 23736kb

input:

100000 400000
68192 59977
99869 68192
79880 99869
85798 79880
65433 85798
25657 65433
81982 25657
1785 81982
86793 1785
92930 86793
97721 92930
85396 97721
47062 85396
84379 47062
51598 84379
79308 51598
16011 79308
99639 16011
29146 99639
55098 29146
40431 55098
33646 40431
60840 33646
2163 60840
8...

output:

56018 14554 76072 42642 70976 24377 42693 3665 94200 9777 35394 38577 1509 32408 95319 7568 45951 17538 72212 31317 61530 38472 456 2720 50047 60256 63149 29748 90292 56901 59148 72348 25058 54445 43830 24436 59375 11885 70122 77140 24157 37972 78603 15456 66685 64040 18760 63832 88172 55317 90402 2...

result:

ok correct

Test #66:

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

input:

100000 400000
67858 63179
67858 60149
74375 67858
57708 13959
57708 45053
74375 57708
90549 74375
95708 88814
95708 47964
94504 95708
19427 84873
19427 5912
94504 19427
90549 94504
55452 90549
5889 92006
5889 26256
6130 5889
37782 41675
37782 80036
6130 37782
5068 6130
68617 81486
68617 39080
19381 ...

output:

44673 14999 44681 17471 44683 50853 44684 50859 44686 50819 44695 14993 44696 14992 44701 50889 44708 17485 44709 50892 44711 42311 44716 64284 44731 14974 44743 42306 67211 42304 44763 14967 44767 14966 44772 17490 44775 50779 44776 15015 44778 42381 44779 50741 44786 50745 44787 50747 44793 42307 ...

result:

ok correct

Test #67:

score: 0
Accepted
time: 105ms
memory: 23288kb

input:

100000 400000
38314 97507
38314 37025
91153 38314
8519 9825
8519 1911
91153 8519
35444 91153
97524 48140
97524 81881
2370 97524
6135 77571
6135 89643
2370 6135
35444 2370
40772 35444
21728 57143
21728 12712
80043 21728
95691 79282
80043 95691
93628 80043
3661 35183
72076 3661
7018 80806
7018 30247
7...

output:

53093 49166 92839 49168 42556 49175 17644 49181 6083 49190 71109 36106 61350 49197 78404 49201 4556 49209 75756 49210 27708 12292 21975 49162 41110 49217 9879 49225 29242 49237 97069 36040 84773 36034 84324 49250 44249 49253 39393 36015 84321 49262 68709 49263 51257 49213 56231 47874 12980 47875 384...

result:

ok correct

Test #68:

score: 0
Accepted
time: 87ms
memory: 22944kb

input:

100000 400000
67585 35704
28722 67585
10112 28722
88548 10112
54253 88548
73133 54253
42287 73133
13364 42287
98176 13364
13394 6776
48919 13394
90568 48919
89149 90568
89172 89149
49551 89172
11410 49551
65186 11410
80867 65186
36623 80867
94769 36623
20810 94769
81487 20810
324 81487
57414 324
347...

output:

6776 56119 13394 56109 48919 56103 90568 56080 89149 56057 89172 56056 49551 56052 11410 56269 65186 56310 80867 56307 36623 56301 94769 56300 20810 56293 81487 44122 324 56276 57414 56275 34734 56272 18030 56029 93824 56267 56085 56262 96075 56257 32774 56253 18750 56243 20004 56240 94295 56235 317...

result:

ok correct

Test #69:

score: 0
Accepted
time: 105ms
memory: 22440kb

input:

100000 400000
6549 88281
89934 6549
87980 89934
95330 87980
1402 95330
73144 1402
92562 73144
84778 92562
76427 84778
15252 76427
18967 15252
11354 18967
27410 11354
32717 27410
6426 32717
32969 6426
50931 32969
63720 50931
38918 63720
94868 38918
54886 94868
65899 54886
48760 65899
39800 48760
6935...

output:

25834 61196 62526 46126 25832 34735 62528 88559 62530 95731 62531 59705 62534 69112 62537 13909 25828 2015 62543 80875 25812 78237 25810 7080 73480 15079 62564 69603 62565 80753 62568 77794 25807 21446 25805 43799 25804 27197 25803 39038 25784 16233 62583 28621 25781 34881 25779 26861 25778 81321 25...

result:

ok correct

Test #70:

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

input:

99999 400000
64820 1287
64820 78874
37336 64820
28991 6921
28991 54104
37336 28991
70307 37336
31466 5785
31466 13812
6130 31466
32923 18164
32923 74699
6130 32923
70307 6130
91444 70307
10557 71191
10557 93985
90010 10557
32148 48707
32148 38708
90010 32148
41939 90010
6652 75287
6652 3338
57249 66...

output:

88498 22466 29773 22464 52507 22463 77030 22451 73669 22449 38402 22442 9989 22439 40252 22433 40844 22425 15280 22424 26098 5334 88227 22421 26204 22415 25344 22735 16774 22412 88905 22409 55549 22408 60803 22407 90607 22399 22860 22395 42692 22394 29217 22379 86929 22422 18850 22293 13592 22291 98...

result:

ok correct

Test #71:

score: 0
Accepted
time: 123ms
memory: 24072kb

input:

100000 400000
87219 78817
59973 87219
6646 59973
87634 6646
4195 87634
13042 4195
41084 13042
67419 41084
50801 67419
66524 50801
53601 66524
45176 53601
79636 45176
46213 79636
57540 46213
43569 57540
69993 43569
7376 69993
12653 7376
80716 12653
86447 80716
49859 86447
71777 49859
57476 71777
4582...

output:

23492 46752 10639 55507 61368 29384 42049 4284 32809 92804 56673 91658 34183 22801 5221 86011 59628 71651 22686 86795 50281 72004 84602 9324 5697 52231 74386 13344 11724 38066 77349 73736 88394 28770 34684 30732 17687 65913 22466 70090 54755 42559 39117 37897 2442 13172 95382 53530 20831 38508 87069...

result:

ok correct

Test #72:

score: 0
Accepted
time: 131ms
memory: 23816kb

input:

100000 400000
83816 93354
90376 83816
25951 90376
97866 25951
2405 97866
314 2405
87136 314
31787 87136
4403 31787
91307 4403
89212 91307
26424 89212
90029 26424
82476 90029
14718 82476
92034 14718
78383 92034
65609 78383
99677 65609
80426 99677
97137 80426
16030 97137
62662 16030
73376 62662
64740 ...

output:

93354 91135 83816 12105 90376 50464 25951 92435 97866 20360 2405 15970 314 57547 87136 94024 31787 1227 4403 60826 91307 64104 89212 33579 26424 31387 90029 36362 82476 52181 14718 5095 92034 49165 78383 49403 65609 24138 99677 54752 80426 35275 97137 20991 16030 74782 62662 99887 73376 46737 64740 ...

result:

ok correct

Test #73:

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

input:

100000 400000
60633 14524
82214 14524
15014 60633
19923 60633
93596 82214
97182 82214
15820 15014
82989 15014
31656 19923
47686 19923
64549 93596
57903 93596
45519 97182
52236 97182
38856 15820
35427 15820
33438 82989
80651 82989
60083 31656
3711 31656
52887 47686
47060 47686
27987 64549
11470 64549...

output:

51575 44372 43846 44696 74368 44698 43856 44374 43857 44383 7741 44707 65378 44716 72645 44384 21300 44393 58895 44717 51557 44718 34628 44394 51549 44400 29819 44720 58919 44724 74434 44402 12047 44403 11985 44743 29743 66805 58783 66852 3389 44412 43743 44749 74293 44753 94695 44421 74362 44426 34...

result:

ok correct

Test #74:

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

input:

100000 400000
74551 52369
74551 14890
35856 74551
59091 25828
59091 21752
35856 59091
42833 35856
58418 88195
58418 59724
84165 58418
84836 32235
84836 65208
84165 84836
42833 84165
25273 42833
59085 66192
59085 29510
22738 59085
50833 12181
50833 11186
22738 50833
7684 22738
61414 3921
61414 24391
...

output:

45234 44905 45235 44909 45238 44910 45239 44912 45247 44924 45249 44937 45251 44940 45254 44943 45264 44945 45271 67137 45278 44963 45280 44968 67467 44969 45289 44971 45292 44974 45297 44984 45298 44994 45300 44995 45301 44998 45304 44959 45306 44775 45315 44778 45317 44780 45318 44788 45322 44798 ...

result:

ok correct

Test #75:

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

input:

100000 400000
23044 15768
10690 15768
66326 10690
47284 66326
88135 47284
13985 47284
80266 13985
94610 80266
5729 94610
65260 5729
27252 65260
90818 27252
35922 27252
80958 35922
66596 80958
40810 66596
94354 90818
4426 94354
87504 4426
17274 40810
20951 17274
90916 4426
5294 90916
61205 5294
10843...

output:

66690 9540 43921 43268 7829 93511 52944 61950 87197 92274 68751 51834 77654 18124 2388 95359 48855 22326 70806 32991 6474 34221 9157 27436 86524 33151 17872 95648 99943 69449 5547 94300 53711 79336 69664 47124 3234 20104 11819 48080 72400 74602 11317 54303 67736 13000 5849 72502 58266 23475 61311 40...

result:

ok correct

Test #76:

score: 0
Accepted
time: 40ms
memory: 9888kb

input:

42061 400000
40244 13586
24355 40244
37859 24355
38455 37859
21534 38455
41695 21534
6535 21534
39223 6535
33203 39223
36353 39223
23829 36353
26752 23829
6680 37859
36142 41695
31851 38455
15428 31851
34029 15428
6592 6680
2856 6592
28423 2856
3559 28423
1682 28423
14567 1682
2083 3559
33115 2856
2...

output:

23110 2752 31941 29615 26634 1539 20953 37122 40713 19083 10174 21982 4520 9837 29687 34677 31892 39913 8529 17710 17786 23858 19408 13983 21398 21556 41653 14482 14116 15218 27494 32936 9711 19649 38961 22404 19197 26679 460 22969 22311 37130 22780 37684 12737 23015 33570 35826 5294 25874 34862 139...

result:

ok correct

Test #77:

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

input:

100000 400000
18068 38447
18068 16704
12886 18068
96192 62000
96192 30182
12886 96192
20218 12886
4651 87356
4651 14959
2329 4651
24202 95450
24202 69280
2329 24202
20218 2329
82250 20218
9698 39454
9698 24527
54658 9698
22361 41123
22361 75075
54658 22361
75859 54658
2465 3431
2465 80791
82434 2465...

output:

45159 11061 45162 11058 45178 55480 45179 55545 45181 55521 45182 55518 45186 55513 45187 55512 45188 55511 45191 55504 45192 55498 45194 55487 45205 55481 45208 55555 67335 44557 45211 55472 45213 55471 45215 55467 45220 55464 45226 55460 45227 55457 45228 55454 45231 55449 45232 55607 45233 55647 ...

result:

ok correct

Test #78:

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

input:

100000 400000
49637 81421
49637 87418
41787 49637
36937 80516
36937 4482
41787 36937
81831 41787
17718 32843
17718 3123
34635 17718
68816 68762
68816 45362
34635 68816
81831 34635
58571 81831
97862 38151
97862 58848
68087 97862
98892 18847
98892 42817
68087 98892
70157 68087
49009 58911
49009 5740
1...

output:

2418 28085 90426 20555 29985 20556 64098 20564 16852 20565 71905 28106 69286 28102 58873 28099 99334 28091 42730 28090 72342 20539 55346 28072 5395 28071 56862 28069 48770 13397 62214 20568 66039 28057 29245 20569 99523 28055 23005 28184 11901 28228 33634 28223 32983 28220 39753 28216 34880 20523 11...

result:

ok correct

Test #79:

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

input:

100000 400000
2718 29077
2718 66694
33954 2718
63692 17313
63692 55977
33954 63692
92365 33954
15804 50226
15804 34164
15693 15804
41697 91959
41697 26716
15693 41697
92365 15693
4605 92365
94959 20195
94959 26611
40261 94959
84759 64237
84759 16046
40261 84759
41265 40261
73532 55347
73532 66262
17...

output:

53514 8544 30293 87649 60440 87648 11440 8551 76449 8552 87812 87644 20840 87641 3890 87640 19986 87638 52825 8540 86906 35133 70958 8558 40425 87620 35397 8573 39198 87618 55385 87616 22716 8576 75206 8577 8266 8579 26371 87607 45370 8582 5572 87603 13102 8555 12742 86365 57207 9435 3262 86363 8336...

result:

ok correct

Test #80:

score: 0
Accepted
time: 94ms
memory: 19320kb

input:

99999 400000
26785 74388
26785 92533
54821 26785
82301 54821
35196 97901
35196 77127
50121 35196
82301 50121
91496 82301
83012 67595
47081 68432
83012 47081
13119 83012
9120 91371
9120 95312
84992 9120
20880 67102
84992 20880
13119 84992
91496 13119
48942 91496
31457 190
31457 97876
80767 31457
3153...

output:

45552 54714 45553 54722 45554 54723 45559 54744 45560 54753 45571 54758 45572 54760 45580 54778 45587 54789 45591 54797 45592 82778 45599 54812 45602 54818 45605 54823 67754 54692 45609 54839 45615 54848 45616 54853 45618 54892 45628 54895 45631 54900 45634 54913 45644 54802 45649 56238 45650 56242 ...

result:

ok correct

Test #81:

score: 0
Accepted
time: 123ms
memory: 21956kb

input:

99999 400000
73548 80634
73548 36217
5983 73548
20279 20643
20279 51170
5983 20279
86427 5983
40386 9234
40386 7815
55774 40386
4478 87265
4478 11861
55774 4478
86427 55774
58343 86427
64960 42247
64960 60439
54087 64960
60451 16071
60451 34163
54087 60451
68602 54087
60022 28944
60022 56619
39066 6...

output:

23300 47632 95178 47634 38128 37207 9117 37116 28474 37108 54147 37105 78591 47671 67273 47673 42563 47675 66261 47679 92336 26436 80803 47684 92492 37091 6374 37066 67681 37065 32700 47493 30172 47411 28005 37301 26162 47430 46176 47431 46631 47437 26744 37278 96865 47681 22149 47987 96927 36646 51...

result:

ok correct

Test #82:

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

input:

99999 400000
27083 34518
26907 27083
56011 26907
84232 56011
53004 84232
94462 53004
20753 94462
8923 20753
64585 8923
82723 34029
11457 82723
71040 11457
77504 71040
33858 77504
93550 33858
37588 93550
68071 37588
93068 68071
40821 93068
20440 40821
24231 20440
22353 24231
68281 22353
44162 68281
8...

output:

44329 34029 44340 82723 44351 11457 44358 71040 44364 77504 44367 33858 44369 93550 44371 37588 44373 68071 44384 93068 44385 40821 44386 20440 44387 24231 44389 22353 44393 68281 66962 44162 44408 89850 44411 72379 44412 96604 44420 3518 44426 19343 44429 77206 44434 43342 44447 98843 44448 81671 4...

result:

ok correct

Test #83:

score: 0
Accepted
time: 109ms
memory: 22612kb

input:

99999 400000
37837 21233
20293 37837
14486 20293
51392 14486
69837 51392
76731 69837
92598 76731
65622 92598
101 65622
61329 101
66377 61329
42365 66377
76059 42365
824 76059
90424 824
91057 90424
59145 91057
75763 59145
1246 75763
4173 1246
70545 4173
12021 70545
15636 12021
31267 15636
6881 31267
...

output:

44270 74028 44271 64429 44279 3673 44282 5746 44284 49143 44285 50062 44289 37024 44292 3952 44297 24160 44298 46513 44309 71574 44317 22615 44319 97416 44320 47857 67599 74221 44328 73489 44329 54461 44337 73312 44342 35064 44345 61422 44353 73367 44354 99603 44358 95728 44364 45656 44366 52213 443...

result:

ok correct

Subtask #11:

score: 10
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Subtask #12:

score: 16
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Subtask #13:

score: 21
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #8:

100%
Accepted

Subtask #14:

score: 19
Accepted

Dependency #1:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #9:

100%
Accepted

Subtask #15:

score: 34
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Dependency #8:

100%
Accepted

Dependency #9:

100%
Accepted

Dependency #10:

100%
Accepted

Dependency #11:

100%
Accepted

Dependency #12:

100%
Accepted

Dependency #13:

100%
Accepted

Dependency #14:

100%
Accepted

Extra Test:

score: 0
Extra Test Passed