QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#123180#6413. Classical Graph Theory Problemc20230537AC ✓751ms56724kbC++141.1kb2023-07-11 20:37:242023-07-11 20:37:26

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-11 20:37:26]
  • 评测
  • 测评结果:AC
  • 用时:751ms
  • 内存:56724kb
  • [2023-07-11 20:37:24]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define For(i,a,b) for(ll i=(a);i<=(b);++i)
#define Rep(i,a,b) for(ll i=(a);i>=(b);--i)
#define Yes printf("Yes\n")
#define No printf("No\n")
#define pb emplace_back
const ll N=1e6+10;
using namespace std;
mt19937 rd(time(0));

ll n,m;
vector<ll>e[N];
ll a[N],b[N];
ll vis[N];
ll t[N][2];
ll ans;

void f(ll x){
	ans-=!t[x][vis[x]^1];
	for(ll y:e[x])ans-=!t[y][vis[y]^1],--t[y][vis[x]];
	vis[x]^=1;
	ans+=!t[x][vis[x]^1];
	for(ll y:e[x])++t[y][vis[x]],ans+=!t[y][vis[y]^1];
}

void mian(){
	
	scanf("%lld%lld",&n,&m);
	a[0]=b[0]=0;
	For(i,1,m){
		ll x,y;
		scanf("%lld%lld",&x,&y);
		e[x].pb(y),e[y].pb(x);
	}
	For(i,1,n){
		if(i&1)b[++b[0]]=i,vis[i]=1;
		else a[++a[0]]=i,vis[i]=0;
	}
	For(x,1,n){
		for(ll y:e[x])++t[x][vis[y]];
		ans+=!t[x][vis[x]^1];
	}
	while(ans){
		ll x=rd()%a[0]+1,y=rd()%b[0]+1;
		ll tmp=ans;
		f(a[x]),f(b[y]);
		if(tmp<ans)f(a[x]),f(b[y]);
		else swap(a[x],b[y]);
	}
	For(i,1,a[0])printf("%lld ",a[i]);
	printf("\n");
	For(i,1,n)e[i].clear(),t[i][0]=t[i][1]=0;
	
}
int main(){
	int T=1;
	scanf("%d",&T);
	while(T--)mian();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 35044kb

input:

2
6 7
1 2
1 3
2 3
3 4
4 5
4 6
5 6
3 2
1 2
2 3

output:

2 4 6 
2 

result:

ok ok (2 test cases)

Test #2:

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

input:

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

output:

2 
16 23 10 22 13 2 24 15 9 6 4 20 29 28 
7 12 3 9 6 1 
11 7 3 8 10 12 
13 18 15 34 11 22 1 24 27 20 16 2 25 17 10 21 19 
1 17 14 8 12 5 15 2 9 
2 
2 4 
30 7 6 19 10 12 3 16 1 46 45 31 11 5 20 32 34 39 38 40 8 36 41 17 44 
7 4 27 8 11 33 23 16 18 20 22 24 26 28 12 32 34 36 
2 4 6 12 5 9 14 
18 13 19...

result:

ok ok (10000 test cases)

Test #3:

score: 0
Accepted
time: 141ms
memory: 34656kb

input:

1000
337 338
164 11
138 75
114 262
170 298
166 241
269 24
9 134
233 60
50 222
231 253
296 242
173 18
93 223
116 151
312 150
82 236
180 20
297 184
268 70
334 162
217 135
258 321
80 209
212 208
18 163
227 104
334 135
77 118
17 230
307 105
307 335
29 24
111 177
324 24
85 3
214 191
310 182
22 171
202 21...

output:

2 4 317 8 204 211 169 129 18 123 22 24 222 168 30 228 3 193 217 9 88 44 17 181 50 69 273 235 190 127 195 143 288 102 210 72 192 52 33 80 32 276 177 312 152 325 94 96 108 76 265 179 257 305 110 90 182 151 118 120 153 95 281 128 130 132 67 187 311 115 142 42 271 148 250 174 154 249 335 221 133 28 166 ...

result:

ok ok (1000 test cases)

Test #4:

score: 0
Accepted
time: 224ms
memory: 34372kb

input:

100
1038 1044
206 546
372 853
526 57
777 72
645 866
15 716
254 707
366 753
635 809
850 407
616 149
839 175
320 770
649 686
857 798
1027 40
988 566
315 500
187 615
100 523
867 708
51 381
858 9
177 55
310 54
355 215
78 26
740 570
523 797
828 693
930 981
208 185
663 957
298 523
235 496
622 174
285 247
...

output:

888 398 787 475 10 268 14 575 274 20 22 591 37 28 30 962 34 910 420 302 277 965 118 48 470 52 623 752 928 708 27 263 368 68 667 106 74 893 191 18 82 463 914 88 949 506 866 96 528 340 825 104 511 873 426 112 293 214 395 120 122 70 564 291 130 459 357 972 501 140 146 351 482 380 989 384 154 870 97 160...

result:

ok ok (100 test cases)

Test #5:

score: 0
Accepted
time: 517ms
memory: 43172kb

input:

10
1380 1393
960 647
1319 708
57 1128
751 148
1291 602
835 921
942 406
622 616
967 91
555 545
871 10
447 471
1140 306
149 121
587 165
1179 936
256 787
332 374
729 129
631 481
976 86
1128 1300
477 776
460 313
538 632
1210 275
355 470
1324 885
870 1325
389 979
468 532
41 416
1026 243
1153 152
948 323
...

output:

2 1239 1075 1111 10 1235 108 964 18 20 1267 656 26 28 549 892 25 406 864 40 811 659 46 48 50 1109 54 56 292 1155 609 157 481 329 989 1351 719 1047 78 913 1016 1078 296 1281 309 1103 94 1352 98 100 75 487 106 74 829 1163 114 116 320 197 1363 188 1143 441 130 573 243 939 138 474 1330 384 852 1194 845 ...

result:

ok ok (10 test cases)

Test #6:

score: 0
Accepted
time: 751ms
memory: 49020kb

input:

1
200000 201978
69113 28513
94227 164392
56849 195513
22579 149089
195084 193248
121765 162768
135432 101508
107443 89723
12337 87598
173450 107835
13160 161882
18965 179808
53739 23609
114567 23456
195251 178048
61586 87664
179364 25594
90158 169714
30104 161354
143346 4279
177208 87389
122480 1269...

output:

68573 9544 6 149601 96012 12 14 16 18 20 136355 104179 72200 78552 148137 143926 67298 13460 117553 40 160766 44 46 64261 27549 163183 54 112005 58 37616 126289 24567 185995 18927 107994 105099 195169 113153 130454 80 151440 178544 86 163375 51297 92 94 7052 4781 176619 102 106779 22135 133931 110 1...

result:

ok ok (1 test case)

Test #7:

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

input:

10000
41 44
18 29
38 6
7 4
34 27
40 37
12 40
18 38
11 18
30 39
2 21
10 34
33 2
8 12
30 23
6 2
12 21
15 7
17 1
36 15
31 36
15 21
38 31
1 11
4 30
16 33
19 32
21 30
32 35
1 3
27 9
1 34
11 5
26 25
22 5
34 24
23 32
28 2
20 33
13 15
31 21
38 41
26 3
13 14
14 33
11 11
3 1
9 11
6 3
8 1
7 2
4 3
10 2
9 2
5 4
...

output:

38 4 6 1 39 12 14 16 18 20 22 21 26 28 13 32 34 36 9 40 
2 4 6 8 5 
13 4 6 10 11 1 14 16 
7 4 19 29 24 12 14 16 1 2 18 13 26 28 10 9 34 
2 4 6 8 
2 4 
2 4 3 11 10 12 14 16 
4 5 6 1 
7 3 6 8 10 1 14 
2 4 1 5 
2 4 6 
2 4 3 7 
2 
1 4 6 
25 3 19 1 13 5 2 23 16 7 29 18 22 28 
23 4 14 8 10 12 18 19 5 13 1...

result:

ok ok (10000 test cases)

Test #8:

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

input:

10000
11 13
6 3
9 4
10 4
9 6
10 7
1 5
2 11
2 8
10 6
2 9
6 7
2 5
5 11
3 2
2 1
2 3
2 1
2 1
12 14
12 11
10 7
5 6
2 5
5 8
8 3
8 1
3 12
12 7
2 10
10 11
6 4
11 2
9 3
4 4
1 2
1 3
4 3
2 3
11 13
3 7
1 5
1 6
8 5
9 7
1 2
1 11
2 4
10 9
10 1
7 2
8 3
8 6
2 1
1 2
15 18
3 11
2 10
7 14
14 4
7 3
6 11
15 12
5 11
2 7
7...

output:

6 9 5 8 7 
2 
2 
2 1 6 3 11 7 
2 4 
2 10 6 11 8 
2 
7 14 6 8 12 2 15 
37 51 6 8 11 41 63 16 18 20 22 45 13 28 47 21 57 36 9 40 42 61 46 3 50 7 26 53 17 38 62 55 66 
6 4 5 8 1 13 
2 5 6 7 
29 4 39 3 20 32 22 15 18 1 7 24 26 6 30 31 25 17 5 
53 4 6 8 22 81 34 82 31 20 69 24 75 25 19 32 5 23 38 40 11 4...

result:

ok ok (10000 test cases)

Test #9:

score: 0
Accepted
time: 43ms
memory: 34332kb

input:

10000
10 14
4 9
5 10
1 10
7 6
8 6
9 6
8 3
8 7
4 6
5 3
10 4
10 2
4 8
1 9
6 8
1 2
5 2
5 1
3 4
5 3
6 5
2 3
3 1
3 3
2 1
3 2
3 1
18 26
18 3
10 11
2 4
17 4
8 12
14 15
1 12
13 12
15 7
13 15
14 2
17 5
1 13
11 16
9 3
13 9
6 12
11 14
3 4
3 11
7 11
8 2
8 4
15 6
12 10
12 18
24 35
18 4
22 10
1 21
22 6
23 7
6 14
...

output:

9 4 5 8 10 
2 4 6 
2 
13 4 6 17 10 18 3 16 15 
2 4 19 14 17 22 23 16 18 20 1 24 
2 64 7 8 10 56 14 16 18 20 61 65 46 28 17 32 34 5 38 40 42 44 59 48 50 52 54 33 58 60 62 49 51 
2 5 6 8 10 3 
29 4 6 2 10 5 14 16 18 27 22 1 26 28 20 32 
2 1 5 8 
2 4 6 8 10 12 
2 65 6 8 53 59 43 16 55 20 45 34 19 28 61...

result:

ok ok (10000 test cases)

Test #10:

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

input:

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

output:

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

result:

ok ok (10000 test cases)

Test #11:

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

input:

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

output:

2 11 6 8 10 1 14 16 18 20 3 24 
2 4 
21 4 6 9 10 12 14 16 18 20 22 24 26 28 30 
2 4 6 8 10 12 14 16 18 20 22 
3 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 43 42 44 
2 4 6 8 10 12 14 16 18 20 22 24 
25 4 6 8 35 19 14 16 23 20 22 24 1 2 7 32 34 36 38 40 
2 4 6 25 7 12 14 15 18 20 22 16 5 28 
2...

result:

ok ok (10000 test cases)

Test #12:

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

input:

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

output:

2 4 6 19 51 16 14 10 13 20 22 11 36 7 43 32 49 28 25 27 5 44 42 40 50 52 
7 4 6 8 10 35 49 16 23 2 22 24 53 59 44 32 34 36 19 40 42 33 46 48 27 15 9 56 58 
2 123 257 8 273 12 286 16 299 252 247 87 137 28 246 32 263 36 202 139 95 172 107 48 50 278 141 56 178 60 62 59 66 68 70 72 13 76 78 80 44 84 295...

result:

ok ok (1000 test cases)

Test #13:

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

input:

1000
137 178
124 131
53 109
99 21
107 122
79 28
80 88
126 9
16 1
29 55
126 54
13 39
135 16
63 56
123 121
27 74
81 95
34 38
49 85
127 135
87 106
91 68
57 124
122 113
87 1
52 104
135 93
132 12
98 83
85 26
66 76
41 82
108 90
88 59
29 15
75 58
36 14
116 65
83 64
21 105
132 13
7 70
97 127
92 112
126 55
1...

output:

2 4 123 8 129 85 78 16 18 99 22 95 9 137 30 32 43 15 54 122 42 133 91 72 39 61 114 56 118 60 132 64 134 20 70 112 31 76 3 80 82 84 119 38 90 92 7 12 98 1 89 81 106 5 110 115 79 46 53 103 128 124 58 105 77 10 52 131 
31 39 6 8 34 44 9 37 24 20 19 30 26 28 22 15 18 27 38 40 42 25 17 48 50 
2 4 1 8 37 ...

result:

ok ok (1000 test cases)

Test #14:

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

input:

1000
148 221
51 9
45 80
86 44
133 98
100 25
130 4
99 17
28 44
131 87
103 87
102 53
115 49
9 5
105 130
11 69
56 23
148 106
106 85
57 102
15 147
100 52
22 10
138 60
38 12
126 119
12 125
86 62
108 123
15 63
90 93
35 116
1 75
63 126
23 127
143 127
114 24
12 133
144 82
12 29
6 51
67 26
129 79
115 16
53 6...

output:

2 121 55 8 32 60 14 45 35 20 113 24 107 133 112 1 11 36 85 40 63 99 41 77 140 127 64 56 111 49 28 90 42 70 118 117 74 76 78 48 51 39 86 88 37 33 94 96 7 100 102 104 115 108 18 30 31 105 130 10 4 59 134 119 67 68 97 129 95 61 79 3 126 131 
2 3 6 19 43 33 14 16 18 35 22 24 26 28 30 32 34 36 23 40 31 4...

result:

ok ok (1000 test cases)

Test #15:

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

input:

1000
527 1061
464 254
106 364
251 82
282 81
152 454
399 114
527 289
430 519
202 320
177 302
398 55
358 181
495 240
86 426
113 171
201 262
82 336
403 77
266 21
176 132
14 97
139 137
479 397
153 403
156 308
105 28
109 272
294 170
336 508
439 105
259 101
429 441
118 200
189 56
297 184
457 385
248 334
4...

output:

2 4 6 61 10 237 115 16 279 306 22 442 26 128 82 411 130 291 38 73 42 281 46 48 50 436 497 244 335 60 62 131 435 337 70 72 74 52 35 80 517 206 263 304 467 287 94 399 249 369 102 27 201 430 110 112 5 116 389 475 107 309 1 13 147 8 503 136 513 140 142 144 146 148 474 373 47 409 158 160 182 30 166 168 3...

result:

ok ok (1000 test cases)

Test #16:

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

input:

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

output:

23 4 1 8 10 12 14 16 18 20 22 24 
10 73 6 87 86 75 66 61 20 49 33 24 26 113 30 32 59 99 69 53 42 44 46 101 50 52 54 90 106 107 62 15 82 68 25 72 85 76 78 55 51 4 27 1 18 83 94 122 102 100 7 104 37 108 110 112 114 111 123 120 36 124 29 
16 4 6 8 10 107 287 329 18 293 218 24 270 289 30 93 34 285 97 40...

result:

ok ok (1000 test cases)

Test #17:

score: 0
Accepted
time: 183ms
memory: 37872kb

input:

100
1400 1550
949 973
216 1089
101 284
568 543
878 648
1125 1117
1052 486
1260 1161
1397 54
1005 922
483 168
202 152
899 685
978 388
1223 1178
1109 239
932 415
105 28
596 251
357 865
842 224
887 1053
304 484
697 780
1164 193
411 798
1267 1395
40 166
21 1027
814 742
905 354
1332 1346
86 1274
726 73
4...

output:

796 79 1004 1189 10 12 622 303 18 176 537 24 912 105 47 903 447 701 791 215 145 473 62 1393 344 25 800 1239 1243 60 493 816 521 68 112 228 777 464 717 340 648 84 80 1325 90 573 569 987 854 1037 480 401 994 108 289 749 114 88 118 889 906 376 126 900 130 682 134 136 1397 437 452 930 1059 721 660 606 6...

result:

ok ok (100 test cases)

Test #18:

score: 0
Accepted
time: 130ms
memory: 38168kb

input:

100
15151 19865
9599 11515
2453 4807
12417 12980
8787 12984
2666 3990
7030 3605
13780 1990
6564 14035
12745 5300
9179 9047
1105 8795
13193 2009
2347 3783
4282 2640
8744 2083
12968 1734
111 1688
14899 11212
11013 15151
4326 6532
9261 10694
8013 10608
8980 9408
379 3570
5827 13496
273 14106
1090 12649...

output:

10923 3760 14691 5472 10 12 10533 2678 9618 20 1804 24 26 14404 9552 14156 34 1694 6158 63 13669 6805 46 48 13885 52 14873 56 4634 2043 10734 1073 66 7661 6793 72 74 11497 2881 8761 11162 13957 86 88 90 92 7279 13491 7882 14678 8106 3965 8225 3385 110 9121 8961 116 118 120 11369 2269 3659 7637 14997...

result:

ok ok (100 test cases)

Test #19:

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

input:

100
1387 2091
632 868
379 1372
1247 788
72 562
1014 374
677 436
478 1033
997 896
1016 925
291 450
458 392
91 65
380 135
318 757
471 281
390 874
752 953
401 688
978 284
1276 639
565 1356
368 1259
673 639
283 551
647 94
125 1097
1055 672
538 1183
998 813
391 27
1066 766
782 1323
1220 164
427 819
274 5...

output:

1319 1206 4 8 10 278 167 47 18 751 22 554 273 422 1280 1132 34 360 1237 40 784 423 46 48 95 1284 121 56 690 157 62 281 692 68 115 709 893 1190 78 1313 814 649 151 587 90 92 769 644 98 551 873 938 596 108 981 448 114 116 118 93 1255 1358 241 957 545 1285 1113 136 138 1094 142 144 146 1033 225 312 154...

result:

ok ok (100 test cases)

Test #20:

score: 0
Accepted
time: 91ms
memory: 34804kb

input:

100
515 1036
358 355
124 512
414 420
214 74
423 447
344 263
431 482
364 446
314 200
299 244
389 507
191 58
85 405
130 57
288 370
231 324
442 405
324 42
453 137
312 167
33 67
443 27
497 101
447 442
211 438
200 210
472 219
462 227
210 19
416 76
483 374
48 374
259 264
331 214
486 213
146 254
264 350
36...

output:

19 4 488 442 349 139 464 122 12 144 176 448 489 359 225 128 34 289 394 137 308 485 415 461 172 52 497 350 58 255 55 64 93 57 168 481 510 76 305 80 119 189 261 82 90 92 94 89 98 68 102 362 106 72 353 355 378 262 375 406 511 124 490 268 237 115 435 417 271 418 142 169 203 148 150 270 454 259 512 146 1...

result:

ok ok (100 test cases)

Test #21:

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

input:

100
985 2463
916 513
388 126
199 847
456 244
218 236
243 961
588 899
242 137
98 45
273 505
332 492
828 494
368 889
551 617
662 87
651 450
645 884
49 487
731 934
328 482
224 101
590 687
80 972
143 154
420 155
113 886
413 716
841 402
334 374
549 893
62 743
964 386
608 294
124 692
213 980
857 886
228 6...

output:

155 837 806 818 301 231 534 341 395 271 564 483 751 739 2 555 163 384 772 40 974 101 114 795 50 28 944 158 38 60 328 568 335 960 653 695 74 552 72 720 308 505 385 419 90 633 46 96 98 69 387 104 626 551 103 840 424 183 979 917 735 124 461 128 130 877 808 817 515 140 56 524 12 148 302 598 474 181 251 ...

result:

ok ok (100 test cases)

Test #22:

score: 0
Accepted
time: 420ms
memory: 38184kb

input:

10
6620 7333
1646 5207
3808 6296
3890 1170
841 4461
3269 5613
3427 743
4429 351
6077 6488
1639 2661
704 600
1959 6216
4631 689
62 659
1849 1253
2888 6071
823 3326
4491 1670
4620 1541
2403 1275
5905 998
6515 5675
5204 2518
2 6397
5388 5626
1712 3996
6069 3525
962 4452
5528 5749
5292 1334
4864 4469
21...

output:

3207 4 6 8 1859 2263 3388 2192 1984 6391 275 2247 1707 3906 5346 32 5965 5259 6396 2064 1921 2194 46 1585 1533 2112 4489 1594 58 60 62 4063 66 68 70 5452 2322 76 78 80 628 84 113 88 5432 535 3534 6231 1351 5525 102 5641 106 3883 778 976 4775 5586 118 120 6143 124 5299 2947 130 132 3359 98 138 140 14...

result:

ok ok (10 test cases)

Test #23:

score: 0
Accepted
time: 251ms
memory: 43192kb

input:

10
31631 41405
12464 26816
7161 23441
26603 26999
3101 17725
19057 12144
25877 18100
27212 15122
23942 15607
10953 6392
8135 30928
10824 21016
16740 16082
31166 11527
30093 3178
18953 11904
16873 18594
31034 21707
18284 11028
10289 6972
4229 16452
6726 8826
15758 31430
30272 23869
31004 31424
15626 ...

output:

2 1066 16691 30283 10331 12 8742 16 18 20 22 24 9381 30498 12768 2854 5452 23569 23553 15027 6834 44 1504 5550 7501 6539 20915 4123 13247 421 12772 64 22730 3374 19401 21097 74 13609 1723 10274 9226 2853 805 12603 30153 8683 20645 15346 17280 24959 26242 19719 19161 108 24120 6787 114 18949 118 1803...

result:

ok ok (10 test cases)

Test #24:

score: 0
Accepted
time: 207ms
memory: 38732kb

input:

10
28538 43099
13200 13914
26716 18327
28186 28518
1215 11877
11167 9447
24145 13428
13894 1222
12303 4558
7451 3511
24131 6746
3501 5306
13827 16899
19501 15623
18276 4006
16371 3015
3638 27140
3419 28191
649 11619
7330 19380
3215 17183
13519 12575
3643 1100
23996 5666
7650 3931
11863 18905
11099 2...

output:

1743 21020 4876 19398 17854 12 14 16 8903 27150 22 24 9875 17946 24035 32 2431 17803 21260 40 5834 28323 24259 25912 21733 10340 54 1660 5470 10219 8005 64 10418 68 2768 72 22175 14139 28339 80 23309 12901 21021 88 27747 5024 7553 3375 17133 20903 11953 12438 106 3202 19288 26870 20975 16609 21171 2...

result:

ok ok (10 test cases)

Test #25:

score: 0
Accepted
time: 217ms
memory: 43744kb

input:

10
87788 176493
85411 2449
75677 87148
41863 8856
26947 41851
69142 52475
19624 254
68187 45850
1914 1328
60252 34269
74977 29820
84340 25888
15811 3705
1188 51146
923 7500
4632 78262
79717 73522
51839 29805
50741 81652
34291 1102
47663 68963
8687 86118
17441 86354
11708 6564
87269 85939
81969 15769...

output:

20705 4 37782 8 13950 30135 56383 16606 30157 31905 42880 30548 26 78870 75380 70216 66735 52550 17695 32859 71667 44 18585 9837 50 70177 19431 16769 47818 71270 48103 37365 76109 61763 57937 1473 52102 59943 78 4280 24623 66325 62470 69343 40802 28894 8808 27937 67936 62856 4678 4309 599 108 79197 ...

result:

ok ok (10 test cases)

Test #26:

score: 0
Accepted
time: 162ms
memory: 39424kb

input:

10
8816 22043
7419 5025
5365 4666
3322 7417
5863 5973
2641 1448
6401 2157
1667 7379
6833 7402
5527 5022
2651 4669
4676 5212
3876 2581
5037 6774
2606 6661
5930 519
3836 8394
1159 3510
2789 2327
5496 4249
5240 4702
4006 7011
5102 1260
2708 1364
8618 888
3465 3208
5175 3282
5081 6716
5593 1814
2896 663...

output:

6986 4304 6 2557 6371 4183 14 3365 4067 4340 6908 24 4477 6021 2655 32 34 36 6097 3499 1071 8747 226 406 3606 52 2130 8562 1175 60 6737 1505 3743 3332 2966 72 41 76 2093 6025 3997 4629 4215 5534 90 92 7321 96 98 100 5139 6787 4455 6702 110 6861 114 236 932 6643 7452 5680 126 1453 2621 6106 7688 136 ...

result:

ok ok (10 test cases)

Test #27:

score: 0
Accepted
time: 535ms
memory: 49648kb

input:

1
200000 222059
53595 110970
173632 131224
18782 129709
79934 195396
42423 87939
191850 58500
75657 76504
130760 155268
40793 74463
110561 181427
166061 166730
169476 19173
54038 80930
98140 20017
131017 7357
135665 51329
20673 95904
15527 156410
147735 107963
185611 9516
181066 181938
6507 122388
3...

output:

28735 185871 141571 101025 123795 12 154907 16 93692 20 131219 24 26 28 170837 32 149152 36 38 40 168996 54251 46 48 50 38446 9324 152996 185893 102017 147724 64 62798 120924 52583 72 74 38715 51835 193591 56594 154740 121990 23769 90 120970 119671 24119 33755 71561 102 104 113280 53053 149525 67226...

result:

ok ok (1 test case)

Test #28:

score: 0
Accepted
time: 394ms
memory: 50736kb

input:

1
200000 262063
72841 66604
94581 51837
191542 123743
149876 10516
128822 123410
139111 103089
158541 56483
183570 157423
128256 118508
92821 129228
163748 28520
2448 160970
37107 90515
139799 163596
184374 16626
78012 98010
144666 155211
146459 60321
62391 172660
124463 39432
99102 80299
22916 1273...

output:

2 173973 6 8 9175 12 14 125317 18 103213 182156 24 169801 31965 30 175209 33290 38207 38 23401 42 188967 21004 159237 145055 41290 11222 105687 15915 63767 62 73419 66 25336 67111 17765 166964 148774 78 45854 169049 160551 9520 84266 90 92 94 177481 25045 117281 31785 135535 122984 35705 160102 1071...

result:

ok ok (1 test case)

Test #29:

score: 0
Accepted
time: 418ms
memory: 51600kb

input:

1
200000 301952
21951 38377
145264 141899
20286 189141
49248 10797
131312 186634
193391 7330
90758 178447
133654 28458
197098 132935
142271 123768
182413 51079
106749 37339
80111 160519
130329 80747
134297 17746
89135 104031
76611 66916
13891 148818
166668 148476
177606 78551
133202 121415
17109 114...

output:

61830 4 160811 138161 10 108677 14 16 187631 183713 179333 75493 94889 85213 137227 173115 57321 36 38 40 42 180724 30153 48 169594 23130 53609 68506 58 121783 62 7565 185282 61709 140940 98612 74 76 149529 173300 82 151131 171952 143492 139753 56496 50363 130794 108054 38585 97646 44604 164759 1565...

result:

ok ok (1 test case)

Test #30:

score: 0
Accepted
time: 281ms
memory: 54204kb

input:

1
200000 402105
169412 28307
39235 94949
120109 190352
59500 104359
75817 175560
50253 41771
83195 186648
20091 175725
106263 65825
156850 28786
72265 77440
104707 152961
108429 140785
176083 164531
173958 160585
89283 97448
72968 178690
182706 163213
64471 47768
59578 23108
25972 130392
101827 1729...

output:

52169 82731 67940 58669 10 198962 25733 35374 20889 141679 157037 14529 26 90706 117589 32 112598 129362 52827 74264 185899 33752 46 48 183265 123327 166932 134087 58 94087 155292 7565 175642 19187 164060 32619 168121 66862 157234 173300 107093 174790 63050 110050 78037 41792 70199 130794 107768 608...

result:

ok ok (1 test case)

Test #31:

score: 0
Accepted
time: 347ms
memory: 56724kb

input:

1
200000 499981
80537 142045
166196 27324
188484 59794
73011 62848
54982 32788
146891 120397
145977 112297
30732 34355
198025 193511
46734 37750
74321 75081
38173 123072
90782 51316
3345 153541
108762 97369
16828 137609
157439 191613
162866 51112
72589 170889
126524 133464
82570 115809
128563 112379...

output:

143313 182692 32815 159242 167372 94206 148939 105129 27805 189171 173981 123305 26 159644 61890 173165 181144 142957 38 194253 167887 112166 101214 45220 32195 19787 98940 93611 134403 68285 28447 181783 136874 65013 120218 183598 144141 157694 182144 28223 162735 84 65721 148367 924 48966 156092 4...

result:

ok ok (1 test case)

Test #32:

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

input:

10000
9 14
7 9
6 7
6 3
3 2
3 5
3 4
3 8
7 8
2 7
4 7
3 1
7 1
7 5
9 3
5 4
2 3
4 5
4 1
2 1
65 120
48 33
48 27
65 28
21 48
48 4
3 28
39 48
48 10
48 50
32 13
19 48
52 24
48 24
48 15
48 31
65 48
52 19
60 48
49 41
22 28
48 20
18 48
2 28
25 48
1 48
2 48
28 23
52 20
28 51
28 11
52 63
59 28
28 36
48 44
31 28
2...

output:

2 5 3 8 
2 4 
12 37 39 46 7 55 34 4 6 9 47 24 26 51 19 1 49 31 8 20 45 42 21 48 50 59 43 56 3 13 10 61 
2 4 6 8 10 12 27 16 19 20 22 24 26 28 17 32 25 
2 4 6 
3 4 1 8 10 12 
13 4 15 14 9 12 7 16 6 
9 4 6 15 10 12 14 16 18 20 22 7 
9 4 6 8 10 12 
2 7 1 4 10 
3 
2 4 6 8 10 12 14 
2 5 6 
5 4 13 8 10 12...

result:

ok ok (10000 test cases)

Test #33:

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

input:

1000
65 124
10 5
5 16
64 33
3 59
4 59
50 5
60 33
5 39
55 59
33 61
5 8
5 49
31 33
5 41
37 59
5 48
23 59
34 33
59 17
22 5
33 47
11 5
59 38
5 45
5 13
63 5
5 14
5 2
33 16
40 5
27 33
5 64
59 49
41 33
25 59
28 33
65 59
59 11
33 62
15 33
59 35
59 14
53 59
33 29
30 5
44 33
62 5
33 32
50 59
59 30
59 45
42 59...

output:

2 4 1 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 5 44 46 48 50 52 54 56 58 13 62 64 
223 38 34 125 207 12 14 140 18 31 248 29 26 28 30 168 247 36 49 40 99 44 129 287 50 71 54 21 1 35 145 169 66 109 97 72 59 274 78 195 82 84 86 88 32 92 239 259 98 100 93 149 106 108 181 112 114 116 118 5 122 1...

result:

ok ok (1000 test cases)

Test #34:

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

input:

100
2720 5430
15 549
864 1152
549 492
1152 2121
366 1608
2226 1574
2096 1152
951 1152
279 1278
1574 232
2537 1152
806 1278
1988 1152
1574 2203
1239 1278
414 549
434 549
549 2020
1608 1319
2464 1574
1232 1152
1608 728
1453 1152
992 1608
1608 1637
1242 1152
1190 1574
1278 1587
2105 1278
2577 549
1178 ...

output:

721 4 6 2077 677 426 1485 16 253 1827 1741 1400 1057 28 30 2152 586 36 2629 40 1711 44 1351 2362 50 52 54 667 1931 60 62 64 2626 68 70 72 2597 2406 78 503 82 84 86 88 2513 92 94 96 98 702 102 104 106 108 883 112 2441 116 118 923 122 1880 126 661 130 1311 134 136 138 1128 2316 144 2003 1935 1118 225 ...

result:

ok ok (100 test cases)

Test #35:

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

input:

10
11424 22838
10124 2930
2930 8210
6044 2930
9338 5243
2930 1990
8267 335
11369 2930
3640 2930
2930 8394
2930 4490
10225 5027
2930 7034
336 10225
6591 10225
2723 8267
3141 8267
9338 8308
8267 7647
2930 1471
9338 742
10225 2977
8267 4214
10232 6130
5050 6130
3536 9338
9338 810
8267 6841
8267 4313
59...

output:

2 4 6 5053 7297 12 10179 5429 18 20 22 4569 26 6625 30 7065 34 7949 306 40 9273 44 46 48 5197 52 54 56 10683 60 4177 64 8135 8370 70 72 1013 2013 1717 2727 5575 3949 5960 88 90 92 94 96 98 100 1397 3278 106 108 6027 7263 114 9115 118 120 122 8735 126 9713 8413 7347 4763 136 138 140 3560 144 6775 106...

result:

ok ok (10 test cases)

Test #36:

score: 0
Accepted
time: 135ms
memory: 52588kb

input:

1
200000 399988
171813 28023
127391 157678
139161 157678
157678 158661
157678 6685
120596 157678
189440 28023
72845 28023
28023 155435
178088 157678
54821 157678
199920 7797
7797 23002
132615 7797
7797 114612
28023 98270
157678 29354
29544 28023
28023 6304
28023 86497
20726 7797
198021 7797
4578 157...

output:

68641 151428 17640 108300 25674 12 138325 195570 174478 126017 173652 24 26 15028 9078 26831 117151 58405 3214 48649 133732 50938 16263 123954 50 93343 84981 11841 126827 108434 62 64 113003 45482 70 175500 74 6438 78 120089 99089 84 184893 88 196633 92 94 51503 11839 34185 23758 39839 44034 113415 ...

result:

ok ok (1 test case)

Test #37:

score: 0
Accepted
time: 95ms
memory: 52448kb

input:

1
200000 399994
17358 78776
138799 189702
78776 115828
78776 76870
189702 82466
80014 189702
78776 129553
14969 78776
161279 120022
103978 161279
189702 90678
65648 78776
164898 189702
78776 4880
189702 17932
189702 29494
71164 78776
55663 78776
78776 25638
78776 51965
78776 73585
189702 190545
1173...

output:

2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 29383 46 48 50 52 54 56 126827 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 102 104 106 108 110 112 114 116 118 120 122 124 126 128 47763 132 134 136 138 140 142 144 146 148 150 152 53755 156 158 160 162 164 166 168 170 17...

result:

ok ok (1 test case)

Test #38:

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

input:

1
200000 399996
43234 184957
104384 184957
184957 104551
48901 184957
130388 184957
184957 191112
93746 184957
51488 83793
46496 184957
184957 149525
48305 51488
16545 51488
155037 184957
51488 99541
5545 184957
184957 50631
147758 184957
141234 51488
33945 184957
119044 51488
99610 51488
162526 514...

output:

2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 102 104 106 108 110 112 114 116 118 120 122 124 126 128 130 132 134 136 138 140 142 144 146 148 150 152 154 156 158 160 162 164 166 168 170 172 174 176 1...

result:

ok ok (1 test case)

Test #39:

score: 0
Accepted
time: 110ms
memory: 50788kb

input:

1
200000 399994
187117 14028
171699 93144
87566 171699
48194 171699
123842 171699
86963 78638
171699 77033
187117 79890
123219 171699
171699 63678
68921 187117
187117 91518
12750 187117
11203 171699
166545 171699
187117 75563
4708 187117
86963 26711
115930 86963
187117 102050
187117 66412
187117 962...

output:

2 4 96393 11677 10 124411 68897 16 18 20 22 81881 26 71595 196913 76651 34 36 38 64907 42 44 46 48 50 156029 54 56 58 60 1940 98781 25971 68 70 72 74 76 104620 80 96142 84 86 22117 90 3235 94 96 98 152381 102 169221 189927 108 110 185771 126733 116 118 120 122 124 126 128 130 132 134 136 138 140 142...

result:

ok ok (1 test case)

Test #40:

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

input:

1
200000 399996
158442 44824
102533 158442
144188 158442
180888 177991
158442 60658
130921 158442
11093 158442
158442 91269
177991 66366
45320 177991
852 158442
158345 177991
177991 101419
177991 60694
77523 177991
158442 64839
177991 97717
158442 15688
101326 177991
57416 158442
105648 158442
15844...

output:

2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 102 104 106 108 110 112 114 116 118 120 122 124 126 128 130 132 134 136 138 140 142 144 146 148 150 152 154 156 158 160 162 164 166 168 170 172 174 176 1...

result:

ok ok (1 test case)

Test #41:

score: 0
Accepted
time: 251ms
memory: 50376kb

input:

1
200000 399984
132326 109212
15458 104058
141635 150556
42757 160742
104058 183026
140555 176509
105281 104058
98409 123058
115963 132326
110622 160742
124231 104058
9948 132326
149792 132326
186350 132326
114248 132326
117808 104058
149757 178717
20007 132326
103768 104058
160742 132129
181418 132...

output:

140098 131725 153659 197986 166971 5757 23394 26414 107555 49876 193632 56206 4997 142642 21995 58029 56261 23466 118277 152677 155478 97026 42349 42822 39651 45501 23854 155357 162676 142576 89331 38973 66044 108828 56319 71146 43670 197732 12194 149388 171977 84 176616 126195 40843 45179 121534 62...

result:

ok ok (1 test case)

Test #42:

score: 0
Accepted
time: 248ms
memory: 52872kb

input:

1
200000 399938
118765 169368
80877 55756
183643 55120
179690 39975
52846 39431
183643 142616
40237 9287
169765 51704
169765 196513
180903 78049
2468 127986
103196 92043
171000 183643
51970 16065
33387 150171
54791 100228
96040 51970
183643 73275
194778 116171
119619 51970
78820 25947
121977 74719
1...

output:

22358 17472 147801 109536 33122 107938 23394 111932 92549 181001 193632 160441 86005 130841 18216 92418 142113 178490 118277 161223 14258 94858 157341 75599 127537 80547 67110 197123 1366 189946 177926 78004 20220 70425 139390 178334 90168 13817 86053 154009 158232 136118 80365 126195 43544 23531 11...

result:

ok ok (1 test case)

Test #43:

score: 0
Accepted
time: 305ms
memory: 48892kb

input:

1
200000 399918
4808 186087
3193 20269
53579 193832
181866 119189
96009 51067
26071 110895
180290 198389
75156 67809
146896 88504
26232 199270
41761 194173
163583 73217
11161 69425
127108 172920
26071 136318
4808 20765
58003 13956
56475 127108
124690 96369
98349 88504
88504 129805
1116 75156
193832 ...

output:

65820 80917 85467 46720 173337 144141 13036 100543 105114 96678 27832 67513 35716 145606 4488 42798 4245 100519 140323 180013 34017 151254 167589 25232 171868 197930 91665 137768 172577 23235 46884 29331 192589 46032 174035 14014 138198 76 125043 181099 181644 82092 134535 160177 68632 133924 149676...

result:

ok ok (1 test case)

Test #44:

score: 0
Accepted
time: 230ms
memory: 52536kb

input:

1
200000 394970
67823 148797
176646 48645
130521 57454
24214 159679
58899 105974
31385 9900
98402 172520
136909 143412
104381 107770
158622 39611
181123 4031
93760 67853
87239 94179
102524 50092
53452 91220
161571 173978
140608 6827
8215 91048
101935 80437
20495 175157
85578 193822
117607 100231
195...

output:

1572 153195 155773 198185 157009 130496 14 132355 125767 74024 148108 10416 26 62284 151940 198222 34 147447 131138 142323 20441 126130 84723 69177 131156 72122 176495 6875 181168 47985 43881 74548 106059 33750 109997 51981 129008 23107 33710 62567 81859 69863 168999 20780 62681 58392 43531 193497 1...

result:

ok ok (1 test case)

Test #45:

score: 0
Accepted
time: 276ms
memory: 50808kb

input:

1
200000 324098
195943 81674
197522 192121
73692 10625
137597 30541
116880 163679
19609 78824
65138 65608
122246 18120
69217 48636
96269 102482
152468 42380
70492 187039
106990 158537
130005 170494
6227 16267
17532 42444
156564 89378
116737 22782
3890 98135
93103 18506
14764 134508
107699 107653
151...

output:

2 103825 20583 178821 47615 197110 72127 62827 18 82166 53187 30615 26 34305 64621 113184 173909 82936 16278 101990 5594 141512 4469 75163 47893 52 147423 105126 10651 139714 62 65733 107982 41636 70 65958 165006 145188 52457 80 161212 164845 88525 46161 101043 41302 87117 158489 112881 134475 68450...

result:

ok ok (1 test case)

Test #46:

score: 0
Accepted
time: 289ms
memory: 48004kb

input:

1
200000 200000
10712 34133
109916 81898
148586 4152
6534 159576
7955 53276
15698 110638
182088 163751
60650 31286
73846 141810
54346 154107
123853 122076
157857 161032
36509 82064
151785 146929
124102 184007
26103 42788
135406 130776
30940 184626
184648 4748
54625 68760
4035 142644
13678 114822
386...

output:

12119 4 97806 8 96213 85879 138525 126436 40394 143055 153102 197379 26 28 20718 23421 34 124811 11882 90332 42 44 4469 75163 2017 61588 54 120549 168061 73121 128597 112598 66 15439 123690 12255 85856 181820 119504 198504 131546 38669 48399 177590 29750 23957 198837 94521 98 100 167047 157343 36733...

result:

ok ok (1 test case)