QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#77524#5369. 时间旅行larryzhong100 ✓3332ms4568kbC++174.8kb2023-02-15 01:18:092023-02-15 01:18:10

详细

Subtask #1:

score: 3
Accepted

Test #1:

score: 3
Accepted
time: 1ms
memory: 3404kb

input:

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

output:

6

result:

ok single line: '6'

Test #2:

score: 0
Accepted
time: 9ms
memory: 3484kb

input:

101 1
1 71
1 95
1 1
1 4
1 85
1 11
1 94
1 29
1 99
1 41
1 59
1 51
1 79
1 67
1 13
1 84
1 16
1 43
1 55
1 18
1 92
1 10
1 77
1 86
1 49
1 20
1 8
1 32
1 72
1 40
1 52
1 76
1 39
1 61
1 82
1 66
1 44
1 3
1 35
1 37
1 48
1 15
1 96
1 33
1 83
1 2
1 30
1 75
1 54
1 70
1 22
1 63
1 60
1 88
1 97
1 34
1 9
1 17
1 57
1 80
...

output:

50

result:

ok single line: '50'

Test #3:

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

input:

291 1
1 1
1 243
1 31
1 188
1 77
1 101
1 20
1 177
1 58
1 12
1 201
1 152
1 89
1 205
1 203
1 214
1 225
1 94
1 147
1 100
1 235
1 103
1 196
1 216
1 192
1 143
1 6
1 259
1 215
1 51
1 234
1 2
1 102
1 17
1 157
1 82
1 52
1 211
1 176
1 264
1 149
1 74
1 105
1 202
1 172
1 226
1 165
1 271
1 78
1 285
1 262
1 88
1 ...

output:

145

result:

ok single line: '145'

Subtask #2:

score: 8
Accepted

Test #4:

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

input:

14 2
2 844974872 196961856
2 282529753 793092789
1 450615292
2 894675938 183278191
2 134804124 988858141
1 440476238
2 892091463 453193625
2 918614039 267044448
1 91126449
2 699070127 177282394
2 365458732 596469725
2 789994620 379428523
2 758349986 369167103
2 227448762 297426831

output:

392388416

result:

ok single line: '392388416'

Test #5:

score: 0
Accepted
time: 3ms
memory: 3456kb

input:

15 3
2 638683108 412097665
2 83585363 50407490
2 843046135 358173578
1 663325200
2 608604244 118346780
2 802365081 329993762
2 507345539 849824533
2 130234046 104894823
2 203433503 491790497
2 257479357 356611715
2 393337689 968844221
2 637493087 938737497
2 165665517 338554501
2 32482910 142430578
...

output:

461498682

result:

ok single line: '461498682'

Test #6:

score: 0
Accepted
time: 3ms
memory: 3480kb

input:

15 7
2 4067 4163
2 3780 4073
2 4060 4132
2 4115 4095
2 3801 4137
2 3767 4097
1 3976
1 4074
2 4141 4153
2 3965 4092
2 4080 3902
2 3863 4136
2 4153 4057
2 4045 3789
2 4117 4093

output:

198

result:

ok single line: '198'

Test #7:

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

input:

15 1
1 873331282220671423
2 735219904810912770 161751845932907141
2 25004270082210777 318839217154000771
2 674996277812508140 449008857311902192
2 472769470430097478 397080345283004274
2 47924412360460752 498222902664554012
2 564253525446680521 853694259885512872
2 656010667051096953 815344423905298...

output:

458440019518723706

result:

ok single line: '458440019518723706'

Test #8:

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

input:

15 13
2 896348312198404671 869762298
2 131322200859472553 156263978028639571
2 519956577 38
1 160595875
2 945987587 50986789140245249
2 41 241229344708873674
2 608655655392127091 41
1 40
2 806584170 50835315064131334
2 3623574246181054 976074155891825784
2 58183525 937860538
2 998266378 826367056
2 ...

output:

430005287589733910

result:

ok single line: '430005287589733910'

Subtask #3:

score: 5
Accepted

Dependency #1:

100%
Accepted

Test #9:

score: 5
Accepted
time: 319ms
memory: 4188kb

input:

287 1
1 173840701363378004
1 743361258032855446
1 746614854489854642
1 56541606566914354
1 420238720727662982
1 851742472173310082
1 663095483358412253
1 909940213272622771
1 793226013158281220
1 545752184531876147
1 428168322861170312
1 445062401949703086
1 781910693870313013
1 656624250154096657
1...

output:

449906768878285431

result:

ok single line: '449906768878285431'

Test #10:

score: 0
Accepted
time: 362ms
memory: 4000kb

input:

291 1
1 200467876183364735
1 226128802768594222
1 30992945592387546
1 131773707522781490
1 237517614711585543
1 767178437925265104
1 476367111669121061
1 569219147773036356
1 307153686500641679
1 256093763487190540
1 489553827811869668
1 665158752209826021
1 821778345278263808
1 591434397265270731
1...

output:

413750515661326196

result:

ok single line: '413750515661326196'

Test #11:

score: 0
Accepted
time: 282ms
memory: 3912kb

input:

299 1
1 196564096074155356
1 215761209458809063
1 229199188828066663
1 207442460325459123
1 147931408833032623
1 165208810879220961
1 156890061745871023
1 281031394966631680
1 190804962058759240
1 165848714658709418
1 274632357171747109
1 178006886468990102
1 183126116704897759
1 263753992920443339
...

output:

95345663143780088

result:

ok single line: '95345663143780088'

Test #12:

score: 0
Accepted
time: 290ms
memory: 3972kb

input:

291 1
1 33421439583378802
1 58525406002796904
1 59037731848091151
1 71845877980447328
1 54939125085737173
1 56305327339855169
1 59720832975150147
1 42814080080439994
1 38886248599850767
1 34446091273967295
1 80213866786920026
1 80384642068684774
1 58866956566326401
1 74919833052212806
1 674057206545...

output:

24762415855888600

result:

ok single line: '24762415855888600'

Test #13:

score: 0
Accepted
time: 321ms
memory: 3940kb

input:

299 1
1 65691845888395612
1 216175196973785149
1 60434785588469342
1 137319292474891070
1 61749050663450912
1 160976063824559296
1 86720087088100703
1 218803727123748287
1 169518786811939488
1 153747605912160670
1 165575991586994780
1 141919220237326556
1 35463749163819549
1 188575630399172220
1 145...

output:

97912748086126811

result:

ok single line: '97912748086126811'

Subtask #4:

score: 12
Accepted

Dependency #3:

100%
Accepted

Test #14:

score: 12
Accepted
time: 331ms
memory: 4196kb

input:

298 12
1 645886088791049540
1 426745180837601651
1 979147412433797722
1 922061238106952073
1 274440630526214995
1 424124977235014990
1 204894438049963221
1 764943184717907334
1 779533900124364741
1 454823872376348471
1 487382439634807111
1 591648739045233572
1 53460960257864384
1 392937311085787220
...

output:

446040287477110394

result:

ok single line: '446040287477110394'

Test #15:

score: 0
Accepted
time: 421ms
memory: 4020kb

input:

285 3
1 915828826922386175
1 908205342117914832
1 873896977912303819
1 656558831677725931
1 576889220915038574
1 104013515132123991
1 706177613718527725
1 198684931909293626
1 494902099840825229
1 89161767331355640
1 178478456398904787
1 115932633756444471
1 138418817497444484
1 414147023206092509
1...

output:

402109191950085563

result:

ok single line: '402109191950085563'

Test #16:

score: 0
Accepted
time: 532ms
memory: 4008kb

input:

290 8
1 87958755742337433
1 257381168536262370
1 937989408112804408
1 194798272982765279
1 498991322819486370
1 977524249586089037
1 912136601439828528
1 500742285087273119
1 33135176968228980
1 940337323147451787
1 646963258773910853
1 826406775797523718
1 235531045573726392
1 952251530552011077
1 ...

output:

381364661745038978

result:

ok single line: '381364661745038978'

Test #17:

score: 0
Accepted
time: 213ms
memory: 4008kb

input:

286 2
1 275543708198154703
1 249566763748953083
1 144254826792730280
1 189187919894052009
1 270629151140197641
1 194102476952009076
1 246056365850412323
1 263608355343116123
1 262906275763407971
1 250268843328661233
1 160402657126017777
1 210250307285296570
1 225696058038875911
1 150573543010103650
...

output:

99695300318557576

result:

ok single line: '99695300318557576'

Test #18:

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

input:

300 12
1 164380439043062353
1 124158335088338941
1 96965926780920306
1 64108433409456117
1 119626267037102508
1 57876839839006013
1 197804440920931095
1 166646473068680572
1 178543151703176224
1 100931486325752192
1 52211754774960459
1 177410134690367115
1 114527690479461513
1 204036034491381198
1 2...

output:

81577224922255913

result:

ok single line: '81577224922255913'

Test #19:

score: 0
Accepted
time: 199ms
memory: 3940kb

input:

298 28
1 16543256762872223
1 121361510921749171
1 207046274242100976
1 214533292396306476
1 34012965789351713
1 199559256087895478
1 139663110854251503
1 90581547398904360
1 157964710786753830
1 52314565721854039
1 183753328873461653
1 219524637832443472
1 120529620015726343
1 105555583707315354
1 1...

output:

112305272313082450

result:

ok single line: '112305272313082450'

Test #20:

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

input:

297 15
1 85560496741181875
1 17311353112525522
1 60060816704101475
1 10561437808592475
1 43936019033594759
1 18061343701851415
1 56685859052134946
1 31561174309717505
1 66060741418708627
1 56685859052134940
1 96060364991744387
1 39061080202976448
1 47310976685561281
1 92310412045114920
1 14311390755...

output:

52874336547475521

result:

ok single line: '52874336547475521'

Test #21:

score: 0
Accepted
time: 126ms
memory: 3700kb

input:

285 103
1 28285744248308508
1 23382557245297071
1 31472815800266028
1 36621162153427957
1 20195485693339633
1 41769508506589971
1 31472815800265949
1 31472815800265982
1 48388810960655417
1 31472815800266030
1 31472815800266002
1 31472815800265910
1 49124289011107128
1 31472815800265915
1 3147281580...

output:

22309500863702045

result:

ok single line: '22309500863702045'

Subtask #5:

score: 15
Accepted

Dependency #2:

100%
Accepted

Test #22:

score: 15
Accepted
time: 36ms
memory: 3508kb

input:

97 3
2 355271459380040532 547563913925852132
2 501938321780836726 747940481178452472
2 397422061492707294 74967044201975790
2 377923940791121468 378164526846394284
2 264704309452054653 529171612856996754
2 316250711337645385 284323194941392101
2 358629778571158126 368864454575116270
2 38360271038026...

output:

372997432997019308

result:

ok single line: '372997432997019308'

Test #23:

score: 0
Accepted
time: 41ms
memory: 3500kb

input:

95 3
2 594630321920106655 540002493103501660
2 125138319916363529 212072562657897457
2 373817802718383543 13665937791620288
2 315045821144016344 338252361890399510
2 483343425646600556 466582885679461518
2 278197329086017453 428516032353992829
1 59661599996472250
1 254583199582888328
2 4365367002001...

output:

340047122337218325

result:

ok single line: '340047122337218325'

Test #24:

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

input:

97 7
1 24243537937597964
2 582465432759982368 381373957332513395
2 391506769288663264 391876487817869396
2 299551892852869811 107731633859975720
2 156125257586893617 386175789126201813
2 213724291907872015 7697465108273724
2 393633870223728807 256416638715125266
2 290510273528299134 2903854981034601...

output:

333882379519018440

result:

ok single line: '333882379519018440'

Test #25:

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

input:

95 23
1 344791905917209572
2 500083441805144564 509549936981982064
2 329347121414961283 362188436612461360
2 104614943880747675 52960311801613673
2 617606793494520742 33376598049670497
2 342392895594188447 343263248105091839
2 322740972473445196 399001118836944088
2 263495523699786974 33004821266770...

output:

342055752596049500

result:

ok single line: '342055752596049500'

Test #26:

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

input:

99 55
2 89904938987641376 194722167738160343
2 365265714020104046 364275631130776282
2 357172107220911532 357175936070256675
2 366602422140587285 355364788434700731
2 361062739069662108 366182699259043884
2 337340987023855575 362758639984591817
2 356267270889109816 368009872611506605
2 3024813222427...

output:

364338868647435728

result:

ok single line: '364338868647435728'

Test #27:

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

input:

97 1
2 91117126161960832 152612010977891961
2 92648119158704985 151081017996819264
2 89586133179453808 154143003954271449
2 158480817402063313 85248319729017232
2 98516925587766625 145212211563875680
2 143681218561699334 100047918559918464
2 91372291675484725 152356845482241792
2 42496577125387271 1...

output:

48991775437581466

result:

ok single line: '48991775437581466'

Test #28:

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

input:

99 7
2 98167144235383792 162846238547509242
2 110279334179192048 150734048597100487
2 100105094626393120 160908288150903547
1 103496507811808992
2 113670747363458352 147342635414727615
2 155578924576512119 105434458201668736
2 114881966366627512 146131416432864448
2 143224490830472185 11778889194435...

output:

49417734962138572

result:

ok single line: '49417734962138572'

Test #29:

score: 0
Accepted
time: 73ms
memory: 3668kb

input:

97 9
2 54431100011379795 123163200193479616
2 76135973755564686 101458326453569856
2 114963581215047218 62630718965509088
2 113998920169962160 63595380028205758
2 66489363185937488 111104937001685664
2 112551928586934876 65042371606848045
2 119786886500604768 57807413693802295
2 117134068599060240 6...

output:

48715383286150883

result:

ok single line: '48715383286150883'

Test #30:

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

input:

99 25
2 106010712580746813 121015703886102576
2 100887057019501060 126139359431213171
2 120771720272231650 106254696174568800
2 123333548053805727 103692868393393504
2 99789130823331506 127237285640385408
2 100277098028296147 126749318429244132
2 47759708926726656 131506998592303065
2 12418749064706...

output:

27082179393946704

result:

ok single line: '27082179393946704'

Test #31:

score: 0
Accepted
time: 38ms
memory: 3516kb

input:

97 45
2 60136866605811552 124345544107147019
2 76594686469603390 107887724253254560
2 69408877811642167 115073532918614193
2 112291929565404383 72190481171528075
2 75203884789228032 109278525930449428
2 113914531507888702 70567879194386446
2 77753687885725021 106728722854530224
2 62918469962749976 1...

output:

55168466576040844

result:

ok single line: '55168466576040844'

Test #32:

score: 0
Accepted
time: 42ms
memory: 3636kb

input:

99 5
2 198135106606661855 113916402567297699
2 48120191860754846 293410793355960751
2 94941794543868424 20417673785789215
1 226217845720159620
2 73684573953683624 17570909162001220
2 101022587365517836 196966396107737257
2 92243699696770229 40192370826192154
2 231607253778443314 80159020488470828
2 ...

output:

168539672203603029

result:

ok single line: '168539672203603029'

Test #33:

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

input:

95 3
2 50213096412115275 103975930702601995
2 97337964450805816 52911609072878411
2 117019404580474190 114025828858917779
2 68255057774800636 33171864123352472
2 170782259210777541 8977948292011175
2 117937890322882815 124616648634050928
2 155488867905104901 231131932024847380
2 33763780676475410 13...

output:

167986301522260786

result:

ok single line: '167986301522260786'

Test #34:

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

input:

97 9
2 183888672937660637 30553903041146403
2 26197600647874261 87569599505429025
2 79122891657061301 43560019083754841
2 174537878354732366 25842168242849089
2 256946649950496002 45156982881291173
2 177513401227386667 60176368310826634
2 259839002603971882 83808389793977724
2 127533091953826330 190...

output:

188080092526197682

result:

ok single line: '188080092526197682'

Test #35:

score: 0
Accepted
time: 24ms
memory: 3480kb

input:

97 11
2 179169235362173901 197851068898330160
2 110092684659314938 38263031223051509
2 271561202603146920 193668015553789322
2 137293773808224547 96546099567205926
2 106034584983483180 120406372225155512
1 209157017448366887
2 198420117636462395 56078492848670786
2 32278873506739235 8910442247556405...

output:

176745142904935557

result:

ok single line: '176745142904935557'

Test #36:

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

input:

97 83
2 3058210112348103 251656328569775857
2 159979467084234473 14653211943110880
2 76647717823732513 16261613594275528
2 38738564467155027 180450713596174741
2 49378591649363047 81990160674878691
2 70059707062311627 43810417369623980
2 146798765491272833 66669774091202626
2 59887191859459332 21054...

output:

164989133334695959

result:

ok single line: '164989133334695959'

Test #37:

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

input:

95 3
1 79746836969422427
1 42391428648545948
1 88875953530675857
2 88841916692095381 137627653936820508
2 712052024007309148 333423189903908250
2 986954048764504050 128101575472945186
2 230622076265569785 572057638300385894
2 528803236876069800 659146479704153761
2 7538214892502187 1171687065730782
...

output:

493465914306706541

result:

ok single line: '493465914306706541'

Test #38:

score: 0
Accepted
time: 53ms
memory: 3600kb

input:

99 7
2 655813374949405866 823577592729353044
1 640042878929844449
2 695642933493784371 945344536691197960
2 541964275561186574 7430765146141955
2 39312995416278820 627166137018189317
2 629262138849170590 286213175761499517
2 348709480000878755 401714233242657861
2 654694573696082390 3124050086905211...

output:

499287770269278734

result:

ok single line: '499287770269278734'

Test #39:

score: 0
Accepted
time: 50ms
memory: 3560kb

input:

97 9
2 475518932525346244 343403718312668543
2 879231240161276859 10450928184363035
1 105804198533526150
2 610676660756860171 204196709613629013
2 422878093774396458 61610978468941477
2 482420390241772890 733073164585000299
2 244803056545563584 8188923919910582
2 900521888056791479 45475387423808153...

output:

492740313054335165

result:

ok single line: '492740313054335165'

Test #40:

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

input:

99 21
2 647804602481517176 415705130952528606
2 337297773077441698 459345775513725917
1 651747956168927564
1 346840608178513093
2 43032416133085083 971214472621300347
2 509801562927695174 60076272302632014
2 938067487641306760 579154632324366305
2 137031321641654131 353732664563203692
2 121904481290...

output:

490601692536600317

result:

ok single line: '490601692536600317'

Test #41:

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

input:

99 35
2 91182147626737794 95766028528018665
2 15832534471368700 78849240629511181
2 72744761231271027 588978061306441444
2 249424250283220487 518174250150106785
2 696855615852331379 665858146558163461
2 72245644754216308 856062009968434543
2 26104920612852352 621858855883079202
2 32258629809556553 9...

output:

495063067687704945

result:

ok single line: '495063067687704945'

Subtask #6:

score: 24
Accepted

Dependency #5:

100%
Accepted

Test #42:

score: 24
Accepted
time: 230ms
memory: 3768kb

input:

197 3
4 254449407090124613 112140590900425972 309238953726281947 391489935037483281
3 81718890371981946 311720329125105766 510862207453246006
4 432686156999435021 349733674175878549 398194808015575569 566023817519883042
4 181267378904922445 380086723415223853 539271538418079357 59944569356014918
4 6...

output:

348401785162894785

result:

ok single line: '348401785162894785'

Test #43:

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

input:

195 3
4 635658816149515072 414784031822529380 235575829086519156 722024027837159722
4 685532441247379256 422173233659879849 196867289647634556 318992902069434291
4 329332282130228074 274053270170222304 579395260339205782 296441225948542074
4 749921202609862512 680831611407491744 190087527660350902 2...

output:

407796848009069436

result:

ok single line: '407796848009069436'

Test #44:

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

input:

195 9
4 470228449192346220 386508039486696031 421329369340339430 411690053206516239
4 711063085634537182 817498317354768547 686412818064878023 279101510288191687
4 263327768153388487 121862888534106607 619177823276544139 454235321494824970
4 441896159625445657 429507402614835116 354807719574031013 4...

output:

428029571932857784

result:

ok single line: '428029571932857784'

Test #45:

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

input:

197 21
4 365159629819060661 391632520517667346 396780443151824676 446153437812790722
4 408380654739889093 545518153622191116 505375948153736732 488032836798937441
4 172134525442701654 426624656444075608 427932857208579686 667591650754120366
4 281008795447393282 621679351030195089 521755858043719192 ...

output:

419094132948443444

result:

ok single line: '419094132948443444'

Test #46:

score: 0
Accepted
time: 212ms
memory: 3620kb

input:

199 55
4 14779418048476436 87621886119921428 246067195034920528 552824057876417836
3 338180081618674723 337615749075511470 334520468218137005
4 432408261794346346 66605512917765975 533321258660178959 519972524105851946
4 405496523021625552 52003223821151316 239486105393539243 139215119565631212
4 33...

output:

334282905626124092

result:

ok single line: '334282905626124092'

Test #47:

score: 0
Accepted
time: 654ms
memory: 3820kb

input:

195 1
4 113068927731146016 78075004957272898 72406973977896446 88810539240393028
4 92166874434460992 72639993775471660 103228510650728079 112835907938941536
4 111088259497407888 104651775075684131 84056589440816868 74387642223208366
4 117962343367440224 67513558352823171 89437590103891815 7833031478...

output:

45438859499874760

result:

ok single line: '45438859499874760'

Test #48:

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

input:

195 5
4 133355510617483952 182357665750007016 169970629612999407 147113676535318522
4 219736053839377387 115601922976307591 95977122529690160 148547004350725054
4 140709276777251026 104182134548961968 169142372390955774 211531041818749066
4 191246428773457248 130413968298066889 124466747610042521 15...

output:

89799298214287583

result:

ok single line: '89799298214287583'

Test #49:

score: 0
Accepted
time: 930ms
memory: 3820kb

input:

197 7
4 88329823571872548 84905471007481573 154172774574444933 80551398261119120
4 56766030548013360 95766766190782403 130108320313745356 177958142325425888
4 95399923766459756 59484358270141144 82218928475388455 175239814584263745
4 66506704933800464 168217467916792402 140078729535415719 7064281378...

output:

90610924694238396

result:

ok single line: '90610924694238396'

Test #50:

score: 0
Accepted
time: 1051ms
memory: 3880kb

input:

197 1
4 128676558299309975 67437711882779408 84994692557364995 89320620963490413
4 137686411564761472 106881401211830541 58427858624409633 109029261210856330
4 131914474317985392 64199795874145420 78518541013376892 125289299746853088
4 127972663512349992 68141606668971616 88588927888669357 741447573...

output:

55466909171945744

result:

ok single line: '55466909171945744'

Test #51:

score: 0
Accepted
time: 191ms
memory: 3944kb

input:

197 1
4 175781012644154975 83724114765857506 53359260603685522 78457281369507580
4 164521702616230300 93371388856770774 104678818065475254 242003713322001385
4 142943644359650742 88894403123095174 86300717180148405 194569371941966183
4 164759974838206479 199545805848627932 148442179010935961 6119636...

output:

190511067421745345

result:

ok single line: '190511067421745345'

Test #52:

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

input:

197 3
4 228722917253214879 178645538940135100 53184827431280686 75922680709045456
3 209444931756587237 90098981664317715 191759863934844207
4 220931376987049159 47628494345449369 78243951962733798 173437077468129994
4 39794738205531364 68496167775967961 121367883658023224 200973377311937816
4 224627...

output:

199159617467199734

result:

ok single line: '199159617467199734'

Test #53:

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

input:

195 9
4 4183008862403622 113931457542662976 11457299524633341 47560505127455599
3 235124374434474448 172821936191608621 98792772175905424
4 138845753934697113 129203329489925731 122786177553192695 56829025243828171
3 192273182821683199 114667335562817127 38943116079195946
3 236725520351537714 183144...

output:

189575229799626200

result:

ok single line: '189575229799626200'

Test #54:

score: 0
Accepted
time: 241ms
memory: 3900kb

input:

199 23
4 1757883406123248 160843300413954311 205689975369462087 173732403694644846
4 164339426751760712 63193552627644393 62943558908435240 200960649610206867
4 87021333026151941 190634091209845130 110645343261797435 216294166796560480
4 167646136264589946 190982751721016955 194777923484817750 23426...

output:

199146124865627690

result:

ok single line: '199146124865627690'

Test #55:

score: 0
Accepted
time: 392ms
memory: 3976kb

input:

200 6
4 973535107404784538 33676887664519133 867085566386066175 405782756942916882
4 43650743891542820 797835292364191382 388839742522913128 428328038410277783
4 452839681408073761 677376300409733506 588117389413869793 933406390834385021
4 482976988585057762 734797412061155741 161321481968428694 195...

output:

496674521317928922

result:

ok single line: '496674521317928922'

Test #56:

score: 0
Accepted
time: 191ms
memory: 3856kb

input:

197 3
3 663861171757350090 467866336790220128 122922569882019546
4 474414948787668454 365143364562010210 448214034667452608 364984947173146216
3 238227215005501406 875625508149053580 229883042721565584
4 388615185192465507 190739932365714699 81281777782731580 288676928235173736
4 274872730119804646 ...

output:

475662465480493529

result:

ok single line: '475662465480493529'

Test #57:

score: 0
Accepted
time: 200ms
memory: 3824kb

input:

198 2
4 130712898686437766 114041440354982602 9163270208133536 8055754113668528
4 190114562189656488 195469248623135180 196763890530178534 262818385765052707
4 57636618370417804 191971390324366143 235460308848913601 197959747557191639
4 53160200580769586 96339335623975275 246288781846241562 79361283...

output:

193615939751805410

result:

ok single line: '193615939751805410'

Test #58:

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

input:

200 6
4 75809557785451108 241385934207239277 47013544475659783 114592476156233374
4 189500915915024256 252572165755689314 216262125986863605 238513810200388845
4 56019953431039397 240297673575274818 46370668707865674 6346930086105277
4 182407107272421592 80692103359816730 175802707093639415 20047656...

output:

189499427352274670

result:

ok single line: '189499427352274670'

Test #59:

score: 0
Accepted
time: 467ms
memory: 3916kb

input:

195 7
4 13542743344712157 653719704962931567 837983120194868823 508574736554357163
4 371206839048768647 426918906629232343 159449945416947929 341862407187784597
4 406967240667675980 725770289330856925 168912721864522166 451619587979945134
4 837001652094564567 151619501792427675 686545363880964815 64...

output:

497385873293229513

result:

ok single line: '497385873293229513'

Test #60:

score: 0
Accepted
time: 403ms
memory: 3924kb

input:

196 2
4 236090247564838532 100930659373813666 27480451267195914 724244768973812497
4 804531596063192042 890262742109472642 488291547892310904 928873111444141208
4 25563379148945939 429238013944021538 660619137581559804 170279426373165816
4 602206385853132029 904123747138059679 67088318799310096 7149...

output:

498675056525254441

result:

ok single line: '498675056525254441'

Test #61:

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

input:

198 2
4 596507052629042807 589276828513019210 654828192510239082 98537174524253227
4 995947842579774994 625879685206550216 149861341989897997 156955318893594633
4 722327381425769368 191739718971763761 125179745260694813 992252917623528306
4 911876883361171119 91354640733813890 799418243461851641 465...

output:

499586866335215177

result:

ok single line: '499586866335215177'

Test #62:

score: 0
Accepted
time: 235ms
memory: 3952kb

input:

200 4
4 629487422829240925 440175701742494764 473839430881357991 700038642240679020
4 159203156555593211 4820783742574378 499454018353349610 173001774785489330
4 502530529436617334 252476703366252976 444109879595575957 753957725463450558
4 505317680768355790 996418448372405084 218000185993068535 387...

output:

498932536211070753

result:

ok single line: '498932536211070753'

Test #63:

score: 0
Accepted
time: 442ms
memory: 3984kb

input:

196 6
4 768846090785134100 381770729939802656 738635131138632184 656845867148572351
4 651025246683393750 649955103436117842 111965421524076987 349119670491174871
4 178393614657072521 625007651637639491 12882705696412179 936048811074968521
4 102358819614454618 974917056117029708 362697910533794622 73...

output:

498912979654378436

result:

ok single line: '498912979654378436'

Subtask #7:

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

Test #64:

score: 33
Accepted
time: 741ms
memory: 4168kb

input:

299 3
5 413882564982704819 263780367360303220 301408687583628740 493712386428611889 578889085916323938
5 20152258400972757 436922774396916830 487198011785060259 334603399523443961 384759312399792603
5 315508814182006536 483587968502384127 416749337699096214 321439838800882217 328328903358320066
5 37...

output:

356418476631954524

result:

ok single line: '356418476631954524'

Test #65:

score: 0
Accepted
time: 473ms
memory: 4332kb

input:

299 3
5 774819411505636898 746438340347481680 299348938349907740 250470018457098165 333271391114601735
5 377080337506047823 492048787429597224 583709052864912775 782231544220776661 197587369983035061
5 507896943798889470 329501847773236819 607084494298044827 344489771692243386 389090267227721896
5 5...

output:

469684645016946658

result:

ok single line: '469684645016946658'

Test #66:

score: 0
Accepted
time: 613ms
memory: 4312kb

input:

295 3
4 365425736390183724 263516828179805394 428352796135558626 510062270269514397
5 229936593989308864 310849558516736324 375693580024997487 338491150832158351 515288476756522168
5 738542938876647502 187978993543693430 62734389005564287 156381634088995587 136803038271054103
5 22723282399533477 805...

output:

417513630092928975

result:

ok single line: '417513630092928975'

Test #67:

score: 0
Accepted
time: 540ms
memory: 4448kb

input:

297 7
5 520942779539230375 535721604746799434 267301180318113690 610698999496298041 541952401676327344
5 202236301078620102 255419175160581917 274022663315431652 337092039716213202 307572105241179594
5 435490174433984730 662965531721778592 619617788499276990 333115711017869017 216601713670399464
5 1...

output:

477528036784124532

result:

ok single line: '477528036784124532'

Test #68:

score: 0
Accepted
time: 605ms
memory: 4164kb

input:

299 23
5 507583385131863050 310569672641013879 77028100190860450 515718404999638905 312055869449440556
5 361081858606393235 362073868783909846 350491100929939701 368065579555269876 359541407699989010
5 188902627969793240 338666829622761095 89892787428039855 421263435524907904 500414645117949172
5 71...

output:

358249960019063963

result:

ok single line: '358249960019063963'

Test #69:

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

input:

299 63
5 400067195814562546 318507709833652755 286446264758722406 189965062966399494 847536628276718380
5 215819107880570982 51197998143060516 331897845244032946 367141784681206643 450205762290666618
5 462335582423499226 462073000987489885 461987917875335955 462061504103215478 462178773345144280
5 4...

output:

458148785309647347

result:

ok single line: '458148785309647347'

Test #70:

score: 0
Accepted
time: 324ms
memory: 3760kb

input:

295 155
5 353140310585149670 355181467943794065 351690565405562894 356379441029606915 355403882974026727
5 353053553239485105 352471198648580316 355496074565470911 353519533940457099 355902186222423007
4 287903580299176462 77340390018795313 30822097115567228 317762981416783354
5 582717362634111199 3...

output:

357142169328251572

result:

ok single line: '357142169328251572'

Test #71:

score: 0
Accepted
time: 304ms
memory: 3768kb

input:

297 205
5 434193082390790134 423106166978678463 414935802814331610 428075567784172628 429690766653678982
5 416772485072929908 449365807187385133 431324730796888536 429265081810094700 423421578070319344
5 425208322835194609 428106654648698909 434381597690485766 433038440826973953 438222801592430784
5...

output:

442252255864782316

result:

ok single line: '442252255864782316'

Test #72:

score: 0
Accepted
time: 3109ms
memory: 4212kb

input:

299 3
5 169499257663615541 172165359807484504 133333973016770204 151672803809852538 75862254060648032
5 144028994269288560 114726575422454881 113870291350936150 103998619627482174 131958403981322749
5 149016804526993984 121781746080613976 141036150912214544 99010809364788055 103520064662811008
5 108...

output:

76735542428763898

result:

ok single line: '76735542428763898'

Test #73:

score: 0
Accepted
time: 2756ms
memory: 4228kb

input:

299 7
5 188298186653073699 262223665818418727 157260360422219001 262275057210092880 153090161961719776
5 300079394510839548 115285824660971008 229944519388636951 211639838832785184 279779142230023337
5 289633459189010767 204537575780376060 125731759967756848 181435005122892116 177394067262785263
5 2...

output:

150222498224385864

result:

ok single line: '150222498224385864'

Test #74:

score: 0
Accepted
time: 2742ms
memory: 4352kb

input:

299 7
5 134015671171134805 96191447653412112 145146124322572098 230313237046787448 174630940784411017
5 220405471492244832 142226938845274854 106099213233464592 177760192474084287 146835158032930136
5 120310408359469354 186934809571031853 171931166284503590 211965523040116394 114539161659148112
5 97...

output:

110820192597210400

result:

ok single line: '110820192597210400'

Test #75:

score: 0
Accepted
time: 3090ms
memory: 4144kb

input:

299 5
5 177970202681147496 146376540919229586 92837383354401264 120789418835855749 127155364932177203
5 177284569253288640 144215305530132799 93523016800377864 115433067210383537 177120630913332435
5 130097047019398586 180979738657652335 84952598745953056 144354836002701398 185854987289047579
5 1139...

output:

68791888905580968

result:

ok single line: '68791888905580968'

Test #76:

score: 0
Accepted
time: 3332ms
memory: 4328kb

input:

297 13
5 110537912334202940 225396952909767680 168368659060587731 136181659242600622 166593525361779062
5 174635800616694974 175576533950549267 102963089998912304 232971775229523023 142966137318258008
5 117848019001982016 184843203135125401 147599118935824888 229107069948512355 106827795266931728
5 ...

output:

93680455698693385

result:

ok single line: '93680455698693385'

Test #77:

score: 0
Accepted
time: 630ms
memory: 4252kb

input:

296 4
5 98347569847796867 4517647665450802 30342051961411153 134740274585767271 76547548867783855
5 101147670266439165 397839926752926235 90310780109233231 213115971105101402 45309729786856819
5 193353739900373870 76912015388450287 45551183805287699 54037992214072284 210334661609157680
4 96623033239...

output:

198828041252865810

result:

ok single line: '198828041252865810'

Test #78:

score: 0
Accepted
time: 997ms
memory: 4264kb

input:

297 1
5 167917643162061422 121138795736041134 152468422071959278 53291230495461823 150284462503643011
5 107077811503354461 51051420263129359 207629208269696465 18604260821477488 53468535106214822
4 7110700077316535 230295001521855897 282690246216548 40581183836753969
5 49748589406824541 226430953737...

output:

193297298943632083

result:

ok single line: '193297298943632083'

Test #79:

score: 0
Accepted
time: 2144ms
memory: 4356kb

input:

295 1
5 95984338662972774 753477241290185072 749382284267371409 76685467181840587 78368982893963194
5 602908548842858564 822638820543691098 107487435096646531 388561677293276557 331499246744713714
5 666980948594978019 220646571198860123 85141025662590390 178065775009435677 628525600709255458
5 28570...

output:

498059759763891921

result:

ok single line: '498059759763891921'

Test #80:

score: 0
Accepted
time: 2425ms
memory: 4384kb

input:

295 1
5 200782591014712181 572677061049390329 179252406078579379 51426914486555669 176548817693117469
5 38844130795740122 24521657315161694 903496531660282727 633458739692625285 268828646736525443
5 489077017989143083 38120374467746472 143235173580686790 35531180837859031 43027131910895740
5 3049002...

output:

499327237199180005

result:

ok single line: '499327237199180005'

Test #81:

score: 0
Accepted
time: 1546ms
memory: 4384kb

input:

295 3
5 886303329206259582 715474999765638950 64163409361834662 372868349372215774 286022202655459084
5 855224711878665651 159288140294937951 625044700284038307 21100971773590928 787882552342590469
5 694318323904825783 877333396764013976 361250758783704744 580647341280675292 13428624722519041
5 7320...

output:

499440309735573311

result:

ok single line: '499440309735573311'

Test #82:

score: 0
Accepted
time: 593ms
memory: 4256kb

input:

297 7
5 600127031820714852 35460793022639190 198148830091637857 88749152278698253 86569819599229194
5 391041085858649153 383920976807454559 399896344586618143 375914390983484052 397034386606433722
5 404354521919451211 359023040290466096 424224767107131156 336594652637517592 342168590802524928
5 4315...

output:

386588220806019347

result:

ok single line: '386588220806019347'

Test #83:

score: 0
Accepted
time: 377ms
memory: 3820kb

input:

299 233
5 411097191134969669 406986218733925235 417979224388003666 430832854145524638 407560581872317853
5 435546634166162976 410823254603798818 420275980678903091 434510622234981494 436274944400487117
5 423209349079414223 416602870075674131 418006702464307853 433837288676256090 438228137416466897
5...

output:

437148061973143752

result:

ok single line: '437148061973143752'

Test #84:

score: 0
Accepted
time: 577ms
memory: 4116kb

input:

298 4
5 98879762087692849 195319237838959354 85683472652223535 35069041572589282 89279379896807668
5 178842765879250755 27448712526020083 179291066167597516 267666955447961248 12949882634773260
5 21004806971686967 150325645843932675 116306274903859691 21219215122098733 239009924730293913
5 673949611...

output:

194454460286284336

result:

ok single line: '194454460286284336'

Test #85:

score: 0
Accepted
time: 525ms
memory: 4184kb

input:

297 5
4 46689989315932095 86695183929839224 141640698675825447 145723835035807860
5 270632360852326716 1025989307643110 235248919561395230 220081091862889292 146211668410362935
5 208104368958357431 61286643033846258 71772795478485906 6895726054058055 147129726714018355
5 126349619046744205 214187723...

output:

199621790602783643

result:

ok single line: '199621790602783643'

Test #86:

score: 0
Accepted
time: 753ms
memory: 4488kb

input:

295 1
5 229786342021863892 788842118057453427 476610842739000346 88450222494240109 279714642478759507
5 481614666554872102 469798375751862120 470342413330778712 465024808521166244 461119808534927674
5 284699110399979714 356872123847305017 323660785566979485 396047636610268178 568231011878445064
5 44...

output:

460091596483976492

result:

ok single line: '460091596483976492'

Test #87:

score: 0
Accepted
time: 495ms
memory: 4444kb

input:

296 6
5 169962635708285053 214940996268750438 104432382019165246 294185699647654773 53519256723241174
5 241597902839476240 202035503425907436 49564834657243178 262438878535418766 111123070839757567
5 170352648952150707 35549747387068498 201318653765848709 225696422672259581 182110491201706124
5 2484...

output:

192950814828343460

result:

ok single line: '192950814828343460'

Test #88:

score: 0
Accepted
time: 1247ms
memory: 4568kb

input:

299 5
5 243876796118894462 652459127962270192 291648601060087248 999846980641949566 260070508064975384
5 875621643855697216 23198606063885516 725372864883310753 97522161543106181 313290915052072575
4 55228782658799625 661729515773780588 165321357332013501 931957899669992290
5 268494859077678847 9583...

output:

499694739398770867

result:

ok single line: '499694739398770867'

Test #89:

score: 0
Accepted
time: 2137ms
memory: 4392kb

input:

300 6
5 300293917641873720 676344515622158275 307740517541455087 170341122771802084 695648550952155216
5 573463288719920329 272379975232816139 104034237624652123 441454007489980018 190071985195637355
4 609941370543382274 489460565508626687 681010212309078470 738383553532773109
5 284867831469045814 6...

output:

499295087217871580

result:

ok single line: '499295087217871580'

Test #90:

score: 0
Accepted
time: 1068ms
memory: 4552kb

input:

298 4
5 201455984036905783 115550052430726139 149977319310274828 306885353598956736 479326477635583201
5 991062302564287930 690492827924912028 372673422682623685 277637093143933018 665343495725280432
5 530484142668425031 808626644130527416 378940995835266163 962072301340539287 815752811531013930
5 7...

output:

499543806911343060

result:

ok single line: '499543806911343060'

Test #91:

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

input:

293 4
1 58251959049023896
1 932403919620983314
2 633735179743947808 645049925198446249
5 618491989188702212 551483704216846282 661251571736713262 949373324830007470 101172615909742573
5 393903323052584001 472735538497522606 126067051089421013 48233635354577481 21950808191835795
1 152409152904260621
...

output:

Impossible

result:

ok single line: 'Impossible'

Test #92:

score: 0
Accepted
time: 1022ms
memory: 4384kb

input:

300 4
5 643752524502339986 982874853111978514 751290625523232330 227331362984170247 991210134122390881
5 372625599593064780 684324418742448021 19459795614350612 53757187476969948 80676999246795307
4 305537347077014371 731971006008312047 128489548973068901 537561719037561746
5 53652772519149857 28421...

output:

499173993909989988

result:

ok single line: '499173993909989988'

Test #93:

score: 0
Accepted
time: 1205ms
memory: 4408kb

input:

300 2
5 936363727513713021 790050262312822697 349258370368677617 187260412553313725 297652759269254326
5 155144991613805927 936473715363022150 428783020312518532 982186028160167512 326268014647733590
5 741490862777769287 567785192326977604 615978296373483474 289609064322442227 980992835758954952
5 1...

output:

499788501949744427

result:

ok single line: '499788501949744427'

Test #94:

score: 0
Accepted
time: 1335ms
memory: 4408kb

input:

300 2
5 84571683741315711 871980484190787010 364973090884843673 555419919050316604 740738363066889566
5 671395625442283262 901136719215724816 537699389473298177 151553728826890813 903772935495595290
5 126569104167659644 488157635551406256 46281303737647227 750298204483322387 450111568346238378
5 258...

output:

499242499224863319

result:

ok single line: '499242499224863319'

Test #95:

score: 0
Accepted
time: 1304ms
memory: 4468kb

input:

300 2
5 124406121994710072 621380629720149914 334935125433687914 734569441827422510 132460058697255706
4 301374495434932888 294073831583256152 96134127668128740 208267020921323732
5 104691123168493971 554524996749199258 250163025585004417 743183907789164353 127942595639943439
5 840938809246319118 79...

output:

499456718361147955

result:

ok single line: '499456718361147955'

Test #96:

score: 0
Accepted
time: 1497ms
memory: 4376kb

input:

299 1
5 238028492456120202 467473550245124904 71504029208301147 500906115704874007 270531428131010662
5 126925016564316205 89570306948749283 213239139994410260 52593940040806433 69352307979025504
5 580459219158264283 843332752134484612 522535632437417847 615832060615405508 61175322664963059
5 101805...

output:

499024577113969197

result:

ok single line: '499024577113969197'