QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#486850#5709. ArtskjidZhaoZiLong9.5 138ms19304kbC++14636b2024-07-22 08:07:112024-07-22 08:07:12

詳細信息

Test #1:

score: 0
Wrong Answer
time: 3ms
memory: 4232kb

input:

13 86
7 5 5796
1 8 4383
2 5 1887
10 3 2752
3 11 549
10 5 7445
11 7 5271
11 6 5613
6 7 2176
8 9 2841
10 12 613
3 9 9981
0 2 2564
5 2 7009
3 10 9699
6 10 4165
11 1 2268
7 4 3540
4 10 694
12 1 4096
6 4 7424
0 10 5554
4 7 450
2 10 6367
0 9 343
3 1 3400
5 9 2403
6 2 6448
8 1 8688
2 0 1555
0 3 5335
6 9 50...

output:

29962

result:

wrong answer 1st lines differ - expected: '92883', found: '29962'

Test #2:

score: 0
Wrong Answer
time: 0ms
memory: 3888kb

input:

4 6
3 1 3467
0 3 2326
3 0 7229
3 2 6870
2 3 3526
2 1 6741

output:

3526

result:

wrong answer 1st lines differ - expected: '2326', found: '3526'

Test #3:

score: 0.5
Accepted
time: 0ms
memory: 3960kb

input:

3 4
2 1 7168
0 2 6739
0 1 4177
1 2 5656

output:

9833

result:

ok single line: '9833'

Test #4:

score: 0
Wrong Answer
time: 28ms
memory: 7488kb

input:

16 163
7 1 8602
7 5 5148
15 7 2106
1 8 6882
7 6 341
2 5 8277
10 3 6890
7 12 9288
3 11 1893
1 5 836
9 10 1613
10 5 4106
11 6 9952
15 2 5462
9 0 8398
6 7 1839
8 9 3837
10 12 681
5 15 138
3 9 2842
15 14 1472
14 1 4981
5 2 5548
3 10 1628
13 5 8662
11 1 6026
6 14 2706
7 4 3823
5 13 5321
4 0 4229
3 4 2609...

output:

48024

result:

wrong answer 1st lines differ - expected: '125525', found: '48024'

Test #5:

score: 0
Wrong Answer
time: 0ms
memory: 3804kb

input:

6 21
5 2 5729
5 1 5380
4 0 5047
3 1 3012
4 1 1882
2 0 6338
0 3 2321
3 0 3331
0 5 3657
3 5 7222
4 5 325
0 4 2033
3 2 4845
1 3 8432
4 2 4408
0 1 2648
2 3 9071
1 2 9909
2 1 6340
4 3 1499
1 0 5345

output:

28850

result:

wrong answer 1st lines differ - expected: '30117', found: '28850'

Test #6:

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

input:

7 4
0 6 8343
4 1 3540
0 5 1251
0 4 7394

output:

8343

result:

ok single line: '8343'

Test #7:

score: 0
Wrong Answer
time: 24ms
memory: 7488kb

input:

16 200
7 1 4722
7 5 7462
15 7 8020
1 8 2702
7 6 4256
2 5 3493
10 3 9652
7 12 6204
3 11 9200
1 5 8085
7 9 4674
9 10 9840
10 15 3992
5 0 9956
8 10 3694
10 5 3168
4 12 4781
11 6 2722
15 2 8840
9 0 8219
6 7 1196
8 9 1010
10 12 7265
3 9 2143
0 2 1039
15 14 9935
11 5 7945
14 1 2370
3 10 6112
6 10 9066
13 ...

output:

73727

result:

wrong answer 1st lines differ - expected: '129867', found: '73727'

Test #8:

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

input:

5 14
4 0 156
3 4 3568
4 1 5239
2 0 4576
0 3 3899
3 0 5119
0 4 6174
3 2 3169
1 3 1862
4 2 2543
2 4 40
2 1 7826
4 3 4121
1 0 416

output:

7467

result:

ok single line: '7467'

Test #9:

score: 0
Wrong Answer
time: 1ms
memory: 3832kb

input:

9 55
7 1 3071
7 6 195
2 5 6094
1 5 5710
5 0 2115
6 7 3751
0 2 6242
7 4 3442
6 4 5506
7 8 7923
3 1 3748
6 1 2838
4 1 4636
8 1 5998
0 7 9321
0 3 6382
3 0 671
8 0 3238
1 6 6721
0 5 1947
3 6 9599
2 8 7666
6 8 8542
3 5 9338
7 3 8907
4 6 3911
8 3 3144
4 5 666
1 4 5623
2 6 7965
8 2 837
0 8 4249
0 4 9485
5 ...

output:

34730

result:

wrong answer 1st lines differ - expected: '59414', found: '34730'

Test #10:

score: 0
Wrong Answer
time: 1ms
memory: 3996kb

input:

11 90
7 1 4148
7 5 9911
1 8 7073
7 6 760
2 5 8330
10 3 5995
7 9 7832
5 0 918
8 10 1232
10 5 6011
6 7 176
3 9 6008
0 2 5241
5 2 4217
3 10 9079
6 10 3613
7 4 5957
5 1 857
4 0 2995
4 10 2133
3 4 1653
6 4 8613
0 10 6938
4 7 326
2 10 1072
0 9 2883
3 1 5480
9 1 3326
6 1 1945
5 9 7742
8 1 3899
0 7 9100
2 0...

output:

33276

result:

wrong answer 1st lines differ - expected: '77996', found: '33276'

Test #11:

score: 0
Wrong Answer
time: 135ms
memory: 19300kb

input:

18 190
7 1 1009
7 5 2471
7 6 3491
10 3 6253
7 12 6078
3 11 7630
1 5 2185
7 9 4033
9 10 2802
5 0 6996
8 10 1568
10 5 8569
11 7 891
2 17 4719
4 12 9265
15 2 9603
9 0 3072
8 9 9983
10 12 9501
0 17 3282
9 16 9117
17 2 8316
3 9 5145
0 2 1530
15 14 6677
16 13 1767
14 1 3034
5 13 6254
4 0 560
12 1 1270
3 4...

output:

55741

result:

wrong answer 1st lines differ - expected: '144931', found: '55741'

Test #12:

score: 0
Wrong Answer
time: 0ms
memory: 3828kb

input:

8 36
7 1 1442
7 5 6331
7 6 6331
2 5 7870
5 0 4489
6 7 4286
7 4 3079
3 4 4619
6 4 9084
4 7 1123
3 1 3192
4 1 1682
0 7 7132
2 0 895
0 3 3160
1 6 892
0 5 2651
6 5 3950
4 6 5848
2 6 3627
0 4 4105
5 7 4481
5 4 8588
3 2 51
2 7 4948
2 4 4367
3 7 5661
0 1 1
5 3 6342
2 3 80
1 2 881
2 1 8380
4 3 6896
1 0 4125...

output:

17913

result:

wrong answer 1st lines differ - expected: '37767', found: '17913'

Test #13:

score: 0
Wrong Answer
time: 0ms
memory: 3884kb

input:

7 17
1 5 8201
0 2 1590
5 2 9184
5 1 1426
4 0 4297
3 1 5528
4 1 4379
1 6 4387
3 6 1177
6 5 6911
5 4 6364
4 2 6692
0 1 2570
5 3 7226
1 0 7086
5 6 5744
0 6 2682

output:

16515

result:

wrong answer 1st lines differ - expected: '19174', found: '16515'

Test #14:

score: 0
Wrong Answer
time: 0ms
memory: 3876kb

input:

4 10
0 2 1424
3 1 3611
0 3 1663
3 0 5122
1 3 9981
0 1 676
2 3 8782
1 2 7550
2 1 7410
1 0 5852

output:

17008

result:

wrong answer 1st lines differ - expected: '18815', found: '17008'

Test #15:

score: 0.5
Accepted
time: 29ms
memory: 6056kb

input:

16 12
11 6 3066
3 10 561
6 8 3166
0 15 3829
1 9 2282
0 4 7746
14 12 701
15 5 9213
10 11 5084
9 6 4639
13 3 3855
8 7 6385

output:

3829

result:

ok single line: '3829'

Test #16:

score: 0.5
Accepted
time: 0ms
memory: 3788kb

input:

4 11
0 2 7596
3 1 6664
2 0 2185
0 3 3996
3 0 3167
3 2 3165
1 3 156
2 3 9750
1 2 1754
2 1 5460
1 0 7736

output:

17346

result:

ok single line: '17346'

Test #17:

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

input:

8 11
0 2 2726
7 4 4152
3 1 1728
0 7 8299
2 0 1505
3 6 7252
3 5 3844
2 6 1402
4 2 798
2 1 7710
1 0 2932

output:

8299

result:

ok single line: '8299'

Test #18:

score: 0.5
Accepted
time: 1ms
memory: 3844kb

input:

10 14
1 8 6376
1 5 4076
6 7 7948
0 2 3560
5 1 5050
0 9 7600
6 8 6109
8 3 1195
9 8 4009
0 8 1949
1 3 2844
4 8 1129
7 2 6246
3 8 3474

output:

7600

result:

ok single line: '7600'

Test #19:

score: 0
Wrong Answer
time: 0ms
memory: 3968kb

input:

6 26
2 5 6451
1 5 7939
5 0 7289
0 2 3384
5 2 8951
5 1 8332
4 0 2917
3 4 8467
3 1 163
4 1 5121
0 3 3311
3 0 791
0 5 6019
3 5 3037
4 5 9395
1 4 7338
0 4 8907
3 2 4646
1 3 1543
0 1 8032
5 3 4581
2 3 6492
1 2 2656
2 1 5989
4 3 7780
1 0 8849

output:

35042

result:

wrong answer 1st lines differ - expected: '35261', found: '35042'

Test #20:

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

input:

6 3
3 1 5219
5 1 2141
0 5 2294

output:

2294

result:

ok single line: '2294'

Test #21:

score: 0
Wrong Answer
time: 1ms
memory: 3864kb

input:

11 60
7 1 1845
7 5 7886
2 5 7196
10 3 7971
7 9 7529
5 0 5885
8 10 312
6 7 9211
8 9 8601
3 9 7673
0 2 6825
5 2 8923
3 10 626
7 4 8317
5 1 2174
4 10 2959
6 4 2732
0 10 6364
4 7 1215
0 9 7421
7 8 5179
3 1 5065
9 1 666
8 1 7570
0 7 7444
6 9 6172
3 0 4272
6 5 6915
2 8 8415
6 8 3870
1 10 2245
8 3 3310
10 ...

output:

31299

result:

wrong answer 1st lines differ - expected: '74809', found: '31299'

Test #22:

score: 0
Wrong Answer
time: 11ms
memory: 5564kb

input:

15 171
7 1 872
7 5 9032
2 5 9209
10 3 1852
7 12 2724
3 11 8043
1 5 8972
7 9 7946
9 10 8285
10 5 6395
11 7 2090
4 12 4517
11 6 8371
9 0 3142
8 9 5272
10 12 6068
3 9 5342
0 2 4792
11 5 4745
14 1 9190
5 2 4121
13 5 3188
6 14 5604
7 4 4873
5 1 6909
5 13 8154
4 0 8029
4 10 5529
12 1 8551
3 4 304
13 12 41...

output:

73520

result:

wrong answer 1st lines differ - expected: '124082', found: '73520'

Test #23:

score: 0
Wrong Answer
time: 58ms
memory: 7244kb

input:

17 19
10 3 4281
6 7 9852
9 16 6892
3 10 4952
6 10 3337
13 15 2869
2 0 9018
11 16 3368
0 15 3354
13 10 4082
15 5 4723
0 16 4582
1 3 7957
13 6 6987
4 3 5490
9 3 2699
5 6 3057
4 16 2139
7 0 2543

output:

6892

result:

wrong answer 1st lines differ - expected: '4582', found: '6892'

Test #24:

score: 0
Wrong Answer
time: 31ms
memory: 7476kb

input:

16 121
15 7 7907
1 8 5442
7 6 5973
7 9 2976
10 15 9379
8 10 368
10 5 6056
4 12 4753
15 2 5878
3 10 7261
5 13 9339
4 10 7672
3 4 1624
6 4 5108
14 10 2201
14 11 3421
4 7 1465
2 10 8823
13 0 9287
14 9 9151
12 5 3555
13 15 2794
15 1 3787
15 11 3425
3 1 3886
9 1 2345
4 1 2003
13 2 3016
11 14 7724
6 2 283...

output:

30047

result:

wrong answer 1st lines differ - expected: '112855', found: '30047'

Test #25:

score: 0
Wrong Answer
time: 7ms
memory: 4620kb

input:

14 140
7 1 7474
7 5 4846
7 6 7068
2 5 8651
10 3 5544
7 12 1062
3 11 5800
1 5 2367
9 10 288
5 0 797
8 10 4575
11 7 1516
11 6 8375
6 7 6675
8 9 1456
10 12 4710
3 9 4957
0 2 2336
11 5 4372
5 2 2358
3 10 9276
6 10 1671
13 5 8769
11 1 8816
7 4 1163
5 1 600
4 0 5373
12 1 7833
13 12 5586
0 10 2052
12 10 29...

output:

53560

result:

wrong answer 1st lines differ - expected: '105722', found: '53560'

Test #26:

score: 0
Wrong Answer
time: 32ms
memory: 7428kb

input:

16 203
7 1 342
7 5 2499
15 7 6301
1 8 6536
7 6 6128
10 3 6517
7 12 9007
3 11 6173
1 5 9418
7 9 2766
9 10 7096
10 15 2714
5 0 5789
8 10 5512
11 7 1969
11 6 2475
15 2 504
9 0 4649
6 7 6483
8 9 6268
10 12 2021
5 15 5602
0 2 5621
15 14 4770
11 5 5866
14 1 5794
5 2 6158
3 10 7177
6 10 7708
13 5 379
11 1 ...

output:

87979

result:

wrong answer 1st lines differ - expected: '128487', found: '87979'

Test #27:

score: 0.5
Accepted
time: 0ms
memory: 3808kb

input:

5 6
3 1 6486
0 3 3275
0 4 2376
3 2 4209
4 2 7497
2 1 9990

output:

2376

result:

ok single line: '2376'

Test #28:

score: 0.5
Accepted
time: 0ms
memory: 3780kb

input:

7 7
1 5 3024
3 1 1694
0 5 5219
6 5 6185
6 3 8599
0 4 41
0 6 5138

output:

5138

result:

ok single line: '5138'

Test #29:

score: 0
Wrong Answer
time: 0ms
memory: 3960kb

input:

5 18
0 2 6850
4 0 657
3 4 3842
4 1 9000
0 3 1096
3 0 6349
1 4 4974
0 4 9870
3 2 969
1 3 4444
4 2 5872
2 4 6461
0 1 3346
2 3 8966
1 2 8473
2 1 9836
4 3 8567
1 0 1631

output:

24627

result:

wrong answer 1st lines differ - expected: '24972', found: '24627'

Test #30:

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

input:

3 5
0 2 3917
2 0 8127
0 1 5702
1 2 7923
2 1 5910

output:

13625

result:

ok single line: '13625'

Test #31:

score: 0.5
Accepted
time: 0ms
memory: 3764kb

input:

4 10
0 2 4378
3 1 4329
2 0 309
0 3 6650
3 0 4444
3 2 3848
1 3 3709
0 1 3560
1 2 4196
1 0 1229

output:

7269

result:

ok single line: '7269'

Test #32:

score: 0
Wrong Answer
time: 0ms
memory: 3808kb

input:

4 11
0 2 1738
3 1 3200
2 0 139
0 3 3348
3 0 2758
3 2 533
1 3 7156
2 3 1041
1 2 5373
2 1 9574
1 0 9117

output:

7156

result:

wrong answer 1st lines differ - expected: '18468', found: '7156'

Test #33:

score: 0
Wrong Answer
time: 7ms
memory: 4732kb

input:

14 44
7 6 2796
7 12 8286
1 5 6974
7 9 4974
11 6 2320
3 9 262
5 2 533
4 0 6814
4 10 6541
6 4 3274
12 10 1124
4 7 6452
12 5 5435
7 8 1558
3 1 7776
13 1 740
6 1 6824
11 4 850
2 0 8593
0 3 8332
8 0 7172
13 11 7596
5 10 7499
11 10 9953
12 9 1401
6 3 5651
7 3 9209
8 3 9377
10 7 4701
3 12 5548
1 4 3412
0 8...

output:

4612

result:

wrong answer 1st lines differ - expected: '59905', found: '4612'

Test #34:

score: 0
Wrong Answer
time: 1ms
memory: 3836kb

input:

9 28
7 1 3259
7 5 6958
2 5 821
6 7 2404
0 2 6442
5 1 7576
7 8 4333
6 1 6789
0 7 4792
3 0 4381
1 6 530
3 6 8909
6 8 8188
3 5 1984
4 6 2566
4 5 2138
0 8 1471
0 4 181
5 7 7552
4 8 8154
2 7 4678
2 4 7032
8 4 7536
5 3 3007
4 3 8219
6 0 4828
8 5 4294
3 8 5054

output:

27497

result:

wrong answer 1st lines differ - expected: '43206', found: '27497'

Test #35:

score: 0.5
Accepted
time: 0ms
memory: 3828kb

input:

4 7
3 1 851
2 0 1844
0 3 9370
1 3 8875
1 2 5397
2 1 437
1 0 6262

output:

9370

result:

ok single line: '9370'

Test #36:

score: 0
Wrong Answer
time: 3ms
memory: 4616kb

input:

14 155
7 1 1187
7 5 9600
1 8 2244
7 6 9087
2 5 6754
10 3 4579
3 11 1430
7 9 5356
9 10 7576
5 0 1291
8 10 3975
11 7 498
4 12 3146
11 6 6336
9 0 9465
8 9 2779
10 12 703
3 9 7795
11 5 3522
5 2 2828
3 10 6783
6 10 4040
13 5 6428
11 1 6849
5 1 4945
5 13 9876
4 0 3295
4 10 7002
12 1 4120
3 4 9624
13 12 80...

output:

74421

result:

wrong answer 1st lines differ - expected: '111973', found: '74421'

Test #37:

score: 0
Wrong Answer
time: 0ms
memory: 3884kb

input:

5 9
0 2 2415
3 4 1736
3 1 6331
3 0 4710
0 4 9947
4 2 6436
2 4 7715
1 2 6133
2 1 3398

output:

13848

result:

wrong answer 1st lines differ - expected: '10130', found: '13848'

Test #38:

score: 0.5
Accepted
time: 1ms
memory: 3856kb

input:

10 14
7 1 8989
6 4 3262
0 9 5735
9 1 2782
8 1 4301
1 6 4208
9 8 6351
4 2 2636
0 1 2481
8 4 5050
5 3 4239
6 0 3869
9 3 5395
1 0 9575

output:

5735

result:

ok single line: '5735'

Test #39:

score: 0.5
Accepted
time: 0ms
memory: 3804kb

input:

4 9
0 2 773
3 1 1595
2 0 3128
0 3 8317
3 2 3636
1 3 6026
0 1 4020
1 2 8701
1 0 2391

output:

10046

result:

ok single line: '10046'

Test #40:

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

input:

2 2
1 0 1603
0 1 4216

output:

4216

result:

ok single line: '4216'

Test #41:

score: 0.5
Accepted
time: 0ms
memory: 3872kb

input:

3 2
0 2 6371
0 1 8050

output:

6371

result:

ok single line: '6371'

Test #42:

score: 0
Wrong Answer
time: 131ms
memory: 19236kb

input:

18 112
7 5 7628
10 3 3896
17 12 5919
16 8 4890
10 15 8473
17 9 9324
8 10 1716
11 7 4535
4 12 7598
8 9 4875
0 17 5541
9 16 2626
5 15 396
16 14 405
15 14 5792
16 13 6679
5 2 3633
3 10 5158
6 10 3003
11 1 1784
5 1 3076
5 13 4363
4 10 9397
13 12 5820
6 4 6356
14 16 4612
13 17 6862
14 11 1059
12 17 3390
...

output:

45747

result:

wrong answer 1st lines differ - expected: '125698', found: '45747'

Test #43:

score: 0
Wrong Answer
time: 3ms
memory: 4728kb

input:

14 93
7 1 3615
7 5 4717
1 8 2462
7 6 796
10 3 6242
7 12 1166
1 5 1308
10 5 836
4 12 384
11 6 4963
6 7 9862
8 9 864
10 12 4846
0 2 4630
5 2 367
3 10 3457
7 4 7380
5 13 8797
4 10 2482
12 10 3314
2 10 6845
5 11 2266
3 1 4475
9 1 2627
13 1 519
6 1 7873
4 1 8998
11 4 4355
3 13 3102
8 1 5388
2 0 2238
8 11...

output:

36638

result:

wrong answer 1st lines differ - expected: '108778', found: '36638'

Test #44:

score: 0
Wrong Answer
time: 127ms
memory: 18900kb

input:

18 102
2 5 8027
7 12 1900
1 5 2521
7 9 1722
5 0 2315
8 10 8634
15 2 2328
8 9 2557
0 17 1917
16 5 5963
17 2 4661
5 15 752
11 5 1144
5 1 675
5 13 685
4 0 6599
4 10 5288
12 1 8883
6 4 3845
14 16 5620
14 4 8659
2 10 4749
13 0 7379
0 9 7007
5 11 5395
7 8 2024
3 1 5228
4 1 3286
5 9 49
16 0 9933
3 13 3518
...

output:

15186

result:

wrong answer 1st lines differ - expected: '115099', found: '15186'

Test #45:

score: 0
Wrong Answer
time: 0ms
memory: 4000kb

input:

11 89
7 1 7804
7 5 1810
1 8 8772
7 6 2484
2 5 239
10 3 3433
1 5 6993
7 9 2396
8 10 2726
10 5 4140
9 0 3780
6 7 7811
3 9 9086
0 2 1840
5 2 7890
3 10 7448
6 10 9977
7 4 8451
5 1 7248
4 0 1604
4 10 174
3 4 2417
6 4 8232
0 10 2629
4 7 8268
2 10 5033
0 9 3340
7 8 229
3 1 4623
9 1 6221
6 1 1688
4 1 8216
5...

output:

48360

result:

wrong answer 1st lines differ - expected: '84779', found: '48360'

Test #46:

score: 0.5
Accepted
time: 0ms
memory: 3896kb

input:

3 1
0 2 8405

output:

8405

result:

ok single line: '8405'

Test #47:

score: 0
Wrong Answer
time: 0ms
memory: 3900kb

input:

6 24
2 5 8003
1 5 2116
0 2 2132
5 2 4785
5 1 7007
4 0 4395
3 4 1673
3 1 2637
4 1 3252
2 0 9755
0 3 5606
3 0 7054
0 5 3202
4 5 7830
1 4 5199
5 4 5055
4 2 7017
0 1 6181
5 3 7481
2 3 3704
1 2 3751
2 1 6140
4 3 57
1 0 7232

output:

23139

result:

wrong answer 1st lines differ - expected: '28462', found: '23139'

Test #48:

score: 0
Wrong Answer
time: 3ms
memory: 4300kb

input:

13 115
7 5 4677
1 8 751
7 6 8724
2 5 7311
10 3 3056
7 12 580
3 11 7963
1 5 38
7 9 9293
9 10 8109
8 10 7309
10 5 9302
11 7 808
11 6 5231
9 0 4092
6 7 2580
8 9 2746
10 12 179
5 2 7210
3 10 3935
11 1 3996
7 4 9360
5 1 921
4 0 7909
4 10 3489
12 1 7608
3 4 2842
6 4 9127
0 10 7431
12 10 9396
4 7 3473
2 10...

output:

53380

result:

wrong answer 1st lines differ - expected: '99703', found: '53380'

Test #49:

score: 0
Wrong Answer
time: 138ms
memory: 19304kb

input:

18 221
7 1 1632
7 5 6779
15 7 2958
1 8 3287
7 6 7496
2 5 9983
10 3 8641
7 12 897
1 5 7271
7 9 9725
16 8 4722
9 10 4987
10 15 2444
17 9 1711
5 0 7251
8 10 1562
10 5 1887
11 7 203
2 17 9507
11 6 4602
15 2 9482
8 9 4999
0 17 6776
16 5 8795
9 16 6967
17 2 4684
3 9 6751
11 5 1958
16 13 9537
3 10 8829
6 1...

output:

64009

result:

wrong answer 1st lines differ - expected: '146160', found: '64009'

Test #50:

score: 0.5
Accepted
time: 0ms
memory: 3888kb

input:

5 11
4 0 8704
3 4 8229
3 1 4134
4 1 504
0 3 5551
3 0 5304
0 4 9423
4 2 2802
0 1 2971
2 1 7236
1 0 3378

output:

13780

result:

ok single line: '13780'