QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#664425#18. Police Stationtanfuxuan100 ✓432ms189664kbC++141.1kb2024-10-21 20:36:502024-10-21 20:36:55

Judging History

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

  • [2024-10-21 20:36:55]
  • 评测
  • 测评结果:100
  • 用时:432ms
  • 内存:189664kb
  • [2024-10-21 20:36:50]
  • 提交

answer

#include<bits/stdc++.h>
const int N=1e6+10;
std::vector<int> to[N];
int low[N],dfn[N],dfn_cnt;
int sta[N],top;bool in_sta[N];
int from[N];
std::vector<int> scc[N];int scc_cnt;
void tarjan(int u){
	low[u]=dfn[u]=++dfn_cnt;
	in_sta[sta[++top]=u]=1;
	for(int v:to[u]){
		if(!dfn[v]){
			tarjan(v);
			low[u]=std::min(low[u],low[v]);
		}
		else if(in_sta[v]){
			low[u]=std::min(low[u],dfn[v]);
		}
	}
	if(dfn[u]==low[u]){
		++scc_cnt;
		do{
			from[sta[top]]=scc_cnt;
			scc[scc_cnt].push_back(sta[top]);
			in_sta[sta[top]]=0;
		}while(sta[top--]!=u);
	}
}
int ind[N],siz[N];
int q[N];
int main(){
	int n,m,u,v;scanf("%d%d",&n,&m);
	while(m--) scanf("%d%d",&u,&v),to[u].push_back(v);
	for(int i=1;i<=n;i++) if(!dfn[i]) tarjan(i);
	for(int u=1;u<=n;u++){
		for(int v:to[u]){
			if(from[u]!=from[v]){
				++ind[from[v]];
			}
		}
	}
	int p=0;
	for(int i=1;i<=scc_cnt;i++)
		if(!ind[i]) ++p;
	if(p==1){
		printf("%llu\n",scc[scc_cnt].size());
		std::sort(scc[scc_cnt].begin(),scc[scc_cnt].end());
		for(int i:scc[scc_cnt]){
			printf("%d ",i);
		}
	}
	else putchar('0');
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 30
Accepted

Test #1:

score: 30
Accepted
time: 0ms
memory: 59540kb

input:

951 1923
800 351
371 252
858 700
139 519
10 778
73 554
273 867
745 917
936 933
697 707
825 881
847 732
90 905
720 86
231 352
255 374
943 80
720 81
868 365
595 545
226 655
28 192
50 876
752 852
485 294
814 700
870 491
153 438
111 699
813 673
296 40
426 463
270 168
417 523
391 192
693 344
251 7
660 78...

output:

0

result:

ok single line: '0'

Test #2:

score: 30
Accepted
time: 3ms
memory: 59684kb

input:

602 1232
494 366
52 346
307 279
410 457
268 296
79 407
421 169
90 106
581 187
103 16
3 12
386 312
100 310
48 367
481 168
594 411
476 122
132 122
533 578
430 146
487 397
328 23
233 50
597 443
362 176
239 328
348 96
284 523
297 349
355 9
373 359
96 166
195 261
457 62
3 251
53 56
484 309
332 22
547 295...

output:

0

result:

ok single line: '0'

Test #3:

score: 30
Accepted
time: 7ms
memory: 60864kb

input:

586 1520
204 256
220 515
265 404
154 217
127 488
310 462
486 523
55 269
402 166
471 414
421 585
339 275
19 499
319 487
19 520
32 398
456 269
445 232
248 402
263 520
507 353
382 453
284 225
248 461
321 504
230 30
114 293
169 333
141 385
4 550
490 482
419 155
545 500
342 539
293 544
582 392
4 92
136 4...

output:

0

result:

ok single line: '0'

Test #4:

score: 30
Accepted
time: 4ms
memory: 60828kb

input:

742 2763
257 56
377 732
470 258
479 465
114 138
199 368
82 49
254 264
165 641
712 568
230 543
632 88
465 241
106 223
624 179
702 567
211 142
51 77
329 232
9 333
192 324
708 602
436 579
636 277
659 509
53 391
704 225
123 681
109 515
203 517
554 505
326 102
691 46
155 692
606 22
497 710
375 353
244 68...

output:

716
1 2 3 4 5 6 7 9 10 11 12 13 14 15 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 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 101 102 103 ...

result:

ok 2 lines

Test #5:

score: 30
Accepted
time: 7ms
memory: 58260kb

input:

656 2583
192 451
621 557
627 587
269 532
127 490
101 567
225 23
495 641
549 7
389 330
270 134
325 643
238 587
325 292
654 450
8 360
650 296
524 163
494 404
235 361
211 474
36 77
423 577
24 475
188 649
251 639
534 354
276 621
110 397
251 481
643 330
365 75
291 530
641 119
492 623
562 57
41 577
572 96...

output:

643
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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102...

result:

ok 2 lines

Test #6:

score: 30
Accepted
time: 3ms
memory: 58320kb

input:

793 1960
292 629
329 381
642 57
239 787
13 265
64 683
35 447
242 334
586 339
776 19
429 464
112 783
722 468
218 143
433 59
423 216
182 177
380 737
611 413
711 790
403 735
95 274
60 103
750 644
716 631
474 40
684 212
480 718
689 357
405 450
574 571
317 505
575 577
34 531
302 718
55 261
255 18
30 134
...

output:

715
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 36 37 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 62 63 64 65 66 67 68 69 70 72 73 74 75 77 78 79 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 101 102 104 105 106 107 10...

result:

ok 2 lines

Test #7:

score: 30
Accepted
time: 3ms
memory: 59404kb

input:

518 1927
247 499
93 441
517 333
512 148
70 246
369 150
443 446
273 103
262 187
246 100
372 513
518 26
84 400
486 265
100 198
104 518
492 203
484 243
184 465
310 290
451 376
396 468
117 245
294 447
392 403
476 333
359 174
510 113
196 182
374 79
241 355
348 113
103 98
515 457
499 121
492 488
231 317
5...

output:

505
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 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 101 103...

result:

ok 2 lines

Test #8:

score: 30
Accepted
time: 4ms
memory: 59628kb

input:

556 2615
546 216
549 110
319 102
318 364
381 402
467 37
273 34
370 351
499 118
289 73
336 404
346 232
491 480
346 34
181 220
379 204
46 364
498 495
206 252
380 222
152 36
434 526
359 178
368 48
133 38
2 462
250 545
528 55
469 390
540 419
250 225
111 13
278 497
410 447
432 268
296 315
236 469
548 509...

output:

546
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 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 101 102...

result:

ok 2 lines

Test #9:

score: 30
Accepted
time: 3ms
memory: 58220kb

input:

745 2393
409 59
596 552
745 520
523 575
644 56
490 581
516 474
422 138
523 568
715 10
396 544
477 78
551 53
583 220
354 644
180 389
716 478
578 281
391 382
544 595
517 219
363 339
364 316
91 48
731 35
236 135
472 497
99 404
82 461
33 345
237 533
148 681
568 356
687 381
255 588
92 164
121 315
375 301...

output:

707
1 2 4 5 6 7 8 9 10 11 12 13 14 15 17 18 19 21 22 23 24 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 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 98 99 100 101 102 103 104 105 1...

result:

ok 2 lines

Test #10:

score: 30
Accepted
time: 8ms
memory: 60076kb

input:

539 2190
513 439
229 71
300 65
216 345
347 283
218 206
129 331
157 403
411 9
247 327
459 10
288 370
188 388
539 91
233 293
117 417
294 159
64 43
399 527
246 85
492 395
166 247
329 113
283 202
499 470
472 311
199 308
393 354
107 520
329 284
296 527
254 350
75 239
538 213
317 410
280 83
442 363
293 37...

output:

531
1 2 3 4 5 6 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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 1...

result:

ok 2 lines

Test #11:

score: 30
Accepted
time: 9ms
memory: 60656kb

input:

579 2209
22 546
97 162
393 20
25 148
307 47
130 448
100 394
112 538
522 378
285 451
376 487
89 317
441 383
569 423
35 215
365 205
136 339
175 309
288 323
528 337
204 540
25 132
319 124
447 376
567 549
5 457
410 501
88 441
196 94
9 531
156 31
417 363
111 32
560 398
358 16
170 554
444 294
44 107
222 1...

output:

562
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 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 87 88 89 90 91 92 93 95 96 97 98 99 100 101 102 103 104 ...

result:

ok 2 lines

Test #12:

score: 30
Accepted
time: 0ms
memory: 59208kb

input:

415 1247
280 32
86 286
279 150
316 166
75 413
138 325
94 315
244 373
39 77
11 148
92 394
257 318
89 176
65 326
193 398
13 251
342 13
277 37
151 402
5 384
292 347
45 107
32 389
39 46
219 74
92 202
183 191
239 228
141 288
182 68
291 9
359 22
248 255
302 152
263 106
96 245
307 301
28 409
225 120
247 61...

output:

395
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 21 22 23 24 25 26 27 28 29 31 32 33 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 62 63 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 105 106 10...

result:

ok 2 lines

Test #13:

score: 30
Accepted
time: 0ms
memory: 60512kb

input:

1000 1000
606 848
161 320
287 43
949 98
287 296
621 127
287 162
287 792
155 409
553 117
867 696
287 845
391 697
585 988
980 855
287 406
990 227
287 911
733 390
514 760
927 639
287 727
287 332
287 926
287 380
287 597
216 200
287 479
409 533
623 293
788 958
287 736
682 245
422 334
287 264
372 553
287 ...

output:

500
3 4 6 8 9 11 12 13 14 16 17 22 24 25 26 29 30 34 35 37 38 39 40 44 45 46 48 50 54 61 62 63 67 76 77 82 87 90 91 93 94 95 98 99 100 102 104 106 109 114 115 117 120 123 125 127 129 132 133 135 136 137 138 140 142 143 145 146 147 148 152 153 154 155 156 157 158 161 164 166 167 169 170 171 174 175 1...

result:

ok 2 lines

Test #14:

score: 30
Accepted
time: 3ms
memory: 59960kb

input:

1000 1000
377 188
91 762
237 243
649 686
352 383
879 838
855 371
1000 22
788 120
626 316
3 724
922 227
617 413
391 915
672 481
997 866
333 109
665 725
863 219
426 119
999 987
587 193
351 115
857 949
46 757
204 492
854 282
182 88
701 38
443 876
803 337
795 579
63 539
849 260
562 706
498 633
469 135
1...

output:

500
1 6 9 11 12 13 14 15 17 19 21 23 24 30 31 32 33 34 36 37 38 39 40 41 42 43 44 45 46 52 53 54 56 58 59 62 65 66 68 70 71 74 75 77 78 85 87 88 90 91 93 96 98 105 107 108 109 112 114 119 124 126 128 129 130 132 133 134 136 137 140 142 148 149 150 152 153 155 156 157 158 159 162 163 165 166 168 169 ...

result:

ok 2 lines

Test #15:

score: 30
Accepted
time: 4ms
memory: 60784kb

input:

1000 1001
727 711
848 222
954 696
288 398
122 182
859 877
171 910
515 887
922 436
823 569
711 494
539 74
510 765
886 968
49 853
75 476
87 440
103 350
297 424
624 485
225 35
917 118
530 70
990 523
60 431
234 854
282 550
794 963
537 229
438 816
799 934
691 478
182 359
387 219
934 238
949 416
23 51
107...

output:

333
1 3 5 11 13 19 22 23 25 27 28 29 30 32 38 43 44 51 59 63 64 65 68 69 71 73 74 75 77 81 84 85 86 90 93 94 101 103 106 108 110 111 112 113 114 115 116 117 118 121 133 141 142 144 145 147 148 150 153 154 156 160 171 175 176 177 178 179 180 181 187 205 207 208 215 217 220 222 226 231 232 233 235 236...

result:

ok 2 lines

Test #16:

score: 30
Accepted
time: 0ms
memory: 60992kb

input:

999 1496
941 152
97 712
265 175
187 236
710 365
279 533
691 476
578 510
900 120
498 765
679 407
703 875
509 594
334 417
394 974
951 948
516 124
582 850
676 512
777 730
248 246
833 984
147 240
164 405
730 935
555 89
623 114
634 367
439 687
169 944
327 926
505 509
590 615
484 858
827 23
654 161
908 23...

output:

499
1 3 4 7 8 9 10 11 13 17 18 19 20 22 26 28 29 32 38 40 41 42 44 45 46 47 48 49 51 52 56 59 61 62 65 66 68 71 72 73 74 75 76 78 79 80 81 83 84 85 86 87 88 89 91 92 96 98 99 101 102 103 104 105 106 109 110 113 115 116 117 119 120 121 125 127 129 131 132 135 137 138 139 140 141 144 145 147 148 150 1...

result:

ok 2 lines

Test #17:

score: 30
Accepted
time: 0ms
memory: 59860kb

input:

2 1
1 2

output:

1
1 

result:

ok 2 lines

Test #18:

score: 30
Accepted
time: 6ms
memory: 58712kb

input:

2 2
2 1
1 2

output:

2
1 2 

result:

ok 2 lines

Test #19:

score: 30
Accepted
time: 4ms
memory: 59468kb

input:

3 1
3 1

output:

0

result:

ok single line: '0'

Test #20:

score: 30
Accepted
time: 8ms
memory: 59996kb

input:

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

output:

1
6 

result:

ok 2 lines

Test #21:

score: 30
Accepted
time: 4ms
memory: 59640kb

input:

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

output:

5
1 2 3 6 8 

result:

ok 2 lines

Test #22:

score: 30
Accepted
time: 4ms
memory: 56028kb

input:

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

output:

10
1 2 3 4 5 6 7 8 9 10 

result:

ok 2 lines

Subtask #2:

score: 70
Accepted

Dependency #1:

100%
Accepted

Test #23:

score: 70
Accepted
time: 273ms
memory: 107032kb

input:

694562 1000000
179414 117547
37250 621415
529167 22142
409193 234372
636718 545432
474767 443861
481528 314754
455195 162175
580416 404837
610776 220217
31938 569018
489814 409211
327636 348741
628087 545776
474448 512276
229372 444854
148326 16045
467261 69671
427881 145412
51159 642356
377343 4398...

output:

0

result:

ok single line: '0'

Test #24:

score: 70
Accepted
time: 262ms
memory: 106968kb

input:

693783 1000000
249308 451981
16191 607043
178721 613720
425290 168686
504364 326482
572828 146568
618969 457669
390585 540365
42950 121106
300750 133583
330811 488094
660885 278681
297447 57845
275342 189549
678377 163845
66393 63272
330164 140254
297804 692866
570701 644161
315843 356815
125545 107...

output:

0

result:

ok single line: '0'

Test #25:

score: 70
Accepted
time: 312ms
memory: 105580kb

input:

647795 1000000
114685 494495
121127 8193
102330 485669
557576 236433
190784 239096
396707 127742
175948 329229
275079 76631
184597 632958
376081 380396
49514 346392
336868 91983
150568 484538
171739 383919
321386 118729
370130 125562
143766 150381
592896 299060
469539 418543
140519 582202
4501 55619...

output:

0

result:

ok single line: '0'

Test #26:

score: 70
Accepted
time: 321ms
memory: 110756kb

input:

807559 1000000
299332 501665
8952 270963
623961 198041
742949 785704
193299 512477
715589 743132
659401 499558
27408 646886
617004 221228
243589 805647
126822 157364
484542 335961
170368 580766
714021 115347
504578 740455
757664 786206
416033 735051
593848 45914
126640 243631
588616 360693
678290 53...

output:

289305
1 2 4 5 9 11 14 16 18 19 20 21 23 26 28 30 32 35 37 42 44 53 54 55 57 58 59 62 64 65 66 67 69 76 83 85 87 89 91 93 95 98 101 102 105 114 115 117 118 119 120 122 123 125 127 131 137 139 141 142 147 148 156 157 158 159 161 163 164 166 172 175 179 183 185 190 194 195 196 198 203 206 209 217 218 ...

result:

ok 2 lines

Test #27:

score: 70
Accepted
time: 276ms
memory: 104032kb

input:

657377 1000000
287283 481588
539553 650045
346201 89237
102099 266201
350584 225272
161645 333377
307109 111842
170840 148464
562630 421255
307536 77797
92375 430270
416086 332315
297984 657210
326747 642803
377045 302704
529836 399675
276883 163190
269906 501236
339487 585820
314422 314340
463469 2...

output:

2
469208 556219 

result:

ok 2 lines

Test #28:

score: 70
Accepted
time: 291ms
memory: 109228kb

input:

747475 1000000
403462 227705
528703 564752
294811 382394
221074 309280
695703 638591
127243 722904
256717 492845
177187 193782
709664 197682
129979 699523
452660 670951
381675 422070
458142 218206
648657 682373
407310 232473
662114 490878
265998 168278
280538 564786
457294 145611
729578 219568
48149...

output:

3
231563 356070 622218 

result:

ok 2 lines

Test #29:

score: 70
Accepted
time: 263ms
memory: 102852kb

input:

500000 1000000
89374 107968
72673 441884
437319 9779
65714 340386
387555 418945
411328 245672
49925 284087
206465 14110
388437 476343
242043 473400
471625 286401
497592 419519
17094 438117
296947 413382
16890 460219
338828 128136
289116 278367
358148 266880
403886 391184
442730 160387
28716 324527
2...

output:

398199
1 2 3 4 6 8 9 10 11 12 14 15 16 18 19 20 23 24 25 27 28 29 30 31 32 33 34 35 38 39 40 41 42 43 44 45 46 47 48 49 51 52 54 55 57 58 61 62 63 65 66 67 70 71 72 73 75 76 77 78 79 80 82 84 85 88 89 90 92 93 95 99 100 102 103 104 105 106 107 109 110 111 113 114 116 117 118 119 120 121 122 123 124 ...

result:

ok 2 lines

Test #30:

score: 70
Accepted
time: 282ms
memory: 102220kb

input:

500000 1000000
44179 222364
363876 496471
58423 306696
413044 238224
229833 40885
258011 323847
300323 128806
403819 454742
367473 440444
39954 123774
430420 397294
447427 180238
87110 227780
434594 346996
17067 349773
238205 126636
199143 81684
448162 92900
118417 220128
383235 480116
477972 352334...

output:

398034
1 2 3 4 5 7 8 9 10 11 12 14 15 16 17 19 20 21 23 25 26 27 29 30 32 33 34 36 37 39 40 41 42 43 45 46 47 48 50 51 52 53 55 57 59 61 63 64 65 66 68 69 70 71 72 73 74 75 76 77 78 79 80 81 83 84 86 87 88 89 90 91 92 93 96 98 99 100 102 103 105 106 107 108 109 111 112 113 115 116 117 118 119 120 12...

result:

ok 2 lines

Test #31:

score: 70
Accepted
time: 272ms
memory: 102412kb

input:

500000 1000000
487407 80774
42251 236854
70735 318570
402528 324880
43872 340254
336639 264431
391710 376064
79564 424143
261047 293521
213932 311957
1234 291521
74681 101843
226062 342941
54049 467752
198354 434354
228693 278193
265069 274368
304546 84645
466635 204558
192377 359811
303550 87444
26...

output:

398804
2 3 4 5 6 7 8 10 11 12 13 14 15 16 17 19 21 22 23 24 25 26 27 28 29 30 31 32 33 34 36 37 38 39 40 41 43 45 46 47 48 49 50 52 53 54 55 56 58 59 61 62 63 64 66 67 69 70 71 74 75 77 78 79 80 81 82 83 84 85 86 87 89 90 93 95 96 97 98 99 100 101 102 103 104 105 107 108 109 110 111 112 113 116 118 ...

result:

ok 2 lines

Test #32:

score: 70
Accepted
time: 250ms
memory: 96176kb

input:

333333 1000000
187656 270491
197120 45565
259454 269992
56179 57392
215726 3408
297349 278653
163628 178890
152668 182224
123510 283737
9759 230182
324517 60795
327842 319624
248716 73233
217900 294747
261200 163756
49541 254079
298719 7897
247487 89257
123961 50434
229038 85566
87395 102419
44609 3...

output:

313506
1 2 3 4 5 6 7 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104...

result:

ok 2 lines

Test #33:

score: 70
Accepted
time: 253ms
memory: 93860kb

input:

333333 1000000
61044 252089
19797 105622
326198 260780
254500 169333
130517 199333
250986 125318
135613 241373
311584 291045
115801 149334
119372 121827
94708 237428
3775 139588
315954 265108
303288 308797
168535 183047
231179 54078
329785 232148
309449 235617
183313 8198
94733 293503
24977 45488
22...

output:

313689
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 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 58 59 60 61 62 63 64 65 66 67 69 70 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 101 102 103 1...

result:

ok 2 lines

Test #34:

score: 70
Accepted
time: 261ms
memory: 93852kb

input:

333333 1000000
240484 264912
46939 49211
219389 15908
152021 198523
33939 217050
306597 163189
331138 115821
292894 321103
225886 164428
127728 15158
243518 150498
231043 270514
85331 304495
302905 97341
218495 203242
229034 213576
137753 142279
92952 304530
33377 310890
134378 27379
79149 132767
25...

output:

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

result:

ok 2 lines

Test #35:

score: 70
Accepted
time: 324ms
memory: 143492kb

input:

1000000 1000000
862877 299511
302797 245730
130742 968312
896591 971933
977867 72523
163991 483483
594863 596571
896591 693696
896591 63402
896591 488446
896591 706837
527038 33048
744444 651443
896591 807041
896591 86835
126023 430685
28304 928895
896591 386335
43163 427115
896591 986382
889041 714...

output:

500000
2 4 6 7 9 10 12 13 16 19 20 23 26 28 29 31 32 34 37 38 39 43 45 48 50 54 55 56 57 59 62 63 64 65 66 68 69 70 75 78 79 83 86 87 90 92 96 98 100 102 104 105 106 107 108 110 111 116 117 118 121 122 124 126 127 128 132 133 135 136 139 141 143 144 145 146 147 148 150 151 152 154 156 158 159 161 16...

result:

ok 2 lines

Test #36:

score: 70
Accepted
time: 432ms
memory: 189664kb

input:

1000000 1000000
608311 626089
8190 235862
288255 128307
527763 487188
107138 624755
761087 697680
551550 129687
258035 202006
98043 597934
353653 124671
573720 505695
101338 300798
741879 570252
909219 740969
870851 996402
578395 599558
211053 636434
620682 861658
862380 678419
152642 112433
687909 ...

output:

500000
1 2 3 10 12 15 19 21 23 25 27 28 35 36 38 40 43 44 45 47 48 52 53 54 58 60 62 63 65 67 68 70 72 73 74 75 78 79 80 82 85 87 88 90 92 94 95 97 99 102 103 108 109 110 113 115 117 118 120 121 126 127 132 135 136 137 138 141 146 147 149 150 151 152 154 158 160 163 166 168 169 173 178 181 182 183 1...

result:

ok 2 lines

Test #37:

score: 70
Accepted
time: 419ms
memory: 146908kb

input:

999999 1000000
741241 526009
615447 87181
49630 687145
913317 827475
748802 131239
869981 213006
359382 458811
520895 809379
220565 361814
635648 359511
847896 592654
414208 243836
853945 71547
602322 626447
834327 744817
276509 640436
677726 288297
869014 889765
345795 434036
129668 723310
183353 6...

output:

333333
2 4 8 10 11 12 14 15 18 20 22 23 28 31 39 40 46 48 51 53 54 56 57 58 60 61 63 66 68 70 75 76 77 78 84 87 88 90 91 93 94 95 96 98 100 103 109 110 112 115 118 120 130 133 134 135 139 140 143 145 147 150 151 154 156 159 161 162 167 174 176 177 178 179 180 181 182 186 189 198 199 204 208 211 213 ...

result:

ok 2 lines

Test #38:

score: 70
Accepted
time: 342ms
memory: 137372kb

input:

666665 999995
252913 115464
634761 118521
599358 73682
391359 165970
649969 39513
172273 58370
400868 543476
364052 480569
534944 80451
178484 481074
512852 236452
205758 84724
327357 590995
660184 585007
227969 346808
393468 207792
651425 377512
382126 65217
400245 603987
39442 312834
103653 290418...

output:

333333
1 2 3 4 6 7 8 9 11 14 15 18 19 21 22 23 24 28 30 32 36 38 41 44 45 47 48 57 59 60 61 62 63 64 65 68 69 70 71 77 82 84 87 88 89 90 94 98 101 102 105 107 108 109 110 115 116 117 120 122 131 134 135 136 139 140 141 146 148 149 151 153 154 158 160 161 162 166 168 169 170 172 173 178 179 180 182 1...

result:

ok 2 lines

Test #39:

score: 70
Accepted
time: 9ms
memory: 61192kb

input:

2 1
2 1

output:

1
2 

result:

ok 2 lines

Test #40:

score: 70
Accepted
time: 3ms
memory: 58752kb

input:

2 2
2 1
1 2

output:

2
1 2 

result:

ok 2 lines

Test #41:

score: 70
Accepted
time: 4ms
memory: 59512kb

input:

3 1
1 2

output:

0

result:

ok single line: '0'

Test #42:

score: 70
Accepted
time: 3ms
memory: 59164kb

input:

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

output:

1
4 

result:

ok 2 lines

Test #43:

score: 70
Accepted
time: 13ms
memory: 60628kb

input:

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

output:

5
2 3 7 8 10 

result:

ok 2 lines

Test #44:

score: 70
Accepted
time: 9ms
memory: 59020kb

input:

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

output:

10
1 2 3 4 5 6 7 8 9 10 

result:

ok 2 lines

Extra Test:

score: 0
Extra Test Passed