QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#630293#6845. Taxrxzfn639TL 1150ms3860kbC++231.2kb2024-10-11 17:37:572024-10-11 17:37:57

Judging History

你现在查看的是最新测评结果

  • [2024-10-11 17:37:57]
  • 评测
  • 测评结果:TL
  • 用时:1150ms
  • 内存:3860kb
  • [2024-10-11 17:37:57]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
const i64 P = 998244353;
void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> w(m + 1), ans(n + 1), len(n + 1, n + 1), cnt(m + 1);
    for (int i = 1; i <= m; i++) cin >> w[i];
    vector<vector<pair<int, int>>> G(n + 1);
    for (int i = 0; i < m; i++) {
        int u, v, c;
        cin >> u >> v >> c;
        G[u].push_back({v, c});
        G[v].push_back({u, c});
    }
    auto dfs = [&](auto dfs, int u, int dep, int val) -> void {
        if (dep < len[u]) {
            len[u] = dep;
            ans[u] = val;
        } else if (dep == len[u]) {
            ans[u] = min(ans[u], val);
        }
        dep++;
        for (auto [v, c] : G[u]) {
            if (len[v] < dep) continue;
            cnt[c]++;
            val += cnt[c] * w[c];
            dfs(dfs, v, dep, val);
            val -= cnt[c] * w[c];
            cnt[c]--;
        }
    };
    len[0] = 0;
    dfs(dfs, 1, 0, 0);
    for (int i = 2; i <= n; i++) cout << ans[i] << '\n';
}
int main() {
    ios::sync_with_stdio(0); cin.tie(0), cout.tie(0);
    int t = 1; 
    // cin >> t;
    while(t--) solve();
    return 0;
}

詳細信息

Test #1:

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

input:

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

output:

1
9
1
3

result:

ok 4 lines

Test #2:

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

input:

10 15
730 2163 6818 4647 9699 1037 2034 8441 2619 6164 464 4369 4500 6675 1641
1 6 2
3 6 1
3 2 1
9 2 2
7 3 1
6 5 1
5 3 2
3 10 1
10 2 2
5 10 1
8 2 2
9 8 1
7 4 2
4 5 2
4 10 2

output:

4353
2893
7219
2893
2163
4353
8679
8679
4353

result:

ok 9 lines

Test #3:

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

input:

10 15
847 2302 8846 8055 585 6541 6493 7165 5376 8551 836 2993 2700 9323 5119
2 1 5
2 3 3
3 10 3
10 4 3
8 3 4
10 8 1
3 7 3
4 5 3
5 8 5
6 3 3
8 6 2
6 5 4
9 10 2
7 9 4
5 9 4

output:

585
9431
53661
18656
27123
27123
17486
29425
27123

result:

ok 9 lines

Test #4:

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

input:

20 30
4547 9278 5093 443 7292 7570 7138 9315 4114 723 9854 9584 294 1861 5478 2734 5967 7102 6137 9504 456 7980 9645 6571 336 5308 1035 8008 3128 4035
7 1 2
11 7 1
11 12 2
12 10 2
10 5 2
20 5 1
20 17 2
17 16 2
16 18 1
7 19 3
19 12 1
2 18 2
3 7 1
12 3 1
19 3 1
13 11 1
12 13 1
19 13 1
13 3 2
18 15 2
8...

output:

166078
13825
98229
41653
28012
9278
28012
38198
37474
13825
18918
18918
24557
166078
106231
78397
128966
14371
56754

result:

ok 19 lines

Test #5:

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

input:

20 30
2477 6652 1326 9801 9300 5132 8051 7482 5793 1154 4960 1452 2591 6386 6573 9726 7902 868 9089 6179 7249 2439 5355 8561 7168 3785 9180 2898 8103 5168
10 1 2
10 15 5
15 2 3
2 5 1
6 5 5
9 6 3
9 18 2
20 18 1
20 14 3
8 2 5
13 10 3
13 2 1
5 19 1
9 19 4
19 8 3
9 12 1
19 12 4
7 15 5
7 2 4
16 10 2
16 1...

output:

10455
13107
40665
15409
24709
29256
19755
27361
6652
67805
32208
7978
52074
15952
19956
34510
40665
22407
48096

result:

ok 19 lines

Test #6:

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

input:

20 30
3440 3226 6455 7629 6160 9354 1868 2631 4819 1142 7323 8166 4862 9851 7430 8785 3563 7421 2271 9637 6088 2754 4062 8932 7510 7797 9647 8657 4123 293
9 1 18
9 4 17
4 14 7
14 17 7
7 17 14
3 7 13
3 10 11
10 16 16
16 13 6
9 20 20
20 4 13
10 8 3
13 8 16
4 5 20
11 16 11
8 11 13
2 17 12
4 18 1
18 17 ...

output:

23732
30279
10984
15466
17730
25417
44057
7421
37602
53781
24185
52842
12852
20175
46387
15566
14424
12240
17058

result:

ok 19 lines

Test #7:

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

input:

30 50
7129 2843 1688 6915 6827 4756 6845 140 1403 8426 6939 8317 2320 9371 1611 8403 8356 3846 7594 9874 6888 5183 7945 6815 2910 3776 1550 2580 5566 5155 3505 1935 945 4665 3328 4162 9529 6486 7771 8357 471 354 7208 3344 8628 7321 4624 9058 3737 6828
1 10 3
10 17 1
17 5 1
21 5 1
21 9 3
30 9 3
30 8 ...

output:

4531
55325
85265
11660
10217
41067
32538
18657
1688
15036
161199
120867
20722
85265
73893
8817
89352
149383
85265
13593
99480
73893
75137
8817
7129
63765
55325
66697
25409

result:

ok 29 lines

Test #8:

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

input:

30 50
1816 811 3173 8236 9775 9764 9318 2725 3832 2365 5954 6959 72 3542 3353 6839 5277 3333 9313 3833 8198 1409 1669 7304 1094 5752 7393 9532 8997 6858 728 5391 1567 5803 2319 5231 8563 9045 1695 928 6021 4868 6246 1639 3132 6408 5335 1263 6884 6134
17 1 8
17 10 7
10 28 4
3 28 6
3 7 9
7 22 6
25 22 ...

output:

88680
11738
77782
107316
83230
19402
74150
59701
4643
7008
13961
61202
2365
38986
89353
2725
85975
83011
12489
49926
29166
79838
59386
36261
64375
48304
12879
3832
66652

result:

ok 29 lines

Test #9:

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

input:

30 50
9227 712 7087 3799 7334 2513 2685 8147 5727 415 5898 8487 1938 9946 6164 46 7086 5664 318 3545 840 7810 6397 4201 6297 6036 9036 3750 5708 3216 7705 8875 17 3620 1046 6055 6077 3839 4393 605 9048 6984 1692 6869 317 5863 3725 3897 1213 9498
23 1 5
29 23 1
30 29 14
24 30 19
24 14 15
14 16 15
16 ...

output:

58976
54062
20296
55016
25960
15302
55431
36391
48335
33210
58561
15523
21051
65140
19399
72869
25063
46194
29836
70356
18368
7334
14887
33625
1938
39108
23796
4623
14569

result:

ok 29 lines

Test #10:

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

input:

30 50
5448 5807 3224 8952 8304 8530 5876 727 784 1901 7392 2903 8670 6927 1771 2274 4866 9258 794 9474 7772 5238 8948 2154 3691 4109 917 6173 1719 7485 3788 9957 8904 9705 6252 1773 8092 4024 8863 8888 5061 2373 9550 184 4905 4045 3114 6519 4400 9876
1 2 11
9 2 17
9 24 7
24 5 24
12 5 34
29 12 5
29 4...

output:

7392
50123
24002
12810
20902
31604
8119
12258
22068
41795
22515
12442
53875
58060
31774
49567
62545
37777
47482
26560
27116
63133
18134
26156
27693
49756
41001
23275
52561

result:

ok 29 lines

Test #11:

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

input:

40 50
7141 3687 8409 3882 3187 6878 5145 491 1769 4034 9678 9137 7998 9960 9383 604 7306 4107 535 4895 4170 1927 1124 3027 573 7950 8425 3602 1129 4551 676 7260 6102 4234 3720 357 5633 9349 5676 7845 7755 7386 7851 1015 9880 8110 7090 3914 7073 92
26 1 2
5 26 2
30 5 1
14 30 2
12 5 1
12 39 1
30 3 2
1...

output:

22122
29263
32484
11061
21423
43545
18202
32484
18202
32484
18202
25110
29263
25110
53907
43545
3687
58293
29263
32484
43545
32484
32484
22122
3687
53907
18202
10828
18202
10828
29263
7141
43545
32484
10828
7141
29263
32484
43545

result:

ok 39 lines

Test #12:

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

input:

40 50
3550 4246 2743 1166 9068 9921 4276 9903 3846 3706 3231 6720 950 9253 8797 8222 3242 3654 1910 2491 9491 9689 5203 570 7111 4413 2374 997 160 8611 258 3447 1883 1188 351 2995 666 4569 4168 7563 1506 5825 220 825 382 8350 7040 3417 9226 4408
1 37 1
37 15 4
15 35 3
2 35 4
11 15 3
2 12 4
4 1 1
33 ...

output:

9791
14037
3550
7796
15277
8962
11705
17454
2743
7459
13289
7459
11705
4716
14037
7048
9791
6989
24635
4716
16062
11705
18805
17535
11705
4246
11705
17535
20197
6293
8962
11816
17191
7459
20389
3550
12475
11705
21137

result:

ok 39 lines

Test #13:

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

input:

40 50
6324 7516 8231 869 6928 3161 8484 8886 6656 4740 6205 6425 3058 6571 522 1895 7751 2720 6454 4651 7779 9785 3599 1620 383 3999 8983 1287 6583 4399 8501 9660 6221 6988 5925 3500 1876 1883 9716 953 8693 1749 5461 7958 7229 1320 9710 8219 6381 5367
1 30 9
27 30 13
24 27 6
24 37 3
27 29 9
12 27 5
...

output:

29329
37568
33890
19265
20068
13744
28434
36845
6324
32579
16642
44139
11396
24158
21260
13840
11944
15140
19446
17370
23213
21359
12875
28034
22630
9714
24298
23026
6656
33448
26374
23001
26390
22110
28746
21106
19446
30729
8886

result:

ok 39 lines

Test #14:

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

input:

40 50
3155 2853 7048 6482 5037 1695 4171 9685 1590 579 8293 3794 8226 445 708 6304 7865 3502 9897 3416 4232 315 3994 6201 4732 6220 1025 1255 6170 190 6475 5592 3962 2594 9801 3734 5095 9100 5874 6623 4224 2756 2879 3112 555 5640 3886 3542 1661 5384
1 11 25
11 31 3
31 4 40
14 4 8
4 28 35
38 14 5
38 ...

output:

58203
32436
18403
47766
31819
51728
55992
53329
30047
4732
24604
36914
28088
52354
39901
23440
36069
52861
21244
42887
34027
40083
49088
52803
36667
22635
28204
39326
36624
11780
28403
40069
35125
15951
28643
22653
33125
19111
55110

result:

ok 39 lines

Test #15:

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

input:

50 100
9400 6363 1176 8951 4801 3283 7949 4588 1161 6901 8301 7311 1900 7944 3213 1057 5241 2819 4614 9730 2052 5218 9622 7594 6740 2968 2144 6132 1766 6151 7031 8157 7480 825 9559 8985 5039 4155 5133 4143 5650 1517 6953 1960 3116 899 4835 484 9182 5271 1172 5332 1514 7540 5448 3025 1785 9324 2275 5...

output:

126159
187872
274220
1176
178464
12479
21879
107070
171603
20711
183363
54376
49672
28242
3528
10127
210279
31770
91782
210216
10127
81198
67102
238416
68472
98838
178464
54376
36474
192834
117927
20711
54376
12479
38616
62398
161019
151611
60256
67102
73176
1176
153012
7539
311820
210216
16007
7298...

result:

ok 49 lines

Test #16:

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

input:

50 100
8240 7415 7952 6913 9892 3649 6284 2996 7935 1716 7358 7425 8728 1747 4736 480 9949 8266 816 1739 3212 6436 273 3122 7882 1666 6009 5831 2560 4923 6401 515 5752 1062 1544 2063 5156 993 385 5212 7896 1006 8032 3851 2075 5073 896 4582 4522 6771 9856 1685 1221 7746 1745 5018 9840 4254 5450 1910 ...

output:

128594
303634
18802
213022
71451
27752
36109
92290
26217
29213
24388
183223
278498
53625
34153
246730
77443
26217
192058
279690
6913
278498
32384
90011
266514
32628
167319
165933
271866
43039
299474
150029
191578
56621
20454
28082
25086
274382
237742
32501
100242
172726
299474
180529
191709
63517
10...

result:

ok 49 lines

Test #17:

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

input:

50 85
2999 6976 3472 6677 8361 8394 8333 3013 9489 4970 9434 6093 1299 969 5194 2383 907 1393 5041 5599 4184 2498 7974 1640 2604 7280 6040 231 6862 3730 678 2526 8887 6389 8678 5587 7368 9000 7967 4718 9571 2446 286 7679 5310 1487 9413 4309 9684 4742 9367 8520 9459 1604 8670 224 9966 9708 6886 3819 ...

output:

160868
50562
60360
1977
26587
160868
74702
89753
53575
2946
72401
94947
96885
30753
133112
40614
45481
118479
47958
136203
8986
78427
33752
131646
145550
17319
30874
25680
145781
135610
99483
116149
38804
1299
130205
43774
117234
139486
115199
65401
66308
123252
106160
13956
109890
43218
33257
29113...

result:

ok 49 lines

Test #18:

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

input:

50 49
4809 6241 6063 3007 5326 2587 2620 9604 4597 8453 3771 6578 7057 3741 1385 6718 6331 4914 2120 4963 9007 2953 4590 4928 4875 8347 9123 4712 8051 8324 7 4977 2448 70 6921 4774 6476 2212 2625 5477 5063 199 7959 6498 5173 9741 4281 9938 5086
1 25 33
25 13 21
43 13 18
31 43 37
31 32 8
32 19 30
19 ...

output:

153604
197749
126879
214803
153674
53977
115576
43393
72698
340966
160595
11455
120816
173547
368190
299623
85437
40773
219084
284986
353448
51352
396142
2448
256205
275060
78939
59063
316529
22845
32449
251242
115569
202677
233868
391552
93784
331418
225415
373363
294727
16369
143776
97555
238580
1...

result:

ok 49 lines

Test #19:

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

input:

50 269
8772 4767 6243 8961 1273 343 7907 6384 6219 4524 330 2426 8970 302 6975 3672 8151 3601 8863 2951 9897 8108 3804 522 6731 9386 3833 869 6172 4107 8368 7124 8941 5412 9468 9794 1431 4267 8959 8850 3010 6444 429 1066 6863 7815 9407 4851 9776 4351 7570 7147 9338 540 5957 4722 4986 9450 3358 9600 ...

output:

138327
28743
82608
65064
82608
138327
38277
100530
28743
28743
50763
38277
162162
138327
119259
13539
28743
50763
119259
50763
11010
100530
19782
119259
65064
28743
50763
100530
11010
4767
19782
28743
119259
13539
82608
4767
8772
162162
162162
100530
38277
19782
11010
119259
38277
6243
50763
8772
65...

result:

ok 49 lines

Test #20:

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

input:

50 256
3851 484 7665 9522 7179 9670 4086 4079 7462 1907 1291 5302 817 879 4620 9239 6901 8916 8606 9191 3725 7777 3095 3164 2314 5159 3857 2258 4066 2107 2619 777 3389 4232 4695 4548 1927 7114 6237 3147 7409 5971 23 5930 3536 2969 307 3264 7917 7542 4997 5089 9827 2551 5250 8517 1235 2174 965 7846 1...

output:

41222
77344
32144
18904
34043
41222
5531
67674
42201
67674
25715
30692
17084
43679
43679
43642
32107
51344
43713
34080
4563
43642
30692
41259
4563
49980
59502
39286
59502
9382
8414
4570
47560
30692
4335
41259
30692
32144
22990
51344
24442
484
5531
24263
41222
43679
4079
37466
9382

result:

ok 49 lines

Test #21:

score: 0
Accepted
time: 10ms
memory: 3664kb

input:

50 400
4854 3873 6490 2864 7115 4132 4115 2742 2420 5025 9948 409 5130 8776 6673 265 5562 4057 1487 3019 7174 6220 9483 7494 4642 8377 6491 5080 3655 4160 4890 7919 4290 4931 3432 1697 6854 1911 8744 6196 4790 9383 3537 2086 2044 1025 1406 982 6693 2598 7310 9289 1379 1950 916 7894 2010 7186 8168 45...

output:

21455
33696
29190
34592
14293
8744
20449
7174
27943
28765
34612
30930
30611
31321
32323
29030
12072
30791
31016
5025
8199
31932
30922
30930
30969
28208
29190
31546
31593
33521
7174
33884
33827
7439
28925
31321
31610
34191
31840
31335
31863
30517
32075
30930
29695
30100
33233
31744
7494

result:

ok 49 lines

Test #22:

score: 0
Accepted
time: 22ms
memory: 3632kb

input:

50 363
2223 9955 5736 1379 3130 2969 5992 8338 3871 7470 8953 6368 5152 5993 3889 7829 7698 9459 1125 6539 606 1132 5282 9348 2976 1060 3381 131 5803 946 9459 1441 740 913 8866 5962 7443 8014 1022 1758 277 1531 3445 7664 988 5152 9163 8234 5133 6772 7031 3863 7905 9048 8996 9832 9909 285 6545 2848 9...

output:

17737
26603
32012
32602
35697
33856
24601
32658
33763
34466
34369
28801
34990
34784
34446
31742
17131
32607
31408
33026
34831
33629
34619
32622
32753
32764
32622
27577
37523
9688
25365
34446
35482
34693
34830
35282
37667
31024
32247
30888
31475
31765
35620
33939
42277
34155
31155
32329
18641

result:

ok 49 lines

Test #23:

score: 0
Accepted
time: 46ms
memory: 3576kb

input:

50 302
7207 6507 2137 8682 4127 9809 5239 9380 420 139 4516 5774 4961 2479 5655 1271 726 6517 1880 402 1814 5800 3895 901 5449 1083 4884 7755 2795 514 5844 4210 7867 2661 8371 8254 4349 3745 12 2308 2424 7558 7603 2032 8185 1674 8635 1887 2479 228 7344 1830 60 6722 2015 2681 4538 1603 185 3172 9940 ...

output:

4429
5960
5032
5793
16767
3876
2677
9236
9444
1379
5951
16267
6493
7647
8489
3984
10516
4744
1317
6393
1443
11159
9739
5981
392
4612
13638
6313
9427
6684
9485
3095
19539
13650
1831
6948
5157
5536
6039
4285
3202
8684
6274
591
3103
5230
8930
2987
6467

result:

ok 49 lines

Test #24:

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

input:

50 203
4788 6635 8305 1264 1336 244 4347 6291 4894 3070 8790 6454 2060 3417 1879 5804 5594 8891 650 8445 532 7980 4525 3475 4745 5993 4256 3486 6031 7796 3052 1969 9324 5394 2329 6786 1566 92 7542 3150 725 2031 9365 3506 5028 508 5307 4563 9507 3688 2197 7495 2528 1229 5486 3626 9545 3271 5466 2650 ...

output:

68538
354795
233589
200073
68538
24693
87690
233589
68538
271893
401240
54174
44598
44598
501788
54174
271893
54174
401240
401240
233589
54174
6635
68538
233589
271893
4788
401240
311703
354795
166898
311703
138170
554868
44598
44598
271893
166898
54174
171345
354795
401240
11423
200073
501788
23358...

result:

ok 49 lines

Test #25:

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

input:

50 167
193 5596 8410 2500 4824 6675 8241 8943 662 196 259 4191 5061 477 1563 4900 1073 3409 3338 6611 700 8965 256 8338 1834 9588 1015 5854 5366 4236 2201 1384 4748 1903 2773 772 9948 9699 4622 5161 8414 6594 3820 1156 5096 5291 4553 9972 9017 3391 3844 6479 8514 1797 9362 6348 7768 4710 6248 2151 1...

output:

20954
72040
74549
64540
8675
23454
14006
8096
74991
15044
15026
11000
6754
7526
60101
12149
39646
62224
7526
15936
58171
65671
56434
5789
6175
72040
10991
12544
15936
6754
16901
5789
41383
8491
11000
28454
8491
8289
8410
5789
9649
58171
8675
10026
23454
88860
91369
5596
69724

result:

ok 49 lines

Test #26:

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

input:

50 170
3235 8580 5943 2954 7636 9162 3451 8287 5098 3999 8929 3176 6373 9323 8932 8136 4488 5883 7696 9605 6780 5726 6679 6202 4667 9946 7744 1669 7493 6967 7763 9209 2174 7986 4958 2077 3486 5084 7443 4956 4768 1241 2695 7955 5987 7170 5093 5511 3420 1795 8569 3980 4178 7677 8246 46 8561 9141 9617 ...

output:

4623
66858
75745
83441
70309
63682
73172
11464
9163
79923
63965
95438
90448
60746
10276
8603
67860
66472
41651
82381
60262
46609
1669
7469
8287
17085
72791
11285
76026
6797
37163
1715
28022
63438
9459
5987
21646
16096
69193
71095
59417
40774
42825
45122
13691
85492
53576
81308
55178

result:

ok 49 lines

Test #27:

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

input:

50 193
8974 7621 9349 9671 7812 2638 7855 369 2608 7058 3402 2025 1117 5092 8300 478 6332 6941 9167 1858 320 3307 4656 155 3729 2845 8304 6565 7833 9496 8759 4477 25 7925 4156 4328 6709 5008 1054 3546 4244 8410 7726 3696 1201 2729 8498 631 5197 7539 6916 2466 2458 7366 4433 9767 8513 5171 7643 7507 ...

output:

21842
79233
64633
45238
70681
71728
71728
68939
62073
66288
67756
78634
14901
72176
71883
70206
45813
68409
59746
64598
72668
69526
70503
66594
68409
55756
46455
45713
71704
69585
68384
66390
56344
64531
48978
47923
69151
71027
31009
43850
5230
70748
73580
69694
36792
72043
70140
68921
45238

result:

ok 49 lines

Test #28:

score: 0
Accepted
time: 39ms
memory: 3624kb

input:

50 155
7291 9324 224 401 2686 4666 8212 7025 2910 8014 5684 2442 7506 9218 5374 9341 662 1552 9768 6976 87 456 1946 9245 9015 4031 7569 6849 1215 9995 5310 6334 2872 7528 2613 649 5521 2438 2063 4140 5357 4840 7032 949 3314 1190 2993 8661 8458 5292 8863 1155 5109 8425 9946 5799 550 8081 5167 7007 17...

output:

51312
23322
11566
55942
9911
38302
41584
17500
6448
7741
12748
14024
8145
50911
42608
1937
64901
38412
40151
44062
16346
70779
55635
60833
43261
10537
71273
49176
52238
50261
47667
29866
38078
37256
49039
15208
58065
5147
43530
11969
36607
39698
20644
50174
42847
13785
45895
27651
54910

result:

ok 49 lines

Test #29:

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

input:

50 110
3462 8793 7341 3785 4740 673 1009 7271 4939 1224 3068 4244 5691 2297 3449 6628 8970 6196 8663 3712 8803 3242 2475 8516 4274 4642 364 6657 3898 2200 7542 6268 4607 3240 5880 4365 9356 7847 1286 3633 6559 5227 6759 3145 7608 3198 2999 6777 4702 7871 8551 6474 2217 4592 408 5736 9145 553 2356 88...

output:

110454
182357
55779
210870
12684
25626
124792
189974
84681
178619
254082
22164
73784
189974
237249
69999
244652
146815
74793
91494
142748
195730
33896
5413
129909
7341
4740
268323
23510
111288
263612
88466
240614
21477
164771
183731
113307
22823
261485
132362
12081
36019
87120
26972
184375
41237
884...

result:

ok 49 lines

Test #30:

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

input:

50 114
2285 2942 191 5139 3554 1090 5000 3439 1595 6614 897 3459 478 9728 4777 7455 4754 4953 8019 1606 3301 8302 9381 6784 4711 5058 5178 1273 3165 858 4288 5104 5343 3231 9547 9657 2985 2688 7600 8043 7342 573 5851 2803 7632 7741 3802 2928 7370 5081 9775 8500 9606 8270 2817 5097 5719 959 2492 2826...

output:

33847
13579
68117
74444
89354
84444
61546
67132
79631
43450
37078
72650
28326
98276
40268
1090
39363
28135
77557
10140
18579
37401
71504
8545
41776
94722
34592
35165
42553
59612
66323
69593
35586
25193
34898
23455
53904
34325
60782
38088
36483
75334
70549
87672
49334
64244
28708
38985
76601

result:

ok 49 lines

Test #31:

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

input:

50 72
1036 5767 7035 6889 3207 5665 9071 5370 8046 7576 759 8956 9470 2298 5962 904 8808 3977 530 9897 1824 4842 5150 4799 479 8775 2577 702 5457 9070 4849 2668 1704 3745 4713 8294 3319 4804 4503 3659 4423 34 1071 8527 6421 7593 7046 3098 1410 9561 9367 5287 5762 6440 8258 3765 5646 4337 9144 9177 6...

output:

156218
214915
161410
206388
65999
51142
9557
83929
93490
32159
229067
58423
215975
145835
19438
136375
196962
142622
23203
160931
152473
133948
106328
160641
124938
128915
229582
164039
188220
122796
131576
14596
75695
145446
170235
96809
179412
138952
133418
13894
161967
2668
230681
224783
187005
1...

result:

ok 49 lines

Test #32:

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

input:

50 73
997 3257 5772 1903 8001 2930 5096 322 2331 7252 1258 9372 1557 7530 9422 2212 1481 1957 4822 8933 370 4218 7913 6814 8639 6673 527 5136 675 4263 1766 4948 5799 4557 4544 8771 7543 4134 5219 5067 4289 7085 2791 1537 7241 3837 3004 6794 6344 8039 6561 8688 2056 3472 1870 3971 6378 9056 5211 4293...

output:

109267
46626
17799
64535
127287
92751
101522
180423
50919
187541
9334
181163
202769
141560
192955
197337
5497
675
137331
132753
80037
132383
25764
43154
178367
196761
71349
100827
110179
126643
175363
159902
133960
52822
152372
7034
134330
107710
40224
85836
151022
35157
87289
11005
181135
13378
137...

result:

ok 49 lines

Test #33:

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

input:

50 109
4316 1850 5279 2409 8152 2671 9623 1508 7679 6120 4946 2921 7294 628 8039 5038 1494 5587 6352 1055 7771 4476 701 1452 7205 6824 8927 9368 5618 8869 6637 7819 8210 308 386 5489 3434 6010 2973 4570 4578 3571 4847 2008 8247 3803 609 6915 7578 6611 2267 1544 1118 3810 9822 6982 7966 9649 9611 676...

output:

14896
46092
96276
71621
104110
50405
92043
91671
37632
68187
31865
108680
78118
88505
25794
87732
91671
91671
96621
75125
55953
23672
55252
45784
21664
82703
81624
117607
40304
35675
37354
124911
25263
7691
73805
129674
33021
55652
112266
25124
93073
105746
95535
78782
74923
60429
90127
32265
78504

result:

ok 49 lines

Test #34:

score: 0
Accepted
time: 80ms
memory: 3568kb

input:

50 330
3738 2289 3855 4517 8882 381 9784 787 5716 8215 628 7122 9882 999 3326 6107 3955 2088 6776 5644 2048 6423 9092 2134 6935 3562 9947 7470 7636 5527 5914 2668 3251 4584 129 6559 7735 318 146 7670 1575 3787 4120 1608 2123 2006 2733 5934 1699 6491 8066 3348 7056 3673 1643 9723 9769 4786 2448 7994 ...

output:

16578
20507
7259
5685
6935
2469
5795
9307
13665
14846
4119
14084
381
17207
5137
9784
11560
16730
15474
16411
18957
19329
15849
10997
7843
16578
11051
16024
15978
16740
14834
15579
20595
20276
19398
7187
14475
13847
13085
19586
18651
18039
9935
10749
13890
13085
18112
4898
7503

result:

ok 49 lines

Test #35:

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

input:

50 363
4775 8344 2244 3322 19 2607 7951 6482 6886 5428 1060 7591 3827 3500 145 4042 1859 3025 8218 3038 2964 5600 6788 7562 4660 6698 4218 4970 8842 2406 4572 9535 9422 7389 2587 8010 9836 9229 1567 9845 4646 3447 8993 4794 3343 9298 4257 9977 7440 3109 9905 3751 2310 3936 2487 2330 322 8068 2879 31...

output:

13237
11780
13302
15246
12897
7883
12542
21156
22126
18624
17406
7492
10195
18808
19890
11792
11792
16029
13891
16221
11822
12840
11710
322
8540
12494
18627
8344
10213
13004
18662
13660
10193
14084
11204
17220
15994
3665
17422
10927
12523
10762
16504
8325
9551
22999
10908
12859
14297

result:

ok 49 lines

Test #36:

score: 0
Accepted
time: 13ms
memory: 3568kb

input:

50 388
864 7740 7428 5214 386 996 539 1300 7010 9341 8813 6816 8445 6667 9227 1254 1572 5602 5383 5103 6316 8766 9320 3911 4751 5004 266 7070 8666 6319 3547 6888 6125 7772 9248 6461 3678 6622 3918 6281 6854 3123 1233 2893 8642 3292 7160 4268 3427 7537 3878 6671 3678 9243 3187 1458 1693 1497 3482 612...

output:

22865
23970
26448
13259
23384
23285
22418
21992
5342
9062
3123
16416
14002
25475
22696
22470
18824
17137
12052
23029
23493
4588
4485
22304
24433
21508
24782
21238
24384
15010
22673
20815
5129
22167
16085
23095
26067
23299
22740
26244
22697
23285
9220
23477
8905
22925
24341
22574
6260

result:

ok 49 lines

Test #37:

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

input:

50 429
1716 3916 5112 4802 4255 9079 1665 5299 8556 5590 7464 5089 6959 1505 9307 4619 7696 5807 636 6534 2461 2959 7523 8489 4374 2562 4506 5568 2336 9198 2223 4586 7379 7005 7173 3675 908 6092 4899 7115 3932 1837 5491 36 7654 6773 7316 7015 9557 3550 8121 9208 6628 7350 8680 286 5396 2623 8284 146...

output:

14431
12751
15364
14307
18927
15212
14265
12856
11637
19823
16190
8013
14230
16355
15343
15398
12189
10035
14059
15910
16187
13193
16215
10724
15943
15369
14613
3623
13110
12130
16090
15682
17729
11448
13682
14783
6327
13353
15233
15101
3451
11883
12222
12186
8209
11909
16809
13854
9131

result:

ok 49 lines

Test #38:

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

input:

50 167
214 4415 6281 3252 5489 1995 3809 6380 308 202 5218 8776 9460 8444 6985 7778 4346 8723 5804 6789 1157 2261 7009 5396 5093 3742 6292 8785 7953 8588 5941 4646 5122 7761 967 3216 4006 9605 4227 4190 750 6786 979 8966 5392 4198 471 5313 1413 6068 2131 2651 1212 9683 3023 6692 5126 2765 4214 449 8...

output:

55594
26704
13887
20949
58274
17739
26490
14529
29700
13245
4415
58274
60842
59232
15385
45964
58274
20949
55920
13459
16455
38260
48960
52170
52170
27774
19237
69830
13459
22875
22875
59232
22875
48960
20949
55594
66620
60842
40614
55594
19237
76892
52170
26704
26490
55594
25015
43182
63084

result:

ok 49 lines

Test #39:

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

input:

50 174
5231 6193 1351 3613 9562 9534 8973 3955 3824 1515 1779 5140 9016 7153 7449 6448 8652 3723 1636 5133 6571 728 4942 8534 2648 3069 1953 5607 2120 449 5008 9203 6952 2512 7759 3535 6214 5209 6502 5060 4259 144 9409 9920 8439 4620 5106 821 9245 5002 462 1513 8786 4328 9948 4725 9450 9403 7626 103...

output:

17912
10246
23143
11157
25939
6193
81361
23143
7544
13859
7544
191473
70553
60091
50634
17912
104359
13859
175261
25939
81361
81361
131197
144707
50634
23143
81361
23143
92200
60091
42528
159568
70553
116745
81361
13859
42528
191473
81361
28547
92200
92200
5231
35302
130255
175261
28547
17912
7544

result:

ok 49 lines

Test #40:

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

input:

50 181
516 2436 196 3613 2751 9392 3227 1541 1228 2297 7497 8381 8610 3706 1265 3000 479 1311 2121 8110 9986 5818 7867 5690 5602 4914 4663 7309 6037 9535 5552 554 4682 8623 3083 6440 1520 6229 3075 3347 8748 4388 6951 5516 4487 6280 4842 2452 1598 7997 5747 5493 6064 630 4427 4873 3396 9416 561 7776...

output:

40235
49121
37534
9955
24420
28075
28794
4265
24733
39203
43848
28271
33185
19532
44527
20895
26854
29348
15929
9986
28663
18365
36138
9535
24039
21504
23192
16739
4265
26447
25961
24601
25080
17255
32989
20655
14618
6867
24420
45958
41776
36138
29667
24122
56916
38649
44686
24936
1265

result:

ok 49 lines

Test #41:

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

input:

50 183
5491 2127 912 346 9559 9143 3761 6162 9785 920 1987 2694 7999 7136 8094 3235 1412 2717 9760 5548 8601 8164 1305 9910 1279 5486 8559 3564 3405 8405 5035 4459 4256 2716 4203 9127 9158 8308 4398 1781 8130 7192 7995 9599 5164 3474 4586 1587 8478 4803 5401 2164 8823 1311 5928 2887 1244 7198 5549 2...

output:

7198
36287
8979
42821
19338
29812
17073
10223
28353
39998
62092
31123
46182
59567
38018
40182
55402
27096
22392
36524
30480
22967
14752
60951
12711
42274
12036
19211
25108
13987
35246
16854
17679
39842
51403
24379
56261
13057
11106
58876
28140
43404
54097
37106
60893
33829
20360
13093
18387

result:

ok 49 lines

Test #42:

score: 0
Accepted
time: 117ms
memory: 3860kb

input:

50 171
2272 5547 3841 4854 5326 3379 1994 7166 4946 2918 8689 6128 2543 1563 810 9685 7544 3084 9308 8184 1527 2071 833 3369 2361 4030 8890 9260 3856 9542 1914 1211 656 8507 5526 4848 2578 1547 7819 4444 3331 87 1192 339 9334 2837 8767 3550 4558 5856 6777 4999 2517 8246 8015 7264 1593 1961 4609 7165...

output:

19976
4682
16269
57574
46503
28845
45240
23007
20837
18625
19638
48619
42473
20786
55057
62188
22599
22752
24104
51367
56202
20939
25418
47695
23708
17032
45129
20231
17688
22379
13901
16945
26918
60491
52789
12257
57968
51536
54438
51354
50140
17982
51201
18859
11946
51245
19976
33165
48283

result:

ok 49 lines

Test #43:

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

input:

50 194
5266 9762 626 2632 2176 3780 7066 2807 8084 4864 7164 4325 1502 7234 4393 1409 1170 9964 3592 2096 3560 1059 9170 7799 4652 7423 9110 3970 9471 3919 8662 7873 1188 5379 5497 9334 2628 9888 9239 7656 2026 6560 1168 3666 7144 9967 5157 9732 3937 8111 93 9153 8444 8629 626 3632 2839 3706 9729 22...

output:

35238
8633
5476
28658
40575
58279
59057
58849
40430
42203
66950
37568
40616
13925
43177
42432
51025
39822
39446
41416
30102
4844
42889
63581
25591
41693
49708
38527
11241
57946
40523
51752
38194
2608
41306
55107
3234
4274
34925
2726
39693
47403
46760
43328
23720
61811
38194
12459
57414

result:

ok 49 lines

Test #44:

score: 0
Accepted
time: 89ms
memory: 3616kb

input:

50 180
2141 1183 6063 9858 9975 3687 1236 3582 848 8813 8856 7319 4587 9547 3217 7257 6671 9483 6761 2097 1288 7742 8285 5442 5413 4504 1645 9393 8536 9521 1760 2249 6457 6501 1181 9224 6644 4341 2418 9168 5062 7892 8496 9815 196 3628 6333 6679 8228 7190 2145 767 4001 5381 217 2752 6363 3676 9736 68...

output:

46161
15874
50408
48548
19658
48879
24469
19083
16771
13055
13057
9990
46161
38122
48793
13456
22155
51295
47390
15267
19636
49784
13047
32474
12186
37969
7562
13652
17962
17175
19609
35312
50865
47776
23977
17111
7782
9362
47218
17576
44651
40374
28114
21281
12826
10855
17143
18895
1533

result:

ok 49 lines

Test #45:

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

input:

50 128
789 5616 7479 2919 388 6604 3213 3024 4685 2053 4078 3900 4270 1820 9666 4053 2059 5364 1511 9384 8537 7684 8076 3414 5156 377 7046 8662 553 4833 9069 1842 9868 8080 9232 1397 6804 1807 5565 9956 5274 7304 6010 4066 5118 5900 5359 4185 1650 5853 7289 4376 7868 3124 985 8096 8216 1212 9699 819...

output:

453174
105768
330876
55224
371070
66456
630198
170865
514206
387639
86460
330876
326142
326142
241956
52857
204561
505527
28842
371070
108924
336399
7479
387639
52857
8268
5616
13884
86460
83304
336399
330876
514206
394740
112869
51279
570366
137004
30420
336399
142785
108924
342711
445284
789
28126...

result:

ok 49 lines

Test #46:

score: 0
Accepted
time: 2ms
memory: 3648kb

input:

50 111
8336 9149 9205 3045 5564 1539 4919 9060 8859 7431 175 8386 5447 6969 9201 717 1486 1058 772 9573 4017 1276 7155 6047 9958 9350 8814 8706 7623 5457 4058 6541 497 1413 5981 1791 6950 429 8339 3982 6555 2214 7004 9025 5163 1173 7259 1766 1154 9870 8712 1885 898 2829 8943 4394 7825 4017 8927 3895...

output:

367697
462889
372209
43370
338687
116015
143574
384389
81947
65275
296483
42877
341765
49980
154981
119255
363074
349927
56070
3045
363080
11381
373562
83685
16300
41831
305632
379772
44416
242927
259776
179989
25159
102583
346382
350900
91785
358457
170151
367592
323930
465504
92745
426069
349638
4...

result:

ok 49 lines

Test #47:

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

input:

50 70
1331 4438 8063 6437 4525 9445 3601 6618 8155 9682 5860 3706 90 4740 2431 151 7085 5190 7725 5828 7256 567 2270 3515 8135 7272 6551 9191 9109 8178 6814 3274 6149 5773 7903 7464 7517 5754 4138 6826 5094 6651 3890 6717 2670 7397 6367 8800 1925 5173 6173 8713 2963 4296 43 2033 7137 8145 6925 6355 ...

output:

113456
121594
121141
275678
19076
154031
9682
11013
123864
242863
25087
314181
300011
163457
217475
110654
94528
159538
29827
37083
77881
49406
230632
120164
45238
155732
72053
25087
329057
7256
143228
291948
258098
229301
246378
94007
29525
87326
19227
63918
114590
250836
12446
120074
242773
202025...

result:

ok 49 lines

Test #48:

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

input:

50 101
2423 8045 8024 2037 1577 3833 6558 647 471 8531 4501 6075 7693 4299 9627 9073 8041 1796 8849 338 3039 1864 5803 5782 1702 9954 9332 2332 6649 1698 6199 7782 6888 2269 6743 506 8100 1467 2952 5938 3910 7735 1955 2141 3784 259 8694 5932 5146 9713 2114 9141 879 7547 123 8484 1053 6235 828 3093 1...

output:

10909
134141
82149
91149
5455
15798
78685
131872
31900
94888
34852
12705
26300
59104
93186
68731
84421
26196
95220
98959
24159
95808
76377
141300
41336
130000
28292
89931
7072
100921
27767
14059
86650
103091
112593
121734
21736
48947
134965
42389
42164
70595
129758
5117
14578
77338
54256
138694
132696

result:

ok 49 lines

Test #49:

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

input:

50 70
835 85 1391 4228 1904 6343 5283 8466 4371 4424 6310 8713 1011 6792 4632 3552 4618 7224 4012 6677 4276 15 1018 7447 851 2792 2238 2556 2605 1634 8039 1645 4652 6175 1065 2230 6189 9285 5004 7591 5250 2528 6346 4629 9280 9678 8325 2025 6562 9761 9646 1472 8596 1425 1023 745 8472 6935 3843 538 50...

output:

57558
3464
183548
43371
116800
13225
151826
47795
177214
28244
108828
8451
62562
67210
175341
192273
118458
6310
166628
108328
75249
116228
2613
127694
116228
18129
42295
80690
176986
6426
160282
89758
42775
85
146770
79299
143218
6256
81292
111610
56540
83142
113384
129364
41757
52424
32472
27409
8...

result:

ok 49 lines

Test #50:

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

input:

50 109
1316 9211 6593 4282 7045 5711 1425 164 4501 4919 7321 1709 9038 1207 8671 1939 6460 724 5129 580 8499 1417 1363 4903 4119 2694 893 4068 6738 9596 8059 6423 3137 5506 8179 1169 1223 9987 8562 4663 5705 9454 4632 1761 9553 9653 2007 3676 2028 4942 2952 5929 9803 3797 9334 4396 3062 4152 1312 75...

output:

36466
84625
58508
6922
43554
73591
78153
38573
29527
37354
93344
102332
9148
29691
37918
20535
76728
79790
43469
17834
21953
22073
28274
39035
32221
17124
10924
38938
46006
38409
70910
35396
40974
98869
34703
15827
6922
37046
86300
95338
36712
7402
74788
42683
51899
33390
4396
5711
97718

result:

ok 49 lines

Test #51:

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

input:

50 49
5415 8231 2249 4888 4388 8708 977 4459 3360 8815 8976 3609 6653 4380 4154 1657 9056 1781 4422 5881 7634 9530 7807 2729 1343 5259 4804 5852 3754 9168 4040 7019 4888 7026 4610 4833 9520 7679 9454 2575 3186 2057 8363 5130 4749 360 2460 184 5990
30 1 2
30 42 2
3 42 1
3 23 2
23 31 1
34 31 2
22 34 2...

output:

4031631
30108
841071
786921
1692750
2016570
1514055
696380
1600695
344183
3896256
522015
900636
2396493
1893105
2777496
410031
1241786
254076
647645
139710
54801
3098505
1064388
1357020
1432830
2256566
447936
8231
65631
2124870
1171391
98555
3271356
565335
177615
204690
2658366
2544651
286566
24693
...

result:

ok 49 lines

Test #52:

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

input:

50 49
3186 104 7409 8294 6024 2362 8717 7178 4397 9410 3960 3608 172 7421 3286 6149 5077 2330 3920 9164 8361 8716 2450 6713 1663 523 9165 31 3 8786 2294 291 2737 3602 6261 9806 4878 2718 1319 7070 7152 7309 8909 9573 6321 28 395 3113 6352
1 16 2
32 16 5
45 32 4
45 10 1
10 36 2
36 28 5
11 28 2
11 5 1...

output:

539404
336421
384655
36548
751685
226831
882182
385903
17608
30176
487541
337461
452255
666962
104
575548
119328
177224
46522
597850
106584
748461
753453
81702
184633
278363
29864
176600
227663
623338
6128
152504
624794
750021
17816
805316
46106
704007
472723
471371
277427
509768
63630
14422
383511
...

result:

ok 49 lines

Test #53:

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

input:

50 49
4503 9195 7092 9635 7588 5748 2391 5974 2981 7222 9097 6700 9923 2688 3401 5881 878 7270 2742 8545 9545 6129 2855 7600 2284 7229 5429 35 4930 9626 8668 5341 857 3132 766 2563 4852 8411 7231 7968 6412 8964 4698 2594 8635 3013 5994 5915 3743
38 1 4
48 38 23
48 30 21
30 33 14
33 24 8
24 9 9
9 7 1...

output:

299174
364799
55017
453563
168179
39054
102432
33678
219448
469627
74235
404460
442811
150171
281252
48888
167301
247083
183838
413655
193761
398498
30697
86645
62287
208595
180437
79945
22035
432608
261267
24723
465059
113852
339104
427124
9635
217692
322014
419536
200563
95210
128296
46146
227993
...

result:

ok 49 lines

Test #54:

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

input:

50 49
1848 6212 4089 9159 7923 2094 6862 8989 9121 9346 2185 5606 7096 440 6719 2684 3424 16 926 5184 3542 7627 4867 4134 8060 3152 9697 2582 311 8329 7793 9885 9904 9811 3884 7898 9124 7154 8339 4881 5892 3786 9944 715 9734 23 7666 356 2258
1 24 10
13 24 29
13 10 21
10 26 10
12 26 48
14 12 12
18 14...

output:

108135
123175
104711
63041
311131
53154
330902
132872
13199
369138
32247
9657
37853
63064
312561
224080
49065
322608
295877
229244
55248
116313
9346
326796
31891
378127
267016
361392
338800
79329
71406
207262
181271
148458
361346
328644
92622
88488
70691
313487
164304
358194
173605
288793
166886
257...

result:

ok 49 lines

Test #55:

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

input:

50 49
7556 3908 4243 1244 9414 3543 5551 7798 2815 9267 5659 7237 9836 2 1014 9062 2924 7362 6642 5254 9860 2978 4181 3578 8491 6281 1930 3864 1182 2048 4350 7660 5677 2850 4771 9684 6604 6531 8752 3108 5731 4150 3838 8451 3327 8246 3885 6412 7630
37 1 3
45 37 40
3 45 17
18 3 31
18 20 4
20 24 10
24 ...

output:

277321
10275
204509
283277
28714
265713
214369
158489
58181
68689
174227
127621
345961
366137
108553
41528
14625
91978
15869
140829
119823
245747
25136
269551
94793
101397
52927
71177
324945
183289
354441
79949
31692
150243
218519
4243
88435
254198
299039
226027
173213
316011
351591
7351
261828
2218...

result:

ok 49 lines

Test #56:

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

input:

50 49
6465 3844 656 8533 481 6235 5585 195 9684 3781 6153 4852 7071 5975 6071 7336 3434 4699 2637 8609 6370 1725 6113 55 6967 9905 2527 9383 543 7435 580 4544 7154 9557 37 1829 9515 3708 6070 7134 2349 1044 6900 6 8732 464 5596 8366 2288
28 1 44
28 40 17
40 45 33
45 14 14
2 14 1
36 2 29
36 15 39
15 ...

output:

23034
178687
129482
154424
227751
44960
115246
37082
106713
77362
254565
156963
16569
29647
48741
61293
73599
89207
122582
145334
154436
282609
329699
258409
43235
185057
6
130526
198022
242423
194572
86919
145815
296409
23577
275475
204093
132614
3440
133194
164379
54326
314619
10594
329894
319794
...

result:

ok 49 lines

Test #57:

score: 0
Accepted
time: 1150ms
memory: 3588kb

input:

50 120
5482 7445 5532 9309 3339 6377 3057 5750 4556 2328 2258 3935 9031 6103 8162 4452 4285 991 9420 8762 7152 715 3468 1367 5641 5261 7462 485 5651 7369 8302 9331 2926 55 8943 9956 8477 5829 5429 5597 6968 7652 5458 7835 795 7398 2460 3531 6373 2967 8701 3409 730 8753 1570 5698 1890 2645 1437 6889 ...

output:

5482
55227
12927
23891
908337
695616
509970
695616
309027
226797
762621
99490
455150
99490
403035
23891
833887
985085
985085
265171
455150
309027
833887
569530
509970
569530
156680
5482
38781
189572
353697
38781
629832
908337
762621
16446
403035
1066980
156680
265171
189572
55227
226797
77155
126900...

result:

ok 49 lines

Test #58:

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

input:

50 120
8915 1031 4770 7351 3172 5556 6168 3675 6711 9651 646 3428 8650 6729 6818 5828 7072 4706 1256 5023 7405 8380 3799 5326 5002 3001 4117 5134 2199 2145 3703 8510 9556 8861 9498 9876 3975 2477 5453 2137 2121 6451 4820 3544 2569 5862 4055 3491 4391 4288 3680 8734 6378 529 4417 3650 5611 8281 7292 ...

output:

167809
57759
208550
192690
164681
150371
100570
1031
103392
149979
55934
125359
21524
78387
39673
44222
27167
25624
117833
33511
193852
176022
122981
31947
15180
8382
13616
18273
9946
112671
66275
135669
31968
67275
93852
11554
51573
72201
92322
74492
37503
103131
11554
82740
45229
180541
140061
735...

result:

ok 49 lines

Test #59:

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

input:

50 120
7536 7501 5042 4963 4556 4059 7527 3506 1756 749 2486 8097 9500 69 8973 7492 413 3448 4577 2404 7798 8752 2679 7739 6622 6461 2379 9611 3236 1983 5500 6376 4695 7166 1950 665 9823 243 6950 1499 9826 2444 6946 8126 5967 7532 1215 3270 3751 4376 17 9099 2862 8059 5870 3817 6527 5987 547 1889 61...

output:

86199
5681
64798
43935
59306
78930
57129
3448
52087
9129
72709
70462
16656
20597
43330
25705
413
54787
18558
72916
92919
90569
83520
68806
67308
68058
13052
83815
16020
48028
35631
41689
29751
57059
23512
11057
77724
35700
2169
75477
37082
35838
4969
50655
8475
57808
74159
70669
34678

result:

ok 49 lines

Test #60:

score: 0
Accepted
time: 1120ms
memory: 3648kb

input:

50 120
1114 9578 8693 137 8233 956 9915 2657 5759 7570 571 678 8960 3927 3977 2420 1589 9992 450 5339 9276 5351 4517 4958 1541 4507 4325 231 838 1870 4616 7841 7641 9822 2923 1021 1257 9564 4235 4750 6808 8656 3437 7389 1580 3859 7255 357 3789 4803 8965 8152 5097 4851 4117 744 6305 8744 3899 9695 40...

output:

56597
55158
50668
75670
17534
76170
78090
53224
58138
48427
38415
42172
45911
12183
48647
21078
28423
68482
26402
47399
48290
26164
21215
40590
73848
8586
31261
19114
25187
65073
14601
19858
54927
67132
63015
7346
17337
51346
73098
35305
43927
25143
14958
3437
22329
64030
67582
9394
67638

result:

ok 49 lines

Test #61:

score: 0
Accepted
time: 1135ms
memory: 3564kb

input:

50 120
8703 4620 4082 6136 6996 9870 3154 3707 2848 6410 7400 7958 3970 1746 5318 1613 3694 1313 2847 8268 2906 4625 894 1744 7137 3251 6848 2395 1187 604 789 644 5411 434 7779 1253 6488 6627 5475 7083 6732 750 4066 1114 80 1783 1921 3799 2918 4200 6806 4092 3814 2171 7545 2407 4745 1105 9880 6026 1...

output:

12584
63765
5370
59445
25248
13528
43509
35105
27029
25716
25946
37347
21077
28833
50249
22116
14229
47763
42865
31731
50169
22759
28813
58193
49431
9714
59361
44113
46827
43956
32238
19249
27692
41972
1288
59932
35085
13773
59020
43469
3521
6228
65509
37855
37781
51143
25915
1114
50917

result:

ok 49 lines

Test #62:

score: -100
Time Limit Exceeded

input:

50 189
7257 9772 589 624 3097 8979 9833 9481 6569 6898 8846 6495 4582 3540 3182 2560 7411 4874 2795 5836 1221 3797 9503 5866 3815 9741 2933 321 4407 973 1581 8847 5687 9140 6172 3126 957 4741 618 3290 6979 8744 2274 5188 9752 6583 1109 6210 4301 3970 8135 8820 4072 8171 4513 8241 4100 2475 2909 7312...

output:


result: