QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#481851#950. Star TrekMilmon100 ✓41ms18864kbC++142.3kb2024-07-17 15:11:322024-07-17 15:11:32

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Accepted

Test #1:

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

input:

3 1
1 2
2 3

output:

4

result:

ok single line: '4'

Test #2:

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

input:

999 1000
557 157
759 259
932 386
113 718
442 845
54 538
970 322
917 811
445 890
442 133
842 4
506 268
38 281
928 97
253 53
918 834
145 274
718 435
263 313
50 413
202 346
309 175
176 442
544 75
855 997
45 722
55 402
49 823
869 452
605 405
334 937
453 808
803 530
172 909
996 822
101 989
292 38
327 151...

output:

59688740

result:

ok single line: '59688740'

Subtask #2:

score: 7
Accepted

Test #3:

score: 7
Accepted
time: 1ms
memory: 7224kb

input:

2 100
1 2

output:

499445072

result:

ok single line: '499445072'

Test #4:

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

input:

2 12425
1 2

output:

346132770

result:

ok single line: '346132770'

Test #5:

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

input:

2 123535522316321
1 2

output:

133457048

result:

ok single line: '133457048'

Test #6:

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

input:

2 6162342352351236
1 2

output:

431657487

result:

ok single line: '431657487'

Test #7:

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

input:

2 1000000000000000000
1 2

output:

80065005

result:

ok single line: '80065005'

Subtask #3:

score: 8
Accepted

Test #8:

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

input:

100 1
100 44
82 15
56 50
24 18
91 98
43 75
17 94
70 91
36 8
47 80
32 31
22 50
37 27
38 16
86 48
73 84
63 51
33 30
27 68
21 67
67 91
9 78
26 86
39 54
83 95
60 56
100 47
11 24
16 23
57 91
51 39
34 72
25 73
76 67
98 48
4 1
53 36
15 4
40 37
81 33
95 93
84 66
77 39
29 89
58 40
55 35
93 38
89 39
18 64
96 ...

output:

9956

result:

ok single line: '9956'

Test #9:

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

input:

100 1
38 46
78 7
28 95
47 28
1 14
4 90
9 8
83 56
14 3
94 13
80 17
81 75
6 79
16 15
56 37
39 25
60 84
40 48
87 45
29 60
27 5
58 41
36 38
88 92
10 49
34 42
75 94
89 18
70 16
68 67
37 58
30 80
92 20
44 32
17 52
97 59
86 97
5 89
85 40
11 100
21 22
91 33
98 29
57 99
3 11
65 51
100 98
96 19
7 6
74 55
23 3...

output:

10000

result:

ok single line: '10000'

Test #10:

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

input:

99 1
23 1
59 24
79 1
98 1
69 31
26 57
88 1
20 1
38 46
72 91
2 1
38 1
23 30
50 82
90 1
99 21
47 28
7 6
34 42
10 49
39 1
90 44
13 4
50 1
73 1
33 1
80 17
88 92
77 1
16 15
89 18
60 84
52 1
16 1
77 35
63 70
69 1
98 29
76 71
10 1
74 55
2 65
80 1
39 25
79 83
56 1
85 1
72 1
66 68
96 19
14 1
32 1
22 1
87 1
8...

output:

2500

result:

ok single line: '2500'

Test #11:

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

input:

100 1
4 52
85 13
74 45
62 53
95 71
56 100
23 73
78 54
95 33
24 64
85 100
99 13
67 82
14 79
35 67
37 28
78 17
97 39
57 35
23 87
98 29
90 87
50 76
93 16
17 52
29 90
26 40
24 71
2 33
77 27
3 89
55 96
34 94
41 72
24 86
30 69
9 53
9 91
48 93
4 7
95 44
19 66
74 58
30 7
97 10
49 81
31 76
76 79
2 96
2 83
65...

output:

9406

result:

ok single line: '9406'

Test #12:

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

input:

100 1
95 20
74 77
35 76
54 13
55 90
6 83
86 77
71 33
39 41
83 76
81 15
31 87
53 49
40 12
1 4
24 80
58 57
30 67
26 19
38 100
98 72
59 17
34 17
23 36
53 28
5 3
75 78
53 93
55 45
69 16
9 96
23 41
5 34
82 96
48 16
42 2
70 42
38 32
5 12
8 62
20 85
59 99
14 99
14 91
1 36
69 88
24 92
63 28
27 87
31 52
60 7...

output:

1908

result:

ok single line: '1908'

Subtask #4:

score: 15
Accepted

Dependency #3:

100%
Accepted

Test #13:

score: 15
Accepted
time: 1ms
memory: 6364kb

input:

1000 1
590 532
937 732
981 268
717 86
297 53
391 627
392 975
840 440
1 892
926 878
727 310
376 301
417 460
686 736
180 66
489 772
899 892
314 245
284 454
810 379
92 257
776 12
16 449
267 504
197 354
517 272
213 302
534 96
923 495
761 390
212 511
407 54
868 41
658 471
106 231
134 651
121 141
279 829
...

output:

894

result:

ok single line: '894'

Test #14:

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

input:

1000 1
58 610
202 970
260 447
465 668
990 955
709 346
587 234
126 660
819 802
68 872
762 207
551 449
209 415
687 299
219 401
433 951
253 112
799 808
449 348
235 39
57 128
191 819
112 663
149 817
944 741
913 105
133 197
834 801
532 987
622 755
460 745
655 576
603 277
238 393
647 467
195 57
461 116
88...

output:

1000000

result:

ok single line: '1000000'

Test #15:

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

input:

999 1
898 709
633 908
551 1
726 1
16 1
174 1
449 642
975 1
923 1
914 1
429 1
158 1
383 1
500 315
512 1
54 938
657 62
904 1
358 1
413 811
605 89
867 1
708 1
715 1
857 1
630 1
636 202
914 195
662 296
409 1
919 1
198 1
413 1
481 767
163 1
667 1
539 1
6 1
772 1
610 947
404 596
431 1
672 704
928 1
860 13...

output:

250000

result:

ok single line: '250000'

Test #16:

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

input:

1000 1
353 968
882 603
408 912
464 286
621 982
170 403
627 689
839 505
537 42
324 218
746 361
494 302
730 814
131 298
351 893
78 588
471 614
9 20
145 747
143 517
41 615
872 940
887 35
178 320
583 860
858 249
639 750
253 786
881 696
148 8
110 509
863 3
18 108
647 239
643 811
945 417
37 908
163 662
25...

output:

945660

result:

ok single line: '945660'

Test #17:

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

input:

1000 1
367 834
279 720
809 973
383 949
857 465
289 899
867 999
178 80
868 71
990 389
574 224
92 636
38 511
274 434
699 885
589 56
366 515
725 265
122 57
202 793
501 392
956 969
369 530
194 386
771 831
531 55
188 715
154 65
378 899
495 380
761 245
379 139
279 880
135 685
856 278
662 44
388 561
884 50...

output:

229218

result:

ok single line: '229218'

Subtask #5:

score: 15
Accepted

Dependency #4:

100%
Accepted

Test #18:

score: 15
Accepted
time: 40ms
memory: 14640kb

input:

100000 1
21514 53675
37786 38522
4396 7815
78120 79656
46355 66053
87509 75662
61087 75391
48706 14696
55281 66363
94957 59080
55881 38209
56517 30881
58945 24126
55348 78766
45451 54549
54584 75049
12286 26851
71081 12894
61371 56312
26258 96611
20523 65809
72400 59703
21036 10373
86191 93888
49201...

output:

865183633

result:

ok single line: '865183633'

Test #19:

score: 0
Accepted
time: 28ms
memory: 18772kb

input:

100000 1
94573 87510
30875 28537
57172 56489
45416 39729
14454 53978
56562 8437
4388 99595
14042 77604
93527 96359
69846 75190
61713 60538
26804 4270
61741 38005
6689 37583
65189 89680
53664 48743
95059 83939
75719 84787
69097 10278
24867 49894
71392 33508
53616 56387
25638 42234
3962 49009
78298 91...

output:

999999937

result:

ok single line: '999999937'

Test #20:

score: 0
Accepted
time: 21ms
memory: 10968kb

input:

99999 1
87514 76602
16213 1
56940 1
91460 1
53982 88217
11388 57390
92007 70658
99908 1
91084 1
75194 38377
10114 1
6042 19827
9382 1
37587 40394
86697 1
37084 1
54449 1
84791 79049
2353 72986
38637 1
35409 1
56391 94132
42238 13563
49013 8011
56316 82260
33685 1
58177 52844
65450 1
75501 51405
7601...

output:

499999986

result:

ok single line: '499999986'

Test #21:

score: 0
Accepted
time: 33ms
memory: 11160kb

input:

100000 1
72303 13784
8940 79859
64479 10891
92604 40483
97051 25809
59915 58407
11398 63505
8316 78907
87898 39298
19777 65252
60756 14938
12000 86004
84024 973
86612 42340
11190 6069
10189 59070
32397 41385
84691 76098
68525 57670
62467 17707
70503 20781
78956 65786
68819 22866
86421 29849
85242 78...

output:

673349269

result:

ok single line: '673349269'

Test #22:

score: 0
Accepted
time: 26ms
memory: 11120kb

input:

100000 1
55754 67341
65804 16681
93458 86099
48955 28811
45010 9278
18452 322
63683 21249
56184 20364
76676 80095
48995 38816
70899 71218
88358 84000
30561 64608
32496 62407
691 77204
79830 24709
22887 39550
88496 63394
57015 26073
89262 95062
81082 21895
83879 91208
47356 78494
46469 52891
61951 10...

output:

315808759

result:

ok single line: '315808759'

Subtask #6:

score: 20
Accepted

Dependency #4:

100%
Accepted

Test #23:

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

input:

1000 82512
284 847
888 463
380 399
478 833
653 686
785 476
397 183
424 397
837 654
313 745
450 783
811 340
884 240
802 936
154 70
678 609
943 700
789 795
771 679
326 212
836 531
473 132
552 607
224 976
918 141
648 977
391 493
249 683
152 824
160 745
756 80
952 6
5 355
901 138
506 114
190 613
230 269...

output:

20021886

result:

ok single line: '20021886'

Test #24:

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

input:

1000 91421
284 648
217 135
44 541
47 992
648 138
568 252
862 726
406 196
788 768
15 591
17 900
666 881
83 210
209 731
494 710
262 355
777 764
214 425
546 506
205 281
18 956
966 143
430 787
259 29
66 516
400 780
390 993
723 12
342 539
130 125
733 363
878 450
582 594
851 673
757 583
339 595
886 407
40...

output:

391828247

result:

ok single line: '391828247'

Test #25:

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

input:

801 100000
130 1
601 436
235 1
705 35
500 1
69 445
290 764
182 1
27 1
125 628
590 344
633 1
775 162
437 1
668 1
500 424
685 145
406 1
82 1
59 359
509 1
409 1
177 1
96 1
176 1
398 1
255 1
457 657
149 506
251 488
157 1
13 253
557 1
91 183
421 662
185 1
609 1
486 1
164 1
705 1
217 111
224 51
156 1
158 ...

output:

190470151

result:

ok single line: '190470151'

Test #26:

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

input:

999 83259
201 220
110 39
462 561
500 309
954 666
140 728
280 850
761 235
646 146
201 902
827 659
714 55
410 671
161 854
159 511
115 363
102 216
464 64
793 254
282 153
431 324
875 532
494 242
713 32
698 388
842 744
818 509
498 495
108 495
950 268
891 114
475 800
745 569
698 748
12 539
812 303
115 376...

output:

894338086

result:

ok single line: '894338086'

Test #27:

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

input:

1000 56399
690 165
546 741
745 357
704 754
371 313
423 912
947 759
604 166
760 922
153 414
295 511
811 629
828 387
974 779
392 137
869 706
877 914
553 763
628 790
462 180
681 419
397 527
897 870
974 521
363 912
392 514
975 54
998 514
769 711
704 77
173 64
425 410
621 892
858 415
124 884
867 652
908 ...

output:

510610377

result:

ok single line: '510610377'

Subtask #7:

score: 20
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Test #28:

score: 20
Accepted
time: 31ms
memory: 16848kb

input:

100000 92124
82856 45920
75860 43490
8817 89124
81951 17219
92516 57325
11574 50816
30525 22445
81574 54239
62629 99217
43043 47791
36700 48834
74663 88013
87806 34783
39143 32152
92936 55285
73060 41425
64564 84749
22964 36559
92636 71109
59593 86712
49398 63839
61535 75911
71456 98090
75664 97638
...

output:

304821279

result:

ok single line: '304821279'

Test #29:

score: 0
Accepted
time: 36ms
memory: 17716kb

input:

91248 82412
25371 33523
3380 34395
88288 39682
8855 62349
46237 68403
12447 53980
59776 35629
47072 20176
60528 68744
86176 8147
12304 52713
71733 56126
47204 57022
28751 44117
63533 23331
75266 84218
11037 66090
32004 34682
79647 70261
86459 90024
47011 78539
18367 55237
16773 52239
58893 73719
608...

output:

500457036

result:

ok single line: '500457036'

Test #30:

score: 0
Accepted
time: 21ms
memory: 10508kb

input:

88497 82919
29788 26240
9337 9345
52102 73037
72354 1
51272 40198
81274 80262
41892 1
16351 1
50807 1
15587 1
73505 1
77754 1
22237 54575
75944 1
45815 43885
21164 1
69426 49464
59332 1
50747 74826
47788 39412
77182 43934
74968 4636
50412 1
77941 70969
19743 1
986 73949
19895 47021
36184 1
10639 276...

output:

644659522

result:

ok single line: '644659522'

Test #31:

score: 0
Accepted
time: 34ms
memory: 10976kb

input:

100000 21363
76433 3812
31762 59140
51384 72244
38101 73855
83264 32435
14789 8604
22607 63560
89294 77905
93882 38792
69611 64381
74016 3342
44290 20025
53609 98744
41126 83298
22128 21236
52671 75222
70802 74430
79779 94230
59880 1576
62567 8044
64103 31915
16365 9483
48982 32828
87577 96659
71119...

output:

95288806

result:

ok single line: '95288806'

Test #32:

score: 0
Accepted
time: 34ms
memory: 11156kb

input:

99999 93852
10928 66527
33919 79129
35322 57411
43794 72058
32230 39264
79201 73006
33545 52111
71825 92821
10121 11980
70279 51528
71006 83534
81218 68962
11527 51749
16313 40996
8775 89569
35239 78656
21970 40071
60492 32662
68137 58901
5627 18889
19441 86776
24173 54883
15226 25959
82590 55404
73...

output:

350835742

result:

ok single line: '350835742'

Subtask #8:

score: 15
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

Test #33:

score: 15
Accepted
time: 41ms
memory: 18864kb

input:

100000 1073741824
79489 96247
38694 43880
45003 59425
37293 66452
11535 15719
75079 61458
33003 88522
67582 10255
74483 40820
92963 56077
51055 58489
49235 26559
74273 75857
83915 44058
7126 63016
90702 90411
923 15245
71785 67826
44933 39874
45267 52010
5655 49371
55962 43265
86222 73711
20807 4583...

output:

208715272

result:

ok single line: '208715272'

Test #34:

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

input:

100000 14512624162169459
96168 98601
67856 73591
13466 78243
52223 85529
84153 51374
84545 72179
5514 59683
46057 29261
50918 82462
38477 14062
91138 56527
26663 34182
22734 24283
150 65068
28751 74500
55290 38950
69598 66764
35754 42405
27513 28604
81039 49730
43966 17414
89354 594
90812 74851
8790...

output:

604685211

result:

ok single line: '604685211'

Test #35:

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

input:

80001 213235312312353
67368 56332
14479 1
4654 1
72752 1
36334 1
55549 63396
21341 1
58890 1
39640 10937
66399 21575
59089 1
9759 14313
20018 19132
37004 1
22390 1
66396 6637
26455 33778
43778 31594
54444 1
79714 52547
46556 1
76584 72497
11016 1
8255 33766
463 26604
44132 30119
68122 1
72781 1
6186...

output:

784970043

result:

ok single line: '784970043'

Test #36:

score: 0
Accepted
time: 36ms
memory: 14676kb

input:

100000 1000000000000000000
96339 99560
80659 38626
4513 12994
80876 63549
51947 50170
42299 40706
47815 90368
7504 20253
12143 32016
49201 90422
10343 66898
18197 49744
43932 24523
49078 37461
61454 56089
64272 56783
15252 69516
43585 62317
12448 29987
23693 80748
1845 52405
9194 49968
71850 53678
6...

output:

88819539

result:

ok single line: '88819539'

Test #37:

score: 0
Accepted
time: 32ms
memory: 11208kb

input:

100000 21351266125613
15910 55533
93333 41393
43133 46124
38643 89491
93571 94740
73661 82684
73622 4768
17453 87367
73344 68145
69859 57325
83073 53920
24732 36598
10400 768
7262 9540
41881 57812
68104 77154
71263 63122
45865 44906
22403 3263
41437 13881
65939 67018
72316 34320
16283 67453
58553 69...

output:

231480355

result:

ok single line: '231480355'

Test #38:

score: 0
Accepted
time: 34ms
memory: 11148kb

input:

100000 100000000000000000
20698 37881
55411 68869
41919 869
396 36951
54016 36082
47882 90873
74267 88164
68172 91072
37430 21501
14284 45524
50242 26428
77751 71624
60108 70831
17453 21958
15695 8299
16420 76354
88106 99623
83976 84451
98867 466
83896 75295
53110 85621
14774 4367
44351 24700
31229 ...

output:

347543296

result:

ok single line: '347543296'

Test #39:

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

input:

100000 123512332522222
26507 73192
23985 20353
28032 73651
87760 69482
79698 91717
13694 55747
94123 26895
56845 64982
68033 78685
13790 31829
17703 66812
2042 59933
83998 24482
79539 84528
50520 69729
57488 76836
76467 82360
10204 63174
49601 68432
5995 26016
76115 39662
62249 76644
80150 30308
942...

output:

194914351

result:

ok single line: '194914351'

Test #40:

score: 0
Accepted
time: 34ms
memory: 11092kb

input:

100000 1000002305125333
77469 95657
66815 79156
78635 72079
86117 66923
17623 67265
11712 75034
96201 58441
68201 18422
61643 49255
308 38025
88761 81896
17262 1505
90852 46812
64485 64605
93250 72273
70440 92919
35639 14290
89756 65959
72507 51186
86401 59400
81505 13191
98757 71774
92447 65560
757...

output:

197427652

result:

ok single line: '197427652'

Extra Test:

score: 0
Extra Test Passed