QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#526276#8591. ShopsZhaoZiLong100 ✓214ms46092kbC++231.1kb2024-08-21 12:54:002024-08-21 12:54:01

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 7
Accepted

Test #1:

score: 7
Accepted
time: 0ms
memory: 3584kb

input:

3 3
1 2 3
2 3 1
1 3 2

output:

2
DDB

result:

ok inconveniences = 2

Test #2:

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

input:

5 6
3 2 3
4 2 1
5 3 9
1 3 5
1 4 2
2 3 1

output:

9
DDBBD

result:

ok inconveniences = 9

Test #3:

score: 7
Accepted
time: 20ms
memory: 8112kb

input:

8 135737
1 4 763713071
3 7 45141437
4 8 618418466
6 8 91803956
7 5 972595945
5 2 751163228
2 8 9886315
4 3 106470622
8 6 949495949
1 2 885918825
4 6 322040168
7 6 754489330
4 8 618968328
5 3 996860159
3 6 210132897
3 4 591744987
8 7 447985622
2 4 4833956
5 7 610154418
2 5 410116873
2 5 912717336
8 7...

output:

19258
DDBBDBBB

result:

ok inconveniences = 19258

Test #4:

score: 7
Accepted
time: 40ms
memory: 11820kb

input:

13 265680
1 4 380374649
3 10 784226975
4 11 872278132
5 11 592626606
6 11 526829741
9 11 740573742
10 8 276205430
8 12 63494864
11 2 71771791
2 13 737308410
12 7 878733769
7 13 903269395
5 9 120579034
5 12 138606132
4 11 662866874
11 2 700788392
6 10 585492424
5 12 28226068
13 10 114889571
7 11 2004...

output:

65982
DDDBBDDDBBBBD

result:

ok inconveniences = 65982

Test #5:

score: 7
Accepted
time: 44ms
memory: 19024kb

input:

2 373114
1 2 974989916
1 2 167686461
2 1 874714837
1 2 864433403
2 1 5005374
2 1 395259584
2 1 508862785
2 1 44724432
2 1 454094822
1 2 508318735
1 2 977605453
1 2 265311692
1 2 773880917
2 1 586327430
1 2 768708534
2 1 100847253
1 2 6244686
1 2 323240784
2 1 45647197
1 2 914752947
1 2 222102030
1 2...

output:

509
DB

result:

ok inconveniences = 509

Test #6:

score: 7
Accepted
time: 37ms
memory: 13048kb

input:

15 293068
1 4 258818839
4 3 204793003
5 3 854744190
3 9 788200755
9 7 108614733
11 10 503890749
12 10 734694989
10 2 350766061
2 6 597468181
6 8 227104490
8 7 345420481
7 13 180194608
14 13 674888672
13 15 167655205
6 3 855543442
3 9 687174916
15 6 641812755
4 11 353729428
11 9 32193849
11 1 1354442...

output:

83506
DDDBDDDDDBBBDDB

result:

ok inconveniences = 83506

Test #7:

score: 7
Accepted
time: 54ms
memory: 19500kb

input:

16 500000
1 8 62757308
4 3 6086405
8 13 122144601
9 3 64557726
3 11 812380590
11 5 453430162
12 10 361214682
10 5 261815175
14 2 515797344
2 7 642876852
7 5 35056850
5 6 743310007
6 15 282260939
15 13 94433700
13 16 448013089
16 11 719836976
16 12 719865713
9 6 408172771
5 11 723450797
7 13 76614544...

output:

22372
DDBDBDBDBDDBBDDB

result:

ok inconveniences = 22372

Test #8:

score: 7
Accepted
time: 70ms
memory: 19396kb

input:

16 500000
3 8 707927663
5 6 31687997
7 14 697861063
9 4 347120998
10 2 664365468
12 15 99754727
14 8 883245817
8 1 659078917
1 6 345106180
6 11 869578009
15 4 870015619
4 13 686672311
13 2 234049952
2 11 896975378
11 16 972960752
15 1 584513015
3 1 303056953
16 9 472827775
8 16 653700355
15 16 36838...

output:

38343
DBDDDDDDBBDDBBDB

result:

ok inconveniences = 38343

Test #9:

score: 7
Accepted
time: 9ms
memory: 6436kb

input:

16 77010
1 2 793736027
2 12 72260632
8 9 402732232
9 3 256827318
3 4 437695398
10 5 265719081
5 6 618443602
12 11 40956038
11 4 852273728
4 6 853314294
13 7 658974087
7 6 798496221
6 15 978830498
15 14 443477053
14 16 550578548
12 5 361355178
11 2 762353204
15 4 601752138
7 11 160395331
15 13 220004...

output:

309636
DDDDBDBDBDDBBBBB

result:

ok inconveniences = 309636

Test #10:

score: 7
Accepted
time: 10ms
memory: 5944kb

input:

16 64382
4 13 443239253
5 1 990800886
1 3 966518884
9 11 718720038
10 11 795048977
11 6 127421564
6 7 944954312
7 2 797353656
2 8 486371900
14 12 679402638
12 3 852829651
3 8 288307369
8 16 878703936
15 13 797175282
13 16 689574513
1 12 842120755
4 13 320340401
1 15 174145088
6 15 888245466
13 4 938...

output:

187454
DDBDDDBBDDBDDBBB

result:

ok inconveniences = 187454

Subtask #2:

score: 13
Accepted

Test #11:

score: 13
Accepted
time: 110ms
memory: 42612kb

input:

500000 499999
1 2 776715136
2 3 406881694
3 4 265792290
4 5 507607272
5 6 182246639
6 7 997847597
7 8 164130256
8 9 278962226
9 10 411194641
10 11 363646402
11 12 672225656
12 13 494629089
13 14 717664153
14 15 121619271
15 16 476857704
16 17 301215244
17 18 810217743
18 19 850722975
19 20 10710274
...

output:

998789691
DBDBDBDBDDBDBDBDBDDBDBDBDBDBDBDBDBDDBDBDDBDDBDDBDBDDBDBDBDBDDBDBDBDBDBDBDBDDBDBDBDDBDBDBDDBDBDBDDBDDBDBDBDDBDBDDBDDBDBDBDBDDBDDBDBDDBDDBDBDDBDBDBDBDBDDBDDBDBDDBDBDDBDDBDBDDBDDBDDBDBDBDBDDBDBDBDBDBDBDBDDBDBDBDBDBDDBDBDBDBDDBDDBDBDBDDBDBDBDBDDBDBDBDDBDBDDBDBDBDBDDBDBDDBDDBDDBDBDBDBDBDDBDBDBD...

result:

ok inconveniences = 998789691

Test #12:

score: 13
Accepted
time: 118ms
memory: 42704kb

input:

500000 499999
1 2 919029898
2 3 967926553
3 4 537841283
4 5 789574589
5 6 84356111
6 7 262979300
7 8 81760204
8 9 934833222
9 10 815362560
10 11 765318578
11 12 133878729
12 13 42184040
13 14 683417496
14 15 330426787
15 16 252037344
16 17 246808442
17 18 218647305
18 19 390164712
19 20 304437162
20...

output:

998086576
DBDBDBDBDBDBDDBDBDDBDBDBDBDBDDBDBDDBDBDDBDBDBDBDBDDBDBDBDBDDBDDBDDBDBDDBDBDBDBDDBDBDBDBDBDBDBDBDDBDBDBDBDBDBDBDBDBDBDBDDBDBDBDBDBDBDDBDBDBDBDBDBDBDBDBDDBDBDDBDDBDBDBDDBDBDBDBDBDBDBDDBDDBDDBDDBDBDDBDDBDBDBDBDBDBDBDBDBDBDBDBDBDDBDBDBDBDBDBDBDBDBDDBDDBDBDDBDBDBDBDDBDBDBDBDBDBDBDBDDBDBDBDBDBDB...

result:

ok inconveniences = 998086576

Test #13:

score: 13
Accepted
time: 113ms
memory: 42692kb

input:

500000 499999
1 2 495717169
2 3 2736566
3 4 246490731
4 5 676348793
5 6 433656165
6 7 300871636
7 8 877832205
8 9 24348676
9 10 904055276
10 11 110426018
11 12 943185526
12 13 820883221
13 14 622560418
14 15 960692040
15 16 630347197
16 17 390849180
17 18 366668667
18 19 919683360
19 20 161247567
20...

output:

999027362
DBDBDBDDBDBDBDDBDBDBDBDDBDBDBDDBDDBDBDBDDBDBDBDBDDBDDBDDBDBDBDDBDBDDBDBDBDBDDBDDBDDBDBDBDBDBDBDDBDDBDDBDBDBDBDBDBDDBDDBDBDDBDDBDBDBDDBDBDBDBDBDDBDDBDDBDBDDBDDBDBDBDBDDBDDBDBDDBDBDDBDBDBDBDDBDBDDBDBDBDBDBDBDDBDBDDBDBDBDBDDBDBDBDBDBDBDBDBDBDDBDBDBDBDBDBDDBDBDDBDBDBDBDDBDDBDBDDBDDBDBDBDBDBDBD...

result:

ok inconveniences = 999027362

Test #14:

score: 13
Accepted
time: 122ms
memory: 42692kb

input:

500000 499999
1 2 881926628
2 3 878365295
3 4 189444416
4 5 196764012
5 6 937066345
6 7 492929211
7 8 404162136
8 9 294189704
9 10 648590434
10 11 205708308
11 12 917107337
12 13 430038581
13 14 988914191
14 15 996853504
15 16 766772044
16 17 551967939
17 18 98588609
18 19 726003769
19 20 770678124
...

output:

998870338
DBDBDDBDBDBDBDDBDBDBDBDBDBDBDBDBDBDBDBDDBDBDBDBDDBDBDBDBDBDDBDBDBDBDBDDBDDBDDBDBDBDDBDBDDBDBDBDDBDDBDBDBDBDDBDDBDDBDDBDBDDBDBDBDBDBDDBDDBDDBDBDBDBDBDBDDBDDBDDBDBDBDBDDBDDBDBDBDBDBDBDDBDBDDBDBDBDBDBDBDBDBDDBDDBDBDBDBDBDBDBDBDBDBDDBDBDBDBDBDDBDDBDBDDBDBDBDDBDDBDBDDBDBDBDDBDBDDBDBDDBDDBDBDBDB...

result:

ok inconveniences = 998870338

Test #15:

score: 13
Accepted
time: 111ms
memory: 42688kb

input:

500000 499999
1 2 275555710
2 3 928907994
3 4 351852867
4 5 739735339
5 6 757618705
6 7 186440113
7 8 817785536
8 9 958144538
9 10 65474464
10 11 881281553
11 12 537108380
12 13 419150600
13 14 786449308
14 15 645606967
15 16 757995051
16 17 9350371
17 18 413220186
18 19 856401635
19 20 774467299
20...

output:

998341670
DBDBDDBDDBDBDDBDBDDBDDBDDBDBDBDDBDDBDDBDDBDBDBDBDBDDBDBDBDBDBDBDBDDBDBDBDBDDBDDBDBDBDBDBDBDBDDBDBDBDBDBDDBDDBDBDDBDBDBDBDBDDBDDBDBDDBDBDDBDBDBDBDBDDBDBDBDBDBDDBDBDBDBDBDBDDBDDBDBDBDBDBDBDDBDBDBDBDBDDBDDBDBDBDBDBDBDBDBDBDDBDDBDBDBDBDBDBDDBDBDBDDBDDBDBDBDDBDBDBDDBDDBDBDDBDBDDBDBDBDBDBDBDDBDB...

result:

ok inconveniences = 998341670

Test #16:

score: 13
Accepted
time: 107ms
memory: 42744kb

input:

500000 499999
1 2 2726164
2 3 814453419
3 4 77779202
4 5 212522091
5 6 575026293
6 7 111411302
7 8 671949780
8 9 598712779
9 10 513069672
10 11 622002136
11 12 606394125
12 13 554104755
13 14 693830694
14 15 464592249
15 16 176186577
16 17 170141847
17 18 84481371
18 19 18806105
19 20 887306486
20 2...

output:

998639500
DBDBDDBDBDDBDDBDBDBDBDBDBDBDDBDBDBDDBDDBDBDBDBDBDBDBDBDBDBDBDBDDBDBDBDBDBDBDBDBDDBDDBDBDBDDBDDBDBDBDBDDBDBDBDBDBDBDBDBDBDBDBDBDDBDBDBDBDBDBDBDBDDBDBDBDBDBDBDDBDDBDBDBDBDDBDBDBDBDBDBDDBDBDBDBDBDBDDBDBDBDBDDBDBDBDDBDBDBDBDBDBDDBDBDBDBDBDBDBDDBDBDDBDDBDBDDBDBDBDBDBDDBDDBDBDBDBDBDBDDBDDBDBDDBD...

result:

ok inconveniences = 998639500

Test #17:

score: 13
Accepted
time: 106ms
memory: 42776kb

input:

500000 499999
1 2 699534547
2 3 756875816
3 4 650330256
4 5 385184303
5 6 252347359
6 7 572617046
7 8 54010889
8 9 947248022
9 10 691017140
10 11 281775875
11 12 804678960
12 13 796483137
13 14 721881104
14 15 799196727
15 16 932579324
16 17 778572034
17 18 156714181
18 19 173646893
19 20 854532026
...

output:

998386205
DBDBDBDBDBDDBDBDBDBDBDBDBDDBDBDBDDBDBDBDBDBDBDBDBDBDDBDBDBDBDBDBDDBDBDBDDBDBDBDBDDBDDBDBDDBDBDBDDBDDBDBDDBDBDDBDDBDBDBDBDBDDBDDBDDBDDBDDBDDBDBDBDDBDBDBDBDDBDBDDBDDBDDBDBDDBDDBDBDBDBDDBDDBDBDDBDDBDBDBDDBDDBDBDBDBDBDBDDBDBDBDBDBDDBDBDBDBDBDBDBDDBDDBDBDDBDBDDBDDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDD...

result:

ok inconveniences = 998386205

Test #18:

score: 13
Accepted
time: 93ms
memory: 42704kb

input:

500000 499999
1 2 528281229
2 3 544813983
3 4 970327172
4 5 223929886
5 6 297537831
6 7 701582097
7 8 321477324
8 9 508501108
9 10 187475004
10 11 847549963
11 12 25037993
12 13 730505330
13 14 934227167
14 15 42350450
15 16 716244922
16 17 577182613
17 18 47412695
18 19 403130619
19 20 783335054
20...

output:

998268275
DBDDBDDBDBDBDDBDBDBDDBDDBDBDBDDBDDBDBDBDBDBDBDBDBDBDBDBDBDBDBDDBDDBDDBDBDBDBDBDBDBDBDDBDBDBDDBDBDDBDBDDBDBDBDBDDBDBDBDDBDBDDBDBDBDBDBDBDBDBDDBDDBDBDBDBDDBDBDDBDBDBDBDBDBDBDBDBDBDBDDBDBDBDBDDBDBDBDBDDBDDBDDBDBDBDDBDBDDBDBDBDBDBDBDDBDBDBDBDBDDBDBDBDDBDBDBDBDBDBDBDDBDBDDBDBDBDBDBDBDDBDDBDDBDB...

result:

ok inconveniences = 998268275

Test #19:

score: 13
Accepted
time: 115ms
memory: 42692kb

input:

500000 499999
1 2 176647181
2 3 430435019
3 4 142683460
4 5 760806099
5 6 691983032
6 7 640928945
7 8 564806640
8 9 587621269
9 10 656576849
10 11 810001387
11 12 295415472
12 13 676473367
13 14 495893801
14 15 236356194
15 16 896384046
16 17 853257263
17 18 531811298
18 19 914837617
19 20 540207783...

output:

998100668
DBDBDBDBDBDBDBDDBDDBDBDBDBDDBDBDBDBDBDDBDBDBDBDBDBDBDDBDBDDBDBDDBDBDBDDBDBDDBDBDBDDBDDBDBDBDBDBDBDBDDBDBDBDBDBDBDBDDBDBDBDBDBDDBDBDDBDBDBDBDBDDBDBDBDBDBDBDBDBDBDBDDBDBDDBDBDBDDBDBDDBDBDDBDBDBDDBDBDDBDBDDBDBDDBDBDDBDBDDBDBDDBDDBDBDBDBDBDBDDBDDBDBDDBDDBDBDBDDBDBDBDBDBDDBDBDBDBDBDBDDBDBDDBDBD...

result:

ok inconveniences = 998100668

Test #20:

score: 13
Accepted
time: 117ms
memory: 42616kb

input:

500000 499999
1 2 459441093
2 3 712179264
3 4 462698877
4 5 428755230
5 6 140982872
6 7 333359430
7 8 145590701
8 9 605794157
9 10 885201977
10 11 992315213
11 12 787968819
12 13 693140189
13 14 777613982
14 15 486848706
15 16 417423069
16 17 904399877
17 18 169733516
18 19 650464517
19 20 956947852...

output:

998576988
DBDBDBDBDBDBDDBDDBDDBDBDBDBDBDBDBDDBDBDBDBDDBDBDBDDBDBDDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDDBDBDBDBDDBDBDBDDBDBDBDDBDBDBDBDDBDBDDBDBDBDDBDDBDBDDBDBDBDBDBDDBDDBDBDBDBDDBDBDBDBDBDBDBDDBDBDBDBDDBDBDDBDDBDDBDBDBDBDBDDBDBDDBDBDBDDBDBDBDBDDBDBDDBDBDBDBDBDBDDBDBDDBDDBDBDDBDDBDDBDDBDBDDBDBDDBDBDDBDDB...

result:

ok inconveniences = 998576988

Subtask #3:

score: 18
Accepted

Dependency #2:

100%
Accepted

Test #21:

score: 18
Accepted
time: 192ms
memory: 46084kb

input:

500000 499999
1 498191 98644113
4 407741 285960522
9 2593 142219271
10 231716 692978475
11 281544 395541063
12 425498 656170589
13 383980 504747359
19 160252 266870005
21 153907 259282410
23 150872 408664227
24 364918 305130116
29 206272 807953223
32 114552 837969530
33 446658 296132297
34 445587 53...

output:

999999634
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999999634

Test #22:

score: 18
Accepted
time: 185ms
memory: 46004kb

input:

500000 499999
1 298047 486034323
3 302455 15380870
10 112586 384710444
12 461380 106460032
15 400629 477739108
16 122191 944242040
19 140395 876468438
20 474471 54926698
21 247975 99912702
27 311759 304963895
29 201874 604590096
32 50134 964818840
34 52048 182700548
35 250795 19874383
38 296918 1736...

output:

999996272
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999996272

Test #23:

score: 18
Accepted
time: 195ms
memory: 45996kb

input:

500000 499999
2 226958 733592075
3 282387 995489009
5 3289 914063619
7 440129 319619170
10 232251 411769136
15 43628 596243869
16 52374 374810745
24 21798 520964509
34 187883 248720052
35 17991 51962919
37 359348 832609079
42 101340 397779335
43 208881 996145582
44 4415 606734719
45 65727 142440494
...

output:

999998286
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999998286

Test #24:

score: 18
Accepted
time: 179ms
memory: 45916kb

input:

500000 499999
1 195861 482944530
4 253474 607504910
6 499057 183478116
7 270968 191239
9 218955 878650354
11 395347 639963581
18 131956 561652195
20 83456 418951767
21 52587 414052939
26 293651 163591780
32 174307 880729517
34 443184 781843198
36 99016 683958976
40 405900 433342252
43 379684 4646270...

output:

999999321
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999999321

Test #25:

score: 18
Accepted
time: 193ms
memory: 45956kb

input:

500000 499999
1 393184 586613362
4 340302 191769755
6 454461 697663107
8 116487 763378035
10 311098 323331823
11 271655 814032559
12 449238 759661861
13 489535 331502823
16 25411 976732072
23 180097 559693743
25 25359 850249966
26 352864 542643997
28 16841 296031371
30 472953 998957448
31 128349 210...

output:

999991572
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999991572

Test #26:

score: 18
Accepted
time: 196ms
memory: 46084kb

input:

500000 499999
3 100372 223541239
4 428911 979162540
8 389796 555207091
9 18026 175154280
13 83459 757629595
14 318242 562687038
16 186332 56015539
19 450513 687421132
23 363524 355955464
28 19737 665996432
30 324384 78021621
33 82309 139756751
36 302313 309431714
37 25550 234897335
38 15923 59162388...

output:

999997771
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999997771

Test #27:

score: 18
Accepted
time: 185ms
memory: 45980kb

input:

500000 499999
3 322399 938467174
5 294668 997432634
9 140349 749403173
13 156326 230666059
15 176904 584148575
18 462527 661616347
19 115932 915236576
20 40100 537230519
21 360684 923335513
22 478700 447133025
25 299737 154218322
28 413164 457095459
31 459296 293271135
32 200585 898724710
36 129428 ...

output:

999995080
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999995080

Test #28:

score: 18
Accepted
time: 199ms
memory: 45924kb

input:

500000 499999
1 349448 695258814
3 413276 280795333
5 321286 908037219
13 407009 915549351
17 386773 804890068
21 39914 951119699
22 480150 163314795
25 134419 514390297
27 432990 814259581
29 335885 139743148
35 28324 612519155
36 43885 372504270
42 344828 8498457
48 449031 890534986
51 362532 6223...

output:

999998911
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999998911

Test #29:

score: 18
Accepted
time: 208ms
memory: 46092kb

input:

500000 499999
2 10921 246329059
5 470731 878985801
7 160878 180062960
8 58099 756069772
10 475544 658632747
15 476775 199595606
21 95867 218826447
28 293838 603911187
29 268431 782740038
33 408755 673720382
37 490718 552334523
38 362775 747272214
40 283199 889096173
43 455689 72912274
50 213988 5215...

output:

999996361
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999996361

Test #30:

score: 18
Accepted
time: 178ms
memory: 46008kb

input:

500000 499999
1 143758 557958489
4 395896 134647479
5 223284 982837565
6 152064 270356505
7 49367 458751900
12 408086 415638934
13 281677 430784294
17 199713 516686210
21 126232 368019079
24 121546 763498777
26 261239 623535252
32 460231 602594775
38 405662 735358912
40 122229 589490694
42 253737 23...

output:

999999181
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999999181

Subtask #4:

score: 24
Accepted

Test #31:

score: 24
Accepted
time: 124ms
memory: 36608kb

input:

366489 397001
2 127909 1
7 171229 1
8 158597 1
11 282213 1
14 356007 1
15 286102 1
16 93205 1
17 260111 1
18 138962 1
20 359938 1
29 223905 1
31 357684 1
32 259968 1
34 65205 1
37 200276 1
41 83195 1
43 159858 1
48 332277 1
50 320322 1
51 338467 1
53 262785 1
55 83815 1
56 173198 1
58 169473 1
63 19...

output:

1
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 1

Test #32:

score: 24
Accepted
time: 158ms
memory: 44676kb

input:

475552 488952
2 161263 1
3 312211 1
5 41910 1
6 421865 1
7 340911 1
9 419906 1
10 468773 1
13 17837 1
18 465833 1
19 297766 1
21 234125 1
26 218984 1
28 296050 1
29 411520 1
30 38207 1
33 370786 1
34 21620 1
35 467168 1
40 136766 1
42 353240 1
44 194443 1
46 119022 1
48 23233 1
54 380603 1
60 99339 ...

output:

1
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 1

Test #33:

score: 24
Accepted
time: 42ms
memory: 15320kb

input:

128817 140020
2 53427 1
5 86824 1
6 33490 1
11 63864 1
14 109608 1
15 12909 1
16 45790 1
19 27271 1
22 54044 1
24 11063 1
32 53692 1
35 70034 1
38 84224 1
39 64068 1
43 72895 1
44 51948 1
45 40428 1
49 127824 1
50 52852 1
60 25795 1
61 105666 1
65 41013 1
67 97450 1
69 49349 1
71 47569 1
72 70751 1
...

output:

1
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 1

Test #34:

score: 24
Accepted
time: 103ms
memory: 30976kb

input:

299635 331829
5 197808 1
11 67054 1
12 84275 1
15 287112 1
16 274955 1
24 40825 1
30 266299 1
34 81379 1
35 99815 1
38 219853 1
42 189961 1
47 107895 1
48 137516 1
50 80614 1
54 264232 1
55 93625 1
62 143056 1
63 70844 1
64 72811 1
65 164091 1
68 248158 1
70 9821 1
72 156352 1
77 215022 1
81 270025 ...

output:

1
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 1

Test #35:

score: 24
Accepted
time: 146ms
memory: 39536kb

input:

369927 447544
1 150509 1
5 250257 1
6 149327 1
7 201307 1
15 330381 1
16 158914 1
18 99391 1
24 90164 1
25 199087 1
28 306199 1
32 83429 1
35 212184 1
36 29977 1
37 261629 1
44 99341 1
45 48378 1
51 130523 1
53 148929 1
58 77382 1
71 211093 1
72 305907 1
73 227420 1
75 188876 1
76 71437 1
79 354402 ...

output:

1
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 1

Test #36:

score: 24
Accepted
time: 181ms
memory: 45988kb

input:

500000 500000
4 319400 1
12 186157 1
13 443669 1
15 227339 1
19 101284 1
20 183604 1
23 273179 1
26 236933 1
27 79090 1
28 826 1
29 7574 1
31 370188 1
32 48463 1
34 113530 1
35 209157 1
46 13739 1
47 188127 1
48 97203 1
51 251724 1
52 469749 1
53 451782 1
56 249224 1
58 262324 1
60 380990 1
61 82320...

output:

1
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 1

Test #37:

score: 24
Accepted
time: 158ms
memory: 46004kb

input:

500000 500000
2 182927 1
5 313016 1
9 438269 1
10 97892 1
11 373266 1
13 314494 1
14 318813 1
20 102513 1
23 304478 1
24 162451 1
27 207273 1
30 182950 1
34 133161 1
35 62401 1
37 102023 1
38 19183 1
41 96619 1
42 264471 1
45 339682 1
46 60188 1
51 134306 1
53 85702 1
54 170539 1
55 74017 1
73 14900...

output:

1
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 1

Test #38:

score: 24
Accepted
time: 182ms
memory: 45912kb

input:

500000 500000
4 490349 1
5 377743 1
7 261998 1
14 410844 1
17 106150 1
20 477772 1
22 48037 1
24 388329 1
26 328805 1
28 248860 1
30 216330 1
34 479575 1
37 303722 1
38 392533 1
40 191119 1
42 177919 1
44 322555 1
45 306160 1
50 129452 1
51 215260 1
53 146880 1
56 441549 1
64 249852 1
69 422318 1
70...

output:

1
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 1

Test #39:

score: 24
Accepted
time: 150ms
memory: 45960kb

input:

500000 500000
9 213713 1
13 307012 1
14 327287 1
16 103990 1
23 409412 1
24 80587 1
25 91210 1
26 413674 1
28 167751 1
29 223056 1
31 395367 1
34 70127 1
38 344870 1
39 499865 1
40 91257 1
41 443805 1
43 109678 1
47 387825 1
49 328529 1
53 186674 1
59 197682 1
60 27560 1
61 402852 1
64 380750 1
66 1...

output:

1
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 1

Test #40:

score: 24
Accepted
time: 147ms
memory: 45896kb

input:

500000 500000
1 420147 1
2 70976 1
5 354943 1
6 261427 1
9 317379 1
11 31032 1
15 419781 1
16 155356 1
19 459807 1
25 72438 1
28 385731 1
30 19123 1
34 18208 1
35 332853 1
39 338723 1
41 356728 1
42 114047 1
44 389270 1
47 112208 1
48 23788 1
52 312381 1
57 317756 1
60 311741 1
61 218196 1
62 182171...

output:

1
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 1

Subtask #5:

score: 38
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #41:

score: 38
Accepted
time: 189ms
memory: 34448kb

input:

152745 500000
1 148176 489347090
8 71590 840937207
17 112259 58121021
20 48129 66917404
21 108342 551845362
25 85102 923320871
26 32280 295402544
28 113077 797188386
32 131762 774462318
34 139088 341550268
37 8599 901904899
40 13345 345650252
42 52457 628858568
47 146501 578880278
60 34292 496047355...

output:

998226306
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 998226306

Test #42:

score: 38
Accepted
time: 140ms
memory: 32056kb

input:

54772 500000
2 287 973913224
4 15940 555051196
6 621 698741465
7 38527 717887543
8 8277 404821591
10 12737 498484479
11 10330 372106002
18 12938 245133293
19 10727 864270236
21 36023 857545762
25 18178 576655015
28 23664 494485323
29 28053 163132140
30 19869 760623654
33 23134 500726094
35 17104 455...

output:

865767622
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 865767622

Test #43:

score: 38
Accepted
time: 203ms
memory: 36400kb

input:

205673 500000
1 158973 420918422
5 4496 176272031
6 62533 743641869
8 203301 611766891
9 121197 152317177
10 98777 70403422
12 183651 224318321
18 170749 851084879
23 165406 21758551
25 123292 989297859
27 223 750684145
28 113822 353864866
30 81058 302655415
33 160666 842248493
34 130477 705908846
3...

output:

999953183
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999953183

Test #44:

score: 38
Accepted
time: 174ms
memory: 35332kb

input:

180622 500000
2 47860 359098074
3 33211 725686666
5 172996 686325428
11 20367 951456596
14 85899 498654527
15 6831 213957956
16 21912 460556900
17 119474 494421069
22 159732 759571320
23 85296 428820899
25 39609 688239481
29 61831 176773793
32 173000 724530070
34 5231 756741869
38 39754 276567540
41...

output:

999765490
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBDDDDDDDDDDDDDD...

result:

ok inconveniences = 999765490

Test #45:

score: 38
Accepted
time: 144ms
memory: 32196kb

input:

68249 500000
1 13384 671650636
3 30264 533618412
9 32446 805649795
12 28255 804942860
14 2767 320695245
15 22484 341446820
19 17468 506517163
22 16941 441141000
24 21392 852608225
31 13641 703739086
34 49657 865549893
35 24439 588332486
36 24143 912164314
40 39594 179505190
42 34154 263040796
43 696...

output:

766139858
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBD...

result:

ok inconveniences = 766139858

Test #46:

score: 38
Accepted
time: 170ms
memory: 34412kb

input:

134094 500000
1 119238 998942766
3 1172 953903773
4 37532 1609112
5 60309 971560310
7 4857 320248384
10 54087 144785959
15 104645 679025446
22 78984 192988011
23 7976 279413045
24 129366 620559958
25 94691 495034481
26 43842 335040169
27 56906 896344684
29 70833 40452200
32 22836 431594494
33 116241...

output:

997704337
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 997704337

Test #47:

score: 38
Accepted
time: 172ms
memory: 34728kb

input:

178938 491002
3 65343 645340818
6 51472 449734514
10 108189 800260868
15 39120 930692195
16 63678 824934990
22 170209 226766512
33 172686 545383200
34 69423 817951195
40 110065 983151107
44 658 901974318
45 92794 276871560
49 145880 982060306
50 171291 846759364
52 134508 157515168
60 22517 40117273...

output:

999828405
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999828405

Test #48:

score: 38
Accepted
time: 190ms
memory: 35152kb

input:

176351 500000
1 147530 672087278
4 118350 841513599
8 35706 324375150
17 124680 118750687
18 27874 830111371
20 106232 635078882
21 106762 133583390
24 49101 988558987
28 71413 330254215
29 97674 619243018
32 85294 741820349
34 174690 792166884
35 25322 185901222
37 87891 539186291
38 174509 7188855...

output:

999738405
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999738405

Test #49:

score: 38
Accepted
time: 122ms
memory: 26672kb

input:

19180 500000
6 11633 298719085
7 2209 247727511
13 8037 857178551
17 14222 158623608
19 10410 825700952
24 8654 22192691
28 14336 859102425
29 3305 985979144
32 5785 833930614
43 11853 880078550
46 13298 68742144
47 15659 796201884
48 5113 180155652
53 1508 165281341
57 14406 54796077
60 11242 75115...

output:

186986643
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBDDDDDDDDDDDDDBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 186986643

Test #50:

score: 38
Accepted
time: 114ms
memory: 26680kb

input:

18763 500000
3 16406 9809443
4 10031 995677721
6 10157 826317003
9 13128 977903783
11 11241 115050497
17 4186 892926764
21 14440 836229924
22 17243 605885090
23 3162 321874594
32 5125 989779092
36 5681 995000273
38 11117 853074709
42 16630 792898559
43 2415 812950002
44 9078 787200199
54 536 5323886...

output:

219749034
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDBD...

result:

ok inconveniences = 219749034

Test #51:

score: 38
Accepted
time: 214ms
memory: 39476kb

input:

299149 500000
1 166153 326300243
8 241897 984670431
16 139620 610777186
18 108950 558886092
21 103070 30302422
22 58424 764046346
24 259781 874670330
26 115189 793360374
31 108074 65488302
32 132558 147582631
34 101203 368458618
37 92724 780477215
40 295143 818485220
42 985 591635645
46 7258 7361146...

output:

999880409
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999880409

Test #52:

score: 38
Accepted
time: 192ms
memory: 36008kb

input:

193761 500000
3 189288 946217606
6 20094 822967730
7 92462 518428854
11 53437 947859916
16 17211 706624094
20 138024 589473303
22 56423 980263697
25 53564 122928710
33 48625 23804142
38 99067 389331577
45 181401 264656439
51 122934 537087222
53 146894 705312288
58 64992 974459160
63 76135 327114473
...

output:

999562676
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999562676

Test #53:

score: 38
Accepted
time: 168ms
memory: 35892kb

input:

263505 447583
4 189734 518117294
7 231208 475013194
8 257300 806135212
10 201521 992519762
12 162764 542115022
14 5577 612354557
20 47992 246461364
24 39516 260666732
30 59381 199589811
33 236148 623932007
35 181705 722313995
36 261823 714228661
37 164951 615268447
39 215745 960175021
42 61520 48974...

output:

999973417
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999973417

Test #54:

score: 38
Accepted
time: 195ms
memory: 37336kb

input:

234138 492412
2 142678 202238773
3 37017 525717482
4 16245 84242578
7 221085 28011438
8 232129 936753195
10 172420 975744459
15 151314 796836826
16 40147 584820937
21 164328 853368936
22 68768 564205008
25 74366 517706562
35 74772 273067391
36 150709 557665131
37 56277 820839931
39 18032 47617460
44...

output:

999842825
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999842825

Test #55:

score: 38
Accepted
time: 209ms
memory: 41376kb

input:

345617 500000
4 287890 48213020
12 255973 637536991
14 130486 103174288
15 311963 848312164
17 137763 535067239
18 328059 570955643
22 175366 788052015
24 314715 123252535
33 127609 527983513
37 52132 574146506
38 204919 559291978
39 115637 484923522
41 315023 46575091
44 144120 709288694
47 127464 ...

output:

999935003
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999935003

Test #56:

score: 38
Accepted
time: 181ms
memory: 39816kb

input:

394385 440563
1 225301 443472937
3 90630 490027247
4 207545 722311321
6 81623 265264751
9 320986 773913946
11 233324 771074778
15 339644 29213916
17 118959 766333058
21 183227 301808745
22 136045 572628714
25 60192 691921256
26 118585 83877293
28 183549 814512351
32 312974 779736989
34 24728 2746837...

output:

999999993
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999999993

Test #57:

score: 38
Accepted
time: 204ms
memory: 37100kb

input:

239686 487928
7 237020 974776711
9 113929 570493241
10 72544 34843862
17 34537 197720707
18 176973 135713985
20 85882 268176730
23 52298 24770405
27 161633 136095112
28 108438 640578720
29 175014 519784558
30 182081 432162056
37 59166 862448404
41 81038 387483678
42 118521 474413441
43 222916 728216...

output:

999988787
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999988787

Test #58:

score: 38
Accepted
time: 192ms
memory: 43028kb

input:

394060 500000
1 266271 875581227
2 47509 531559437
4 80167 751980562
5 193820 292046123
6 194358 268573132
7 303355 947442700
9 167737 691672362
15 70915 648058766
16 362503 555662259
17 331794 392433315
20 337423 944836843
23 85421 6705459
26 19769 180572120
27 91697 28010304
28 224103 920839873
31...

output:

999989272
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999989272

Test #59:

score: 38
Accepted
time: 121ms
memory: 31732kb

input:

306126 343517
1 153020 134472886
6 151287 444771716
13 243112 353082191
14 204003 585901864
15 74301 536432850
17 288421 373804635
18 200231 341930570
22 46285 842728422
27 135984 296424222
28 98840 373208086
31 151557 223915633
32 70101 917529281
37 272437 430238411
43 171922 144013703
45 207267 36...

output:

999993547
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999993547

Test #60:

score: 38
Accepted
time: 194ms
memory: 37044kb

input:

214163 500000
6 14655 307604346
8 108518 447155048
9 183147 419853131
12 121238 713948197
13 158612 273313425
16 202177 225422790
19 98896 493309631
20 54878 952319209
23 132127 637870081
26 163730 433696016
28 76427 738773153
29 159195 132364967
30 160709 899921580
32 108243 850697028
35 204748 168...

output:

999376865
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999376865

Test #61:

score: 38
Accepted
time: 193ms
memory: 43316kb

input:

400000 500000
4 205440 796328670
11 310044 179952410
15 91956 580948670
18 333513 955009246
27 279570 730961672
28 223274 20986270
29 162480 525246984
30 195694 131075302
31 374912 22882982
36 73370 857746230
43 287701 413921699
45 245680 324244708
46 344614 908538659
48 175757 847664960
49 290322 4...

output:

999970357
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999970357

Test #62:

score: 38
Accepted
time: 199ms
memory: 45936kb

input:

500000 500000
1 414561 807042833
3 143567 926759489
6 198624 574337796
9 70877 569186974
11 160979 148640478
12 38276 924437410
14 428312 538809170
15 268793 673215022
22 458685 476082338
23 20910 123254013
24 29482 773856577
32 402614 543593444
33 384702 54047929
36 437448 58684763
47 324567 232869...

output:

999994855
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999994855

Test #63:

score: 38
Accepted
time: 194ms
memory: 45952kb

input:

500000 500000
4 56661 186568452
7 70811 148758112
8 477355 140902761
12 329344 476442701
13 333308 698772465
17 8139 982712112
18 151095 614675277
19 325430 483690525
21 405876 994045555
24 278510 699277267
29 380245 372527229
31 300530 183081283
34 195464 250811601
37 56315 86355022
38 335343 71582...

output:

999994689
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999994689

Test #64:

score: 38
Accepted
time: 184ms
memory: 45956kb

input:

500000 500000
1 465078 45973717
6 64797 225036807
10 208808 813802569
11 146414 838915704
18 164604 280655738
20 86088 813665573
21 145715 48043497
23 388485 813262240
32 35408 993812536
33 217231 85827847
35 176996 20667408
36 182851 373876358
37 12330 697782340
39 303991 522228767
40 429268 508726...

output:

999997036
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999997036

Test #65:

score: 38
Accepted
time: 183ms
memory: 46064kb

input:

500000 500000
1 323152 282491390
7 103804 458315826
9 47434 234482040
10 407673 548393009
15 67546 797043148
16 174235 192890843
20 28781 359740908
23 253181 861185513
26 167472 162310473
29 294152 732102492
31 14970 233593204
32 397367 672187329
33 204296 110512136
35 193624 158786997
36 468585 439...

output:

999998683
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok inconveniences = 999998683