QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#534203#6659. 외곽 순환 도로 2GuanYunchang100 ✓34ms51924kbC++141.8kb2024-08-26 21:57:042024-08-26 21:57:04

详细

Subtask #1:

score: 6
Accepted

Test #1:

score: 6
Accepted
time: 0ms
memory: 18704kb

input:

5
0 452912
0 820899
0 79369
0 232463
1000000000000 1000000000000 1000000000000 1000000000000

output:

532281

result:

ok single line: '532281'

Test #2:

score: 6
Accepted
time: 0ms
memory: 19376kb

input:

6
0 581451
0 68556
0 918465
0 661406
0 41816
1000000000000 1000000000000 1000000000000 1000000000000 1000000000000

output:

1000000110372

result:

ok single line: '1000000110372'

Test #3:

score: 6
Accepted
time: 3ms
memory: 18652kb

input:

4
0 0
0 0
0 0
0 0 0

output:

0

result:

ok single line: '0'

Test #4:

score: 6
Accepted
time: 4ms
memory: 19832kb

input:

5
0 938777585449
0 576051802364
0 418735407836
0 823692221300
233950071687 338912182863 866023804654 680391493800

output:

1333076973323

result:

ok single line: '1333076973323'

Test #5:

score: 6
Accepted
time: 2ms
memory: 18156kb

input:

6
0 938777585449
0 576051802364
0 418735407836
0 823692221300
0 233950071687
338912182863 866023804654 680391493800 876313612238 476765859230

output:

991597662386

result:

ok single line: '991597662386'

Test #6:

score: 6
Accepted
time: 20ms
memory: 41848kb

input:

99995
0 573954
1 101503
2 350026
3 832411
4 311022
5 583957
6 894954
7 223392
8 287704
9 259600
10 964702
11 24863
12 831166
13 754666
14 96743
15 606341
16 198920
17 262280
18 610409
19 193417
20 192417
21 194438
22 244016
23 680809
24 106449
25 249873
26 41805
27 375383
28 927874
29 148386
30 1354...

output:

3

result:

ok single line: '3'

Test #7:

score: 6
Accepted
time: 12ms
memory: 36192kb

input:

99995
0 573954
1 101503
2 350026
3 832411
4 311022
5 583957
6 894954
7 223392
8 287704
9 259600
10 964702
11 24863
12 831166
13 754666
14 96743
15 606341
16 198920
17 262280
18 610409
19 193417
20 192417
21 194438
22 244016
23 680809
24 106449
25 249873
26 41805
27 375383
28 927874
29 148386
30 1354...

output:

0

result:

ok single line: '0'

Test #8:

score: 6
Accepted
time: 17ms
memory: 40356kb

input:

99995
0 573954
1 101503
2 350026
3 832411
4 311022
5 583957
6 894954
7 223392
8 287704
9 259600
10 964702
11 24863
12 831166
13 754666
14 96743
15 606341
16 198920
17 262280
18 610409
19 193417
20 192417
21 194438
22 244016
23 680809
24 106449
25 249873
26 41805
27 375383
28 927874
29 148386
30 1354...

output:

3

result:

ok single line: '3'

Test #9:

score: 6
Accepted
time: 12ms
memory: 35480kb

input:

99995
0 573954
1 101503
2 350026
3 832411
4 311022
5 583957
6 894954
7 223392
8 287704
9 259600
10 964702
11 24863
12 831166
13 754666
14 96743
15 606341
16 198920
17 262280
18 610409
19 193417
20 192417
21 194438
22 244016
23 680809
24 106449
25 249873
26 41805
27 375383
28 927874
29 148386
30 1354...

output:

50

result:

ok single line: '50'

Test #10:

score: 6
Accepted
time: 0ms
memory: 18044kb

input:

7
0 1
1 1
0 1
0 1
4 1
0 1
1000000000000 1000000000000 1000000000000 1000000000000

output:

0

result:

ok single line: '0'

Test #11:

score: 6
Accepted
time: 21ms
memory: 37836kb

input:

99995
0 800351
1 590567
2 404564
3 601685
4 802526
5 784654
6 558749
7 760258
8 655714
9 864130
10 678664
11 983868
12 396629
13 637742
14 592018
15 810308
16 889529
17 914966
18 623197
19 97239
20 448357
21 67877
22 785864
23 177614
24 242659
25 301722
26 5175
27 418269
28 213547
29 417295
30 80595...

output:

1000000000000

result:

ok single line: '1000000000000'

Test #12:

score: 6
Accepted
time: 16ms
memory: 35660kb

input:

99995
0 800351
1 590567
2 404564
3 601685
4 802526
5 784654
6 558749
7 760258
8 655714
9 864130
10 678664
11 983868
12 396629
13 637742
14 592018
15 810308
16 889529
17 914966
18 623197
19 97239
20 448357
21 67877
22 785864
23 177614
24 242659
25 301722
26 5175
27 418269
28 213547
29 417295
30 80595...

output:

1000000000023

result:

ok single line: '1000000000023'

Test #13:

score: 6
Accepted
time: 21ms
memory: 36996kb

input:

99995
0 800351
1 590567
2 404564
3 601685
4 802526
5 784654
6 558749
7 760258
8 655714
9 864130
10 678664
11 983868
12 396629
13 637742
14 592018
15 810308
16 889529
17 914966
18 623197
19 97239
20 448357
21 67877
22 785864
23 177614
24 242659
25 301722
26 5175
27 418269
28 213547
29 417295
30 80595...

output:

1000000000000

result:

ok single line: '1000000000000'

Test #14:

score: 6
Accepted
time: 16ms
memory: 34972kb

input:

99995
0 800351
1 590567
2 404564
3 601685
4 802526
5 784654
6 558749
7 760258
8 655714
9 864130
10 678664
11 983868
12 396629
13 637742
14 592018
15 810308
16 889529
17 914966
18 623197
19 97239
20 448357
21 67877
22 785864
23 177614
24 242659
25 301722
26 5175
27 418269
28 213547
29 417295
30 80595...

output:

1000000000023

result:

ok single line: '1000000000023'

Test #15:

score: 6
Accepted
time: 20ms
memory: 49404kb

input:

99995
0 800351
1 590567
2 404564
3 601685
4 802526
5 784654
6 558749
7 760258
8 655714
9 864130
10 678664
11 983868
12 396629
13 637742
14 592018
15 810308
16 889529
17 914966
18 623197
19 97239
20 448357
21 67877
22 785864
23 177614
24 242659
25 301722
26 5175
27 418269
28 213547
29 417295
30 80595...

output:

23

result:

ok single line: '23'

Test #16:

score: 6
Accepted
time: 19ms
memory: 50380kb

input:

99995
0 800351
1 590567
2 404564
3 601685
4 802526
5 784654
6 558749
7 760258
8 655714
9 864130
10 678664
11 983868
12 396629
13 637742
14 592018
15 810308
16 889529
17 914966
18 623197
19 97239
20 448357
21 67877
22 785864
23 177614
24 242659
25 301722
26 5175
27 418269
28 213547
29 417295
30 80595...

output:

23

result:

ok single line: '23'

Test #17:

score: 6
Accepted
time: 19ms
memory: 40828kb

input:

99995
0 307516682495
1 677180705676
2 900093321878
3 855950595166
4 60373551204
5 97525179732
6 859433105930
7 470206852651
8 836315525302
9 68512632833
10 862923859868
11 74601760822
12 219027891391
13 839738396803
14 169708425659
15 592509244955
16 824764053219
17 619446917083
18 422190804040
19 8...

output:

3249113

result:

ok single line: '3249113'

Test #18:

score: 6
Accepted
time: 15ms
memory: 37884kb

input:

99995
0 307516682495
1 677180705676
2 900093321878
3 855950595166
4 60373551204
5 97525179732
6 859433105930
7 470206852651
8 836315525302
9 68512632833
10 862923859868
11 74601760822
12 219027891391
13 839738396803
14 169708425659
15 592509244955
16 824764053219
17 619446917083
18 422190804040
19 8...

output:

484857763484

result:

ok single line: '484857763484'

Test #19:

score: 6
Accepted
time: 22ms
memory: 35992kb

input:

99995
0 307516682495
1 677180705676
2 900093321878
3 855950595166
4 60373551204
5 97525179732
6 859433105930
7 470206852651
8 836315525302
9 68512632833
10 862923859868
11 74601760822
12 219027891391
13 839738396803
14 169708425659
15 592509244955
16 824764053219
17 619446917083
18 422190804040
19 8...

output:

0

result:

ok single line: '0'

Test #20:

score: 6
Accepted
time: 23ms
memory: 35664kb

input:

99995
0 307516682495
1 677180705676
2 900093321878
3 855950595166
4 60373551204
5 97525179732
6 859433105930
7 470206852651
8 836315525302
9 68512632833
10 862923859868
11 74601760822
12 219027891391
13 839738396803
14 169708425659
15 592509244955
16 824764053219
17 619446917083
18 422190804040
19 8...

output:

86963587131

result:

ok single line: '86963587131'

Test #21:

score: 6
Accepted
time: 23ms
memory: 42148kb

input:

99995
0 307516682495
1 677180705676
2 900093321878
3 855950595166
4 60373551204
5 97525179732
6 859433105930
7 470206852651
8 836315525302
9 68512632833
10 862923859868
11 74601760822
12 219027891391
13 839738396803
14 169708425659
15 592509244955
16 824764053219
17 619446917083
18 422190804040
19 8...

output:

3249113

result:

ok single line: '3249113'

Test #22:

score: 6
Accepted
time: 19ms
memory: 37264kb

input:

99995
0 307516682495
1 677180705676
2 900093321878
3 855950595166
4 60373551204
5 97525179732
6 859433105930
7 470206852651
8 836315525302
9 68512632833
10 862923859868
11 74601760822
12 219027891391
13 839738396803
14 169708425659
15 592509244955
16 824764053219
17 619446917083
18 422190804040
19 8...

output:

484861012597

result:

ok single line: '484861012597'

Test #23:

score: 6
Accepted
time: 18ms
memory: 36468kb

input:

99995
0 307516682495
1 677180705676
2 900093321878
3 855950595166
4 60373551204
5 97525179732
6 859433105930
7 470206852651
8 836315525302
9 68512632833
10 862923859868
11 74601760822
12 219027891391
13 839738396803
14 169708425659
15 592509244955
16 824764053219
17 619446917083
18 422190804040
19 8...

output:

72033520

result:

ok single line: '72033520'

Test #24:

score: 6
Accepted
time: 26ms
memory: 34388kb

input:

99995
0 307516682495
1 677180705676
2 900093321878
3 855950595166
4 60373551204
5 97525179732
6 859433105930
7 470206852651
8 836315525302
9 68512632833
10 862923859868
11 74601760822
12 219027891391
13 839738396803
14 169708425659
15 592509244955
16 824764053219
17 619446917083
18 422190804040
19 8...

output:

87023183814

result:

ok single line: '87023183814'

Test #25:

score: 6
Accepted
time: 16ms
memory: 48692kb

input:

99995
0 307516682495
1 677180705676
2 900093321878
3 855950595166
4 60373551204
5 97525179732
6 859433105930
7 470206852651
8 836315525302
9 68512632833
10 862923859868
11 74601760822
12 219027891391
13 839738396803
14 169708425659
15 592509244955
16 824764053219
17 619446917083
18 422190804040
19 8...

output:

3249113

result:

ok single line: '3249113'

Test #26:

score: 6
Accepted
time: 25ms
memory: 51924kb

input:

99995
0 307516682495
1 677180705676
2 900093321878
3 855950595166
4 60373551204
5 97525179732
6 859433105930
7 470206852651
8 836315525302
9 68512632833
10 862923859868
11 74601760822
12 219027891391
13 839738396803
14 169708425659
15 592509244955
16 824764053219
17 619446917083
18 422190804040
19 8...

output:

3249113

result:

ok single line: '3249113'

Test #27:

score: 6
Accepted
time: 0ms
memory: 19784kb

input:

4
0 9
0 8
0 0
9 9 9

output:

9

result:

ok single line: '9'

Subtask #2:

score: 8
Accepted

Test #28:

score: 8
Accepted
time: 23ms
memory: 32156kb

input:

99997
0 122727
0 267270
0 846212
0 454122
0 805668
0 614161
0 7805
0 173284
0 684707
0 269129
0 930945
0 1101
0 992427
0 297412
0 759787
0 227130
0 120418
0 90914
0 333684
0 46144
0 519912
0 171490
0 823586
0 121787
0 674177
0 560254
0 753090
0 853359
0 465464
0 655527
0 631303
0 919012
0 597126
0 1...

output:

24980330181

result:

ok single line: '24980330181'

Test #29:

score: 8
Accepted
time: 17ms
memory: 30904kb

input:

99997
0 122727
0 267270
0 846212
0 454122
0 805668
0 614161
0 7805
0 173284
0 684707
0 269129
0 930945
0 1101
0 992427
0 297412
0 759787
0 227130
0 120418
0 90914
0 333684
0 46144
0 519912
0 171490
0 823586
0 121787
0 674177
0 560254
0 753090
0 853359
0 465464
0 655527
0 631303
0 919012
0 597126
0 1...

output:

24980330181

result:

ok single line: '24980330181'

Test #30:

score: 8
Accepted
time: 21ms
memory: 32180kb

input:

99998
0 792854
0 622829
0 836127
0 847372
0 71732
0 241096
0 487224
0 696890
0 899047
0 845614
0 27226
0 270985
0 698890
0 64699
0 856738
0 685434
0 766150
0 540443
0 802763
0 874879
0 250532
0 834015
0 616087
0 771638
0 262098
0 458015
0 959723
0 408130
0 880649
0 456673
0 923653
0 969100
0 439032
...

output:

1025006589524

result:

ok single line: '1025006589524'

Test #31:

score: 8
Accepted
time: 31ms
memory: 32020kb

input:

99998
0 792854
0 622829
0 836127
0 847372
0 71732
0 241096
0 487224
0 696890
0 899047
0 845614
0 27226
0 270985
0 698890
0 64699
0 856738
0 685434
0 766150
0 540443
0 802763
0 874879
0 250532
0 834015
0 616087
0 771638
0 262098
0 458015
0 959723
0 408130
0 880649
0 456673
0 923653
0 969100
0 439032
...

output:

1025006589524

result:

ok single line: '1025006589524'

Test #32:

score: 8
Accepted
time: 26ms
memory: 31492kb

input:

99997
0 111160315429
0 355167263283
0 846519401525
0 697515481745
0 653176944193
0 975281743723
0 947695822588
0 443385029699
0 86490619914
0 542182758068
0 140914234365
0 453333219458
0 484226894553
0 930883160414
0 961277575066
0 392480084360
0 638524603170
0 806648354769
0 552428035490
0 99450464...

output:

18302944415585093

result:

ok single line: '18302944415585093'

Test #33:

score: 8
Accepted
time: 32ms
memory: 30640kb

input:

99998
0 111160315429
0 355167263283
0 846519401525
0 697515481745
0 653176944193
0 975281743723
0 947695822588
0 443385029699
0 86490619914
0 542182758068
0 140914234365
0 453333219458
0 484226894553
0 930883160414
0 961277575066
0 392480084360
0 638524603170
0 806648354769
0 552428035490
0 99450464...

output:

18289278171456444

result:

ok single line: '18289278171456444'

Test #34:

score: 8
Accepted
time: 25ms
memory: 32032kb

input:

99997
0 111160315429
0 355167263283
0 846519401525
0 697515481745
0 653176944193
0 975281743723
0 947695822588
0 443385029699
0 86490619914
0 542182758068
0 140914234365
0 453333219458
0 484226894553
0 930883160414
0 961277575066
0 392480084360
0 638524603170
0 806648354769
0 552428035490
0 99450464...

output:

18302944415585093

result:

ok single line: '18302944415585093'

Test #35:

score: 8
Accepted
time: 33ms
memory: 30948kb

input:

99998
0 111160315429
0 355167263283
0 846519401525
0 697515481745
0 653176944193
0 975281743723
0 947695822588
0 443385029699
0 86490619914
0 542182758068
0 140914234365
0 453333219458
0 484226894553
0 930883160414
0 961277575066
0 392480084360
0 638524603170
0 806648354769
0 552428035490
0 99450464...

output:

18289278171456444

result:

ok single line: '18289278171456444'

Subtask #3:

score: 5
Accepted

Test #36:

score: 5
Accepted
time: 4ms
memory: 18828kb

input:

11
0 9
0 8
2 0
3 7
3 1
2 6
0 0
7 7
7 1
9 6
1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000

output:

1

result:

ok single line: '1'

Test #37:

score: 5
Accepted
time: 8ms
memory: 25396kb

input:

50311
0 630582
1 458618
2 300543
3 566041
4 306718
5 134260
6 736322
7 458543
8 609374
9 355623
10 706939
11 48588
12 455725
13 105118
14 71071
15 528699
16 423538
17 471781
18 98063
19 169099
20 657181
21 295537
22 49937
23 306612
24 186582
25 505763
26 831500
27 406268
28 294626
29 128111
30 42115...

output:

813491

result:

ok single line: '813491'

Test #38:

score: 5
Accepted
time: 19ms
memory: 41952kb

input:

99992
0 630582
0 458618
2 300543
2 566041
4 306718
4 134260
6 736322
6 458543
8 609374
8 355623
10 706939
10 48588
12 455725
12 105118
14 71071
14 528699
16 423538
16 471781
18 98063
18 169099
20 657181
20 295537
22 49937
22 306612
24 186582
24 505763
26 831500
26 406268
28 294626
28 128111
30 42115...

output:

0

result:

ok single line: '0'

Test #39:

score: 5
Accepted
time: 20ms
memory: 27220kb

input:

70338
0 630582
0 458618
2 300543
3 566041
4 306718
5 134260
5 736322
7 458543
8 609374
8 355623
10 706939
7 48588
12 455725
13 105118
14 71071
15 528699
16 423538
15 471781
18 98063
14 169099
20 657181
21 295537
22 49937
23 306612
21 186582
25 505763
26 831500
27 406268
27 294626
29 128111
30 421150...

output:

1645133792

result:

ok single line: '1645133792'

Test #40:

score: 5
Accepted
time: 12ms
memory: 27624kb

input:

75063
0 630582
1 458618
2 300543
3 566041
4 306718
5 134260
6 736322
7 458543
7 609374
9 355623
5 706939
11 48588
4 455725
13 105118
13 71071
15 528699
16 423538
17 471781
17 98063
19 169099
20 657181
21 295537
20 49937
23 306612
23 186582
25 505763
19 831500
27 406268
28 294626
28 128111
30 421150
...

output:

2120124996

result:

ok single line: '2120124996'

Test #41:

score: 5
Accepted
time: 20ms
memory: 27864kb

input:

71756
0 630582
1 458618
0 300543
3 566041
4 306718
4 134260
6 736322
7 458543
8 609374
9 355623
10 706939
11 48588
12 455725
13 105118
14 71071
15 528699
16 423538
17 471781
18 98063
16 169099
20 657181
12 295537
22 49937
23 306612
24 186582
25 505763
26 831500
26 406268
28 294626
23 128111
30 42115...

output:

1787349034

result:

ok single line: '1787349034'

Test #42:

score: 5
Accepted
time: 12ms
memory: 27916kb

input:

70448
0 630582
1 458618
2 300543
3 566041
4 306718
5 134260
6 736322
7 458543
7 609374
9 355623
10 706939
11 48588
12 455725
13 105118
12 71071
15 528699
16 423538
17 471781
17 98063
19 169099
19 657181
21 295537
22 49937
23 306612
24 186582
16 505763
26 831500
27 406268
27 294626
29 128111
30 42115...

output:

1645924769

result:

ok single line: '1645924769'

Test #43:

score: 5
Accepted
time: 11ms
memory: 27852kb

input:

68356
0 630582
1 458618
2 300543
3 566041
4 306718
5 134260
6 736322
7 458543
8 609374
9 355623
10 706939
11 48588
12 455725
13 105118
14 71071
15 528699
16 423538
17 471781
18 98063
19 169099
20 657181
21 295537
22 49937
23 306612
24 186582
25 505763
26 831500
27 406268
28 294626
29 128111
30 42115...

output:

1434056469

result:

ok single line: '1434056469'

Test #44:

score: 5
Accepted
time: 13ms
memory: 30208kb

input:

99998
0 989885
1 623358
2 323898
3 418387
4 847431
5 998077
6 737652
7 214051
8 72927
9 817696
10 494815
11 349489
12 264272
13 60664
14 739563
15 744355
16 882267
17 957314
18 547277
19 714547
20 566081
21 593766
22 431363
23 249609
24 768570
25 985859
26 183057
27 840222
28 168478
29 16211
30 3082...

output:

2654008

result:

ok single line: '2654008'

Test #45:

score: 5
Accepted
time: 23ms
memory: 36364kb

input:

99997
0 955101
1 576100
2 127659
3 811226
4 41161
4 566231
6 943952
7 287921
8 995827
9 53909
10 446266
11 568843
12 813723
12 241044
12 619032
15 744341
15 255358
15 8997
18 425939
18 28355
20 747884
21 827659
21 772961
23 229078
24 638934
24 618689
24 795722
27 518058
28 691526
29 667781
30 259093...

output:

10977059663

result:

ok single line: '10977059663'

Test #46:

score: 5
Accepted
time: 22ms
memory: 40388kb

input:

99998
0 349154
0 960228
2 693946
3 247696
3 58262
5 799702
5 731306
7 501447
8 296672
8 812371
10 173737
10 91929
12 524275
12 13376
14 316834
14 77773
16 888284
17 491488
18 963488
19 57028
20 526164
21 289556
22 136189
22 471245
24 474182
24 398669
26 46490
27 40395
28 529585
29 627410
30 271602
3...

output:

4656503217

result:

ok single line: '4656503217'

Test #47:

score: 5
Accepted
time: 16ms
memory: 31396kb

input:

99998
0 989885
1 623358
0 323898
3 418387
4 847431
4 998077
6 737652
7 214051
8 72927
8 817696
10 494815
11 349489
11 264272
13 60664
13 739563
15 744355
16 882267
11 957314
18 547277
19 714547
20 566081
21 593766
21 431363
23 249609
24 768570
25 985859
26 183057
27 840222
28 168478
28 16211
26 3082...

output:

5211108945

result:

ok single line: '5211108945'

Test #48:

score: 5
Accepted
time: 26ms
memory: 31280kb

input:

99998
0 989885
1 623358
2 323898
1 418387
4 847431
4 998077
4 737652
1 214051
8 72927
9 817696
10 494815
11 349489
10 264272
10 60664
8 739563
8 744355
16 882267
17 957314
18 547277
19 714547
20 566081
20 593766
20 431363
18 249609
24 768570
25 985859
26 183057
25 840222
28 168478
28 16211
30 30820
...

output:

7300156968

result:

ok single line: '7300156968'

Test #49:

score: 5
Accepted
time: 29ms
memory: 30776kb

input:

99999
0 960228
1 693946
1 247696
3 58262
3 799702
5 731306
5 501447
3 296672
8 812371
9 173737
10 91929
11 524275
12 13376
12 316834
11 77773
15 888284
15 491488
10 963488
18 57028
19 526164
19 289556
18 136189
22 471245
22 474182
9 398669
25 46490
26 40395
27 529585
28 627410
29 271602
30 109358
31...

output:

10004154233

result:

ok single line: '10004154233'

Test #50:

score: 5
Accepted
time: 24ms
memory: 33108kb

input:

99998
0 349154
1 960228
1 693946
1 247696
4 58262
5 799702
5 731306
5 501447
5 296672
5 812371
5 173737
5 91929
5 524275
5 13376
5 316834
4 77773
16 888284
16 491488
16 963488
16 57028
16 526164
16 289556
16 136189
16 471245
16 474182
16 398669
4 46490
27 40395
27 529585
27 627410
27 271602
27 10935...

output:

20125634322

result:

ok single line: '20125634322'

Test #51:

score: 5
Accepted
time: 24ms
memory: 31900kb

input:

99998
0 349154
1 960228
1 693946
1 247696
1 58262
1 799702
1 731306
1 501447
1 296672
1 812371
1 173737
11 91929
12 524275
12 13376
12 316834
12 77773
12 888284
12 491488
12 963488
12 57028
12 526164
12 289556
12 136189
12 471245
12 474182
12 398669
12 46490
12 40395
12 529585
12 627410
12 271602
12...

output:

23556910464

result:

ok single line: '23556910464'

Test #52:

score: 5
Accepted
time: 29ms
memory: 32260kb

input:

99998
0 349154
1 960228
1 693946
1 247696
1 58262
1 799702
1 731306
1 501447
1 296672
1 812371
1 173737
1 91929
1 524275
1 13376
1 316834
1 77773
1 888284
1 491488
1 963488
1 57028
1 526164
1 289556
22 136189
1 471245
1 474182
1 398669
1 46490
1 40395
1 529585
1 627410
1 271602
1 109358
1 83447
1 19...

output:

24381300470

result:

ok single line: '24381300470'

Test #53:

score: 5
Accepted
time: 26ms
memory: 31712kb

input:

99998
0 349154
1 960228
2 693946
3 247696
4 58262
5 799702
6 731306
6 501447
8 296672
9 812371
10 173737
11 91929
10 524275
13 13376
13 316834
15 77773
16 888284
17 491488
15 963488
19 57028
15 526164
9 289556
9 136189
9 471245
5 474182
25 398669
26 46490
27 40395
28 529585
29 627410
29 271602
31 10...

output:

5869311889

result:

ok single line: '5869311889'

Test #54:

score: 5
Accepted
time: 25ms
memory: 29936kb

input:

99999
0 960228
1 693946
2 247696
3 58262
4 799702
5 731306
6 501447
7 296672
8 812371
9 173737
9 91929
9 524275
12 13376
12 316834
14 77773
15 888284
15 491488
17 963488
18 57028
19 526164
20 289556
21 136189
22 471245
23 474182
24 398669
25 46490
23 40395
27 529585
28 627410
29 271602
29 109358
23 ...

output:

5391164384

result:

ok single line: '5391164384'

Test #55:

score: 5
Accepted
time: 20ms
memory: 31220kb

input:

99999
0 960228
1 693946
2 247696
3 58262
4 799702
5 731306
6 501447
7 296672
8 812371
9 173737
10 91929
11 524275
12 13376
13 316834
14 77773
15 888284
16 491488
17 963488
18 57028
19 526164
20 289556
21 136189
22 471245
23 474182
24 398669
25 46490
26 40395
27 529585
28 627410
29 271602
30 109358
3...

output:

4579960285

result:

ok single line: '4579960285'

Test #56:

score: 5
Accepted
time: 21ms
memory: 41732kb

input:

99997
0 955101
1 576100
1 127659
3 811226
4 41161
5 566231
6 943952
7 287921
8 995827
9 53909
9 446266
9 568843
12 813723
12 241044
14 619032
15 744341
16 255358
17 8997
18 425939
19 28355
20 747884
20 827659
22 772961
22 229078
24 638934
25 618689
25 795722
27 518058
28 691526
29 667781
29 259093
2...

output:

7479580481

result:

ok single line: '7479580481'

Subtask #4:

score: 15
Accepted

Dependency #3:

100%
Accepted

Test #57:

score: 15
Accepted
time: 10ms
memory: 25460kb

input:

50313
0 671723
1 730984
2 799869
3 708040
4 711347
5 913917
6 751372
7 466548
8 886178
9 550034
10 657744
11 417284
12 757271
13 462274
14 539467
15 622147
16 989468
17 588888
18 834040
19 6615
20 192481
21 495240
22 784027
23 951846
24 129510
25 204593
26 599793
27 171885
28 475383
29 206677
30 889...

output:

1000000629830

result:

ok single line: '1000000629830'

Test #58:

score: 15
Accepted
time: 24ms
memory: 42300kb

input:

99990
0 671723
0 730984
2 799869
2 708040
4 711347
4 913917
6 751372
6 466548
8 886178
8 550034
10 657744
10 417284
12 757271
12 462274
14 539467
14 622147
16 989468
16 588888
18 834040
18 6615
20 192481
20 495240
22 784027
22 951846
24 129510
24 204593
26 599793
26 171885
28 475383
28 206677
30 889...

output:

1000000000000

result:

ok single line: '1000000000000'

Test #59:

score: 15
Accepted
time: 17ms
memory: 27984kb

input:

70336
0 671723
0 730984
2 799869
3 708040
4 711347
5 913917
5 751372
7 466548
8 886178
8 550034
10 657744
7 417284
12 757271
13 462274
14 539467
15 622147
16 989468
15 588888
18 834040
14 6615
20 192481
21 495240
22 784027
23 951846
21 129510
25 204593
26 599793
27 171885
27 475383
29 206677
30 8893...

output:

1001654741001

result:

ok single line: '1001654741001'

Test #60:

score: 15
Accepted
time: 12ms
memory: 28472kb

input:

75061
0 671723
1 730984
2 799869
3 708040
4 711347
5 913917
6 751372
7 466548
7 886178
9 550034
5 657744
11 417284
4 757271
13 462274
13 539467
15 622147
16 989468
17 588888
17 834040
19 6615
20 192481
21 495240
20 784027
23 951846
23 129510
25 204593
19 599793
27 171885
28 475383
28 206677
30 88939...

output:

1002104551821

result:

ok single line: '1002104551821'

Test #61:

score: 15
Accepted
time: 12ms
memory: 27596kb

input:

71754
0 671723
1 730984
0 799869
3 708040
4 711347
4 913917
6 751372
7 466548
8 886178
9 550034
10 657744
11 417284
12 757271
13 462274
14 539467
15 622147
16 989468
17 588888
18 834040
16 6615
20 192481
12 495240
22 784027
23 951846
24 129510
25 204593
26 599793
26 171885
28 475383
23 206677
30 889...

output:

1001786286303

result:

ok single line: '1001786286303'

Test #62:

score: 15
Accepted
time: 13ms
memory: 26800kb

input:

70450
0 671723
1 730984
2 799869
3 708040
4 711347
5 913917
6 751372
7 466548
7 886178
9 550034
10 657744
11 417284
12 757271
13 462274
12 539467
15 622147
16 989468
17 588888
17 834040
19 6615
19 192481
21 495240
22 784027
23 951846
24 129510
16 204593
26 599793
27 171885
27 475383
29 206677
30 889...

output:

1001629911549

result:

ok single line: '1001629911549'

Test #63:

score: 15
Accepted
time: 8ms
memory: 26072kb

input:

68358
0 671723
1 730984
2 799869
3 708040
4 711347
5 913917
6 751372
7 466548
8 886178
9 550034
10 657744
11 417284
12 757271
13 462274
14 539467
15 622147
16 989468
17 588888
18 834040
19 6615
20 192481
21 495240
22 784027
23 951846
24 129510
25 204593
26 599793
27 171885
28 475383
29 206677
30 889...

output:

1001413235494

result:

ok single line: '1001413235494'

Test #64:

score: 15
Accepted
time: 12ms
memory: 30680kb

input:

99997
0 802724
1 562324
2 314901
3 690153
4 155474
5 257051
6 46437
7 33636
8 57172
9 524056
10 62783
11 653250
12 385974
13 455943
14 783290
15 337606
16 464136
17 149488
18 758081
19 317666
20 351062
21 840919
22 236692
23 983595
24 718886
25 230981
26 227106
27 490800
28 205548
29 992106
30 17332...

output:

1000002365655

result:

ok single line: '1000002365655'

Test #65:

score: 15
Accepted
time: 27ms
memory: 35692kb

input:

99997
0 164866
1 527882
2 171110
3 569590
3 990163
5 131150
6 123614
7 399579
8 381244
9 526423
9 650579
11 824928
12 918615
13 238998
14 810636
15 367099
15 181330
15 806943
18 620041
18 348696
20 939661
21 799828
22 321012
22 160551
24 553838
25 737242
26 411759
26 590580
28 136031
29 756213
30 42...

output:

1010934836204

result:

ok single line: '1010934836204'

Test #66:

score: 15
Accepted
time: 23ms
memory: 41644kb

input:

99998
0 918739
0 851103
2 60563
3 251816
3 390355
5 330438
5 498645
7 910354
8 824679
8 969883
10 679467
10 410128
12 329576
12 897834
14 32984
14 521040
16 697717
17 541997
18 33194
19 424718
20 911546
21 627991
22 99937
22 777846
24 424322
24 772243
26 480136
27 448380
28 564887
29 317639
30 11033...

output:

1004551419642

result:

ok single line: '1004551419642'

Test #67:

score: 15
Accepted
time: 16ms
memory: 30612kb

input:

99998
0 562324
1 314901
0 690153
3 155474
4 257051
4 46437
6 33636
7 57172
8 524056
8 62783
10 653250
11 385974
11 455943
13 783290
13 337606
15 464136
16 149488
11 758081
18 317666
19 351062
20 840919
21 236692
21 983595
23 718886
24 230981
25 227106
26 490800
27 205548
28 992106
28 173327
26 58593...

output:

1005163305234

result:

ok single line: '1005163305234'

Test #68:

score: 15
Accepted
time: 22ms
memory: 30972kb

input:

99997
0 802724
1 562324
2 314901
1 690153
4 155474
4 257051
4 46437
1 33636
8 57172
9 524056
10 62783
11 653250
10 385974
10 455943
8 783290
8 337606
16 464136
17 149488
18 758081
19 317666
20 351062
20 840919
20 236692
18 983595
24 718886
25 230981
26 227106
25 490800
28 205548
28 992106
30 173327
...

output:

1007253751818

result:

ok single line: '1007253751818'

Test #69:

score: 15
Accepted
time: 16ms
memory: 30352kb

input:

99998
0 918739
0 851103
2 60563
2 251816
4 390355
5 330438
5 498645
4 910354
8 824679
9 969883
10 679467
11 410128
12 329576
12 897834
11 32984
15 521040
15 697717
10 541997
18 33194
19 424718
19 911546
18 627991
22 99937
22 777846
9 424322
25 772243
26 480136
27 448380
28 564887
29 317639
30 110330...

output:

1010003687961

result:

ok single line: '1010003687961'

Test #70:

score: 15
Accepted
time: 24ms
memory: 33096kb

input:

99998
0 918739
0 851103
2 60563
2 251816
2 390355
5 330438
6 498645
6 910354
6 824679
6 969883
6 679467
6 410128
6 329576
6 897834
6 32984
6 521040
5 697717
17 541997
17 33194
17 424718
17 911546
17 627991
17 99937
17 777846
17 424322
17 772243
17 480136
5 448380
28 564887
28 317639
28 110330
28 261...

output:

1020106071261

result:

ok single line: '1020106071261'

Test #71:

score: 15
Accepted
time: 24ms
memory: 31492kb

input:

99998
0 918739
0 851103
2 60563
3 251816
2 390355
2 330438
2 498645
2 910354
2 824679
2 969883
2 679467
2 410128
2 329576
13 897834
14 32984
14 521040
14 697717
14 541997
14 33194
14 424718
14 911546
14 627991
14 99937
14 777846
14 424322
14 772243
14 480136
14 448380
14 564887
14 317639
14 110330
1...

output:

1023459448708

result:

ok single line: '1023459448708'

Test #72:

score: 15
Accepted
time: 24ms
memory: 30904kb

input:

99999
0 851103
0 60563
2 251816
2 390355
2 330438
2 498645
2 910354
2 824679
2 969883
2 679467
2 410128
2 329576
2 897834
2 32984
2 521040
2 697717
2 541997
2 33194
2 424718
2 911546
2 627991
2 99937
2 777846
2 424322
2 772243
2 480136
2 448380
2 564887
28 317639
2 110330
2 261648
2 673290
2 560791
...

output:

1024277277020

result:

ok single line: '1024277277020'

Test #73:

score: 15
Accepted
time: 22ms
memory: 30668kb

input:

99997
0 948655
1 918739
2 851103
3 60563
4 251816
5 390355
6 330438
6 498645
8 910354
9 824679
10 969883
11 679467
10 410128
13 329576
13 897834
15 32984
16 521040
17 697717
15 541997
19 33194
15 424718
9 911546
9 627991
9 99937
5 777846
25 424322
26 772243
27 480136
28 448380
29 564887
29 317639
31...

output:

1005766448407

result:

ok single line: '1005766448407'

Test #74:

score: 15
Accepted
time: 25ms
memory: 30608kb

input:

99998
0 918739
0 851103
2 60563
3 251816
4 390355
5 330438
6 498645
7 910354
8 824679
9 969883
10 679467
10 410128
10 329576
13 897834
13 32984
15 521040
16 697717
16 541997
18 33194
19 424718
20 911546
21 627991
22 99937
23 777846
24 424322
25 772243
26 480136
24 448380
28 564887
29 317639
30 11033...

output:

1005302380832

result:

ok single line: '1005302380832'

Test #75:

score: 15
Accepted
time: 12ms
memory: 30752kb

input:

99999
0 851103
0 60563
2 251816
3 390355
4 330438
5 498645
6 910354
7 824679
8 969883
9 679467
10 410128
11 329576
12 897834
13 32984
14 521040
15 697717
16 541997
17 33194
18 424718
19 911546
20 627991
21 99937
22 777846
23 424322
24 772243
25 480136
26 448380
27 564887
28 317639
29 110330
30 26164...

output:

1004562553144

result:

ok single line: '1004562553144'

Test #76:

score: 15
Accepted
time: 26ms
memory: 40868kb

input:

99998
0 527882
1 171110
2 569590
3 990163
4 131150
5 123614
5 399579
7 381244
8 526423
9 650579
10 824928
11 918615
12 238998
12 810636
14 367099
14 181330
16 806943
16 620041
16 348696
19 939661
20 799828
20 321012
22 160551
22 553838
24 737242
25 411759
25 590580
27 136031
28 756213
29 428966
30 7...

output:

1007508036134

result:

ok single line: '1007508036134'

Subtask #5:

score: 57
Accepted

Test #77:

score: 57
Accepted
time: 9ms
memory: 24680kb

input:

50311
0 962897543825
1 887020369743
2 363658802934
3 481009844166
4 1099712574
5 858320882162
6 521927434762
7 379344260539
8 73024776148
9 634183458545
10 869560347910
11 81581323331
12 750044298516
13 307013017409
14 306226274039
15 423923546601
16 482114694167
17 849292461119
18 299993045938
19 7...

output:

939418184213

result:

ok single line: '939418184213'

Test #78:

score: 57
Accepted
time: 15ms
memory: 25516kb

input:

50313
0 913618590767
1 732880223618
2 997602715655
3 358766408157
4 85067461936
5 794653506774
6 772102529374
7 816168833338
8 383565735786
9 8619949883
10 97913798635
11 177021054239
12 578459000358
13 106983856814
14 119986823990
15 578574399148
16 612351925617
17 907442966599
18 474072682126
19 9...

output:

1080406327850

result:

ok single line: '1080406327850'

Test #79:

score: 57
Accepted
time: 21ms
memory: 42352kb

input:

99992
0 962897543825
0 887020369743
2 363658802934
2 481009844166
4 1099712574
4 858320882162
6 521927434762
6 379344260539
8 73024776148
8 634183458545
10 869560347910
10 81581323331
12 750044298516
12 307013017409
14 306226274039
14 423923546601
16 482114694167
16 849292461119
18 299993045938
18 7...

output:

0

result:

ok single line: '0'

Test #80:

score: 57
Accepted
time: 22ms
memory: 41344kb

input:

99990
0 913618590767
0 732880223618
2 997602715655
2 358766408157
4 85067461936
4 794653506774
6 772102529374
6 816168833338
8 383565735786
8 8619949883
10 97913798635
10 177021054239
12 578459000358
12 106983856814
14 119986823990
14 578574399148
16 612351925617
16 907442966599
18 474072682126
18 9...

output:

2767607624

result:

ok single line: '2767607624'

Test #81:

score: 57
Accepted
time: 18ms
memory: 27372kb

input:

70338
0 962897543825
0 887020369743
2 363658802934
3 481009844166
4 1099712574
5 858320882162
5 521927434762
7 379344260539
8 73024776148
8 634183458545
10 869560347910
7 81581323331
12 750044298516
13 307013017409
14 306226274039
15 423923546601
16 482114694167
15 849292461119
18 299993045938
14 78...

output:

1236502712823452

result:

ok single line: '1236502712823452'

Test #82:

score: 57
Accepted
time: 12ms
memory: 26516kb

input:

70336
0 913618590767
0 732880223618
2 997602715655
3 358766408157
4 85067461936
5 794653506774
5 772102529374
7 816168833338
8 383565735786
8 8619949883
10 97913798635
7 177021054239
12 578459000358
13 106983856814
14 119986823990
15 578574399148
16 612351925617
15 907442966599
18 474072682126
14 91...

output:

1227073523345032

result:

ok single line: '1227073523345032'

Test #83:

score: 57
Accepted
time: 19ms
memory: 27128kb

input:

75063
0 962897543825
1 887020369743
2 363658802934
3 481009844166
4 1099712574
5 858320882162
6 521927434762
7 379344260539
7 73024776148
9 634183458545
5 869560347910
11 81581323331
4 750044298516
13 307013017409
13 306226274039
15 423923546601
16 482114694167
17 849292461119
17 299993045938
19 781...

output:

1587811424366467

result:

ok single line: '1587811424366467'

Test #84:

score: 57
Accepted
time: 15ms
memory: 27608kb

input:

75061
0 913618590767
1 732880223618
2 997602715655
3 358766408157
4 85067461936
5 794653506774
6 772102529374
7 816168833338
7 383565735786
9 8619949883
5 97913798635
11 177021054239
4 578459000358
13 106983856814
13 119986823990
15 578574399148
16 612351925617
17 907442966599
17 474072682126
19 915...

output:

1616311354002147

result:

ok single line: '1616311354002147'

Test #85:

score: 57
Accepted
time: 14ms
memory: 26364kb

input:

71756
0 962897543825
1 887020369743
0 363658802934
3 481009844166
4 1099712574
4 858320882162
6 521927434762
7 379344260539
8 73024776148
9 634183458545
10 869560347910
11 81581323331
12 750044298516
13 307013017409
14 306226274039
15 423923546601
16 482114694167
17 849292461119
18 299993045938
16 7...

output:

1341395775716453

result:

ok single line: '1341395775716453'

Test #86:

score: 57
Accepted
time: 18ms
memory: 27964kb

input:

71754
0 913618590767
1 732880223618
0 997602715655
3 358766408157
4 85067461936
4 794653506774
6 772102529374
7 816168833338
8 383565735786
9 8619949883
10 97913798635
11 177021054239
12 578459000358
13 106983856814
14 119986823990
15 578574399148
16 612351925617
17 907442966599
18 474072682126
16 9...

output:

1340873714117670

result:

ok single line: '1340873714117670'

Test #87:

score: 57
Accepted
time: 17ms
memory: 28352kb

input:

70448
0 962897543825
1 887020369743
2 363658802934
3 481009844166
4 1099712574
5 858320882162
6 521927434762
7 379344260539
7 73024776148
9 634183458545
10 869560347910
11 81581323331
12 750044298516
13 307013017409
12 306226274039
15 423923546601
16 482114694167
17 849292461119
17 299993045938
19 7...

output:

1251475739130135

result:

ok single line: '1251475739130135'

Test #88:

score: 57
Accepted
time: 14ms
memory: 26168kb

input:

70450
0 913618590767
1 732880223618
2 997602715655
3 358766408157
4 85067461936
5 794653506774
6 772102529374
7 816168833338
7 383565735786
9 8619949883
10 97913798635
11 177021054239
12 578459000358
13 106983856814
12 119986823990
15 578574399148
16 612351925617
17 907442966599
17 474072682126
19 9...

output:

1249784910702517

result:

ok single line: '1249784910702517'

Test #89:

score: 57
Accepted
time: 17ms
memory: 27280kb

input:

68356
0 962897543825
1 887020369743
2 363658802934
3 481009844166
4 1099712574
5 858320882162
6 521927434762
7 379344260539
8 73024776148
9 634183458545
10 869560347910
11 81581323331
12 750044298516
13 307013017409
14 306226274039
15 423923546601
16 482114694167
17 849292461119
18 299993045938
19 7...

output:

1100032910929648

result:

ok single line: '1100032910929648'

Test #90:

score: 57
Accepted
time: 17ms
memory: 26696kb

input:

68358
0 913618590767
1 732880223618
2 997602715655
3 358766408157
4 85067461936
5 794653506774
6 772102529374
7 816168833338
8 383565735786
9 8619949883
10 97913798635
11 177021054239
12 578459000358
13 106983856814
14 119986823990
15 578574399148
16 612351925617
17 907442966599
18 474072682126
19 9...

output:

1078601952518796

result:

ok single line: '1078601952518796'

Test #91:

score: 57
Accepted
time: 12ms
memory: 30276kb

input:

99998
0 342677397888
1 459540348087
2 813082205469
3 885895533460
4 358292701489
5 609085249700
6 447762058276
7 997107158641
8 725085499678
9 500795356867
10 616908332752
11 681343216590
12 703393143690
13 512340817368
14 876398660433
15 455299869147
16 469220048624
17 888380183878
18 201776664950
...

output:

2565717435853

result:

ok single line: '2565717435853'

Test #92:

score: 57
Accepted
time: 16ms
memory: 29752kb

input:

99997
0 22329710925
1 54315134340
2 829761909547
3 949364471217
4 570921183
5 557351244951
6 762024409827
7 518931861594
8 555620123083
9 692866191417
10 11228951460
11 340763292791
12 787216346684
13 509681312605
14 526485153075
15 321572326336
16 409817363515
17 417889400804
18 284401821545
19 729...

output:

1792678808251

result:

ok single line: '1792678808251'

Subtask #6:

score: 9
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #93:

score: 9
Accepted
time: 19ms
memory: 34908kb

input:

99997
0 471522978645
1 427261607631
2 215311855747
3 979324796231
4 521469644554
4 343764889894
6 239124164488
7 344185752268
8 35239337006
9 135386791849
10 421770795423
10 768875194456
10 618402974729
13 436962382783
14 55547535683
15 483541770016
16 803023821911
16 90591073086
18 687034142966
19 ...

output:

6967210724952547

result:

ok single line: '6967210724952547'

Test #94:

score: 9
Accepted
time: 29ms
memory: 35492kb

input:

99997
0 856089328776
0 806123285139
2 967480792929
3 250344011596
4 247289087066
5 840483000448
5 84581802687
7 46425636109
8 753719698496
8 996454929218
10 84199708254
11 394411359834
12 754093100569
12 604260498581
14 53446119490
15 987831249872
16 384503978666
16 231838675757
18 596721033409
19 1...

output:

7034894814477306

result:

ok single line: '7034894814477306'

Test #95:

score: 9
Accepted
time: 20ms
memory: 40508kb

input:

99997
0 610194199225
0 692144284009
2 270734736737
3 750951169254
3 149956768867
5 915245991118
5 853487287475
7 246953629768
8 874301927261
8 850737463017
10 706260997353
10 292996803415
12 829600608653
12 472952156848
14 943163052656
14 644698056650
16 62478907120
17 470591941514
18 8449578423
19 ...

output:

2969220848012435

result:

ok single line: '2969220848012435'

Test #96:

score: 9
Accepted
time: 23ms
memory: 41684kb

input:

99997
0 908296437856
0 384327926781
2 839505569919
3 737616160559
3 304595583142
5 110307452271
5 252136855856
7 372355051349
8 975302274087
8 974305352295
10 881500436645
10 737326696600
12 811485739064
12 739745074946
14 23406228336
14 75871105269
16 674488764300
17 151989740626
18 876673362604
19...

output:

2948366910279616

result:

ok single line: '2948366910279616'

Test #97:

score: 9
Accepted
time: 31ms
memory: 29992kb

input:

99998
0 342677397888
1 459540348087
0 813082205469
3 885895533460
4 358292701489
4 609085249700
6 447762058276
7 997107158641
8 725085499678
8 500795356867
10 616908332752
11 681343216590
11 703393143690
13 512340817368
13 876398660433
15 455299869147
16 469220048624
11 888380183878
18 201776664950
...

output:

3738040416241855

result:

ok single line: '3738040416241855'

Test #98:

score: 9
Accepted
time: 22ms
memory: 30436kb

input:

99997
0 22329710925
1 54315134340
0 829761909547
3 949364471217
4 570921183
4 557351244951
6 762024409827
7 518931861594
8 555620123083
8 692866191417
10 11228951460
11 340763292791
11 787216346684
13 509681312605
13 526485153075
15 321572326336
16 409817363515
11 417889400804
18 284401821545
19 729...

output:

3749334443733781

result:

ok single line: '3749334443733781'

Test #99:

score: 9
Accepted
time: 28ms
memory: 30052kb

input:

99998
0 342677397888
1 459540348087
2 813082205469
1 885895533460
4 358292701489
4 609085249700
4 447762058276
1 997107158641
8 725085499678
9 500795356867
10 616908332752
11 681343216590
10 703393143690
10 512340817368
8 876398660433
8 455299869147
16 469220048624
17 888380183878
18 201776664950
19...

output:

5098030461156110

result:

ok single line: '5098030461156110'

Test #100:

score: 9
Accepted
time: 23ms
memory: 31984kb

input:

99997
0 22329710925
1 54315134340
2 829761909547
1 949364471217
4 570921183
4 557351244951
4 762024409827
1 518931861594
8 555620123083
9 692866191417
10 11228951460
11 340763292791
10 787216346684
10 509681312605
8 526485153075
8 321572326336
16 409817363515
17 417889400804
18 284401821545
19 72920...

output:

5105294225753112

result:

ok single line: '5105294225753112'

Test #101:

score: 9
Accepted
time: 18ms
memory: 31144kb

input:

99998
0 692144284009
1 270734736737
1 750951169254
3 149956768867
4 915245991118
4 853487287475
3 246953629768
7 874301927261
8 850737463017
9 706260997353
10 292996803415
11 829600608653
11 472952156848
10 943163052656
14 644698056650
14 62478907120
9 470591941514
17 8449578423
18 815201429642
18 2...

output:

7722719060044249

result:

ok single line: '7722719060044249'

Test #102:

score: 9
Accepted
time: 26ms
memory: 30860kb

input:

99998
0 384327926781
0 839505569919
2 737616160559
2 304595583142
4 110307452271
5 252136855856
5 372355051349
4 975302274087
8 974305352295
9 881500436645
10 737326696600
11 811485739064
12 739745074946
12 23406228336
11 75871105269
15 674488764300
15 151989740626
10 876673362604
18 122761704695
19...

output:

7677566196511960

result:

ok single line: '7677566196511960'

Test #103:

score: 9
Accepted
time: 25ms
memory: 32228kb

input:

99999
0 270734736737
1 750951169254
1 149956768867
1 915245991118
4 853487287475
5 246953629768
5 874301927261
5 850737463017
5 706260997353
5 292996803415
5 829600608653
5 472952156848
5 943163052656
5 644698056650
5 62478907120
4 470591941514
16 8449578423
16 815201429642
16 247779374880
16 989645...

output:

15618121349960317

result:

ok single line: '15618121349960317'

Test #104:

score: 9
Accepted
time: 34ms
memory: 32636kb

input:

99998
0 384327926781
0 839505569919
2 737616160559
2 304595583142
2 110307452271
5 252136855856
6 372355051349
6 975302274087
6 974305352295
6 881500436645
6 737326696600
6 811485739064
6 739745074946
6 23406228336
6 75871105269
6 674488764300
5 151989740626
17 876673362604
17 122761704695
17 831004...

output:

15601162788909172

result:

ok single line: '15601162788909172'

Test #105:

score: 9
Accepted
time: 22ms
memory: 31688kb

input:

99998
0 692144284009
1 270734736737
1 750951169254
1 149956768867
1 915245991118
1 853487287475
1 246953629768
1 874301927261
1 850737463017
1 706260997353
1 292996803415
11 829600608653
12 472952156848
12 943163052656
12 644698056650
12 62478907120
12 470591941514
12 8449578423
12 815201429642
12 2...

output:

17711200680273858

result:

ok single line: '17711200680273858'

Test #106:

score: 9
Accepted
time: 26ms
memory: 32204kb

input:

99998
0 384327926781
0 839505569919
2 737616160559
2 304595583142
2 110307452271
2 252136855856
2 372355051349
2 975302274087
2 974305352295
2 881500436645
2 737326696600
2 811485739064
12 739745074946
13 23406228336
13 75871105269
13 674488764300
13 151989740626
13 876673362604
13 122761704695
13 8...

output:

17631674427192963

result:

ok single line: '17631674427192963'

Test #107:

score: 9
Accepted
time: 24ms
memory: 30480kb

input:

99999
0 270734736737
1 750951169254
1 149956768867
1 915245991118
1 853487287475
1 246953629768
1 874301927261
7 850737463017
1 706260997353
1 292996803415
1 829600608653
1 472952156848
1 943163052656
1 644698056650
1 62478907120
1 470591941514
1 8449578423
1 815201429642
1 247779374880
1 9896457117...

output:

17899664443916640

result:

ok single line: '17899664443916640'

Test #108:

score: 9
Accepted
time: 22ms
memory: 32348kb

input:

99998
0 384327926781
0 839505569919
2 737616160559
2 304595583142
2 110307452271
2 252136855856
2 372355051349
2 975302274087
2 974305352295
2 881500436645
2 737326696600
2 811485739064
2 739745074946
2 23406228336
2 75871105269
2 674488764300
2 151989740626
2 876673362604
2 122761704695
2 831004317...

output:

17803266004000494

result:

ok single line: '17803266004000494'

Test #109:

score: 9
Accepted
time: 19ms
memory: 30276kb

input:

99998
0 692144284009
1 270734736737
2 750951169254
3 149956768867
4 915245991118
5 853487287475
6 246953629768
6 874301927261
8 850737463017
9 706260997353
10 292996803415
11 829600608653
10 472952156848
13 943163052656
13 644698056650
15 62478907120
16 470591941514
17 8449578423
15 815201429642
19 ...

output:

4178969114757583

result:

ok single line: '4178969114757583'

Test #110:

score: 9
Accepted
time: 27ms
memory: 31144kb

input:

99998
0 384327926781
1 839505569919
2 737616160559
3 304595583142
4 110307452271
5 252136855856
6 372355051349
6 975302274087
8 974305352295
9 881500436645
10 737326696600
11 811485739064
10 739745074946
13 23406228336
13 75871105269
15 674488764300
16 151989740626
17 876673362604
15 122761704695
19...

output:

4165467271926574

result:

ok single line: '4165467271926574'

Test #111:

score: 9
Accepted
time: 23ms
memory: 30284kb

input:

99999
0 270734736737
1 750951169254
2 149956768867
3 915245991118
4 853487287475
5 246953629768
6 874301927261
7 850737463017
8 706260997353
9 292996803415
9 829600608653
9 472952156848
12 943163052656
12 644698056650
14 62478907120
15 470591941514
15 8449578423
17 815201429642
18 247779374880
19 98...

output:

3862627383553245

result:

ok single line: '3862627383553245'

Test #112:

score: 9
Accepted
time: 17ms
memory: 32000kb

input:

99999
0 839505569919
0 737616160559
2 304595583142
3 110307452271
4 252136855856
5 372355051349
6 975302274087
7 974305352295
8 881500436645
9 737326696600
10 811485739064
10 739745074946
10 23406228336
13 75871105269
13 674488764300
15 151989740626
16 876673362604
16 122761704695
18 831004317638
19...

output:

3830777145302581

result:

ok single line: '3830777145302581'

Test #113:

score: 9
Accepted
time: 21ms
memory: 31212kb

input:

99999
0 270734736737
1 750951169254
2 149956768867
3 915245991118
4 853487287475
5 246953629768
6 874301927261
7 850737463017
8 706260997353
9 292996803415
10 829600608653
11 472952156848
12 943163052656
13 644698056650
14 62478907120
15 470591941514
16 8449578423
17 815201429642
18 247779374880
19 ...

output:

3286570062311148

result:

ok single line: '3286570062311148'

Test #114:

score: 9
Accepted
time: 27ms
memory: 31748kb

input:

99999
0 839505569919
0 737616160559
2 304595583142
3 110307452271
4 252136855856
5 372355051349
6 975302274087
7 974305352295
8 881500436645
9 737326696600
10 811485739064
11 739745074946
12 23406228336
13 75871105269
14 674488764300
15 151989740626
16 876673362604
17 122761704695
18 831004317638
19...

output:

3269805320667470

result:

ok single line: '3269805320667470'

Test #115:

score: 9
Accepted
time: 20ms
memory: 41524kb

input:

99998
0 427261607631
1 215311855747
1 979324796231
3 521469644554
4 343764889894
5 239124164488
6 344185752268
7 35239337006
8 135386791849
8 421770795423
10 768875194456
11 618402974729
12 436962382783
12 55547535683
12 483541770016
15 803023821911
15 90591073086
17 687034142966
18 832539051659
19 ...

output:

5064731607513925

result:

ok single line: '5064731607513925'

Test #116:

score: 9
Accepted
time: 32ms
memory: 41828kb

input:

99998
0 806123285139
0 967480792929
2 250344011596
3 247289087066
4 840483000448
4 84581802687
6 46425636109
7 753719698496
8 996454929218
9 84199708254
10 394411359834
10 754093100569
10 604260498581
13 53446119490
14 987831249872
15 384503978666
16 231838675757
17 596721033409
17 136872790235
19 1...

output:

5119625075497515

result:

ok single line: '5119625075497515'