QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#4823#438. 美食家Qingyu100 ✓387ms46604kbC++113.3kb2020-08-19 15:53:032021-12-19 05:29:52

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 5 5 2
9 99 141
1 2 1
2 3 2
3 1 2
1 3 1
1 3 2
4 2 546192273
5 1 6172

output:

6430

result:

ok answer is '6430'

Test #2:

score: 5
Accepted
time: 2ms
memory: 26036kb

input:

4 7 5 2
62 371 208 312
1 2 1
2 3 2
3 4 1
4 1 1
2 4 2
3 4 2
1 4 1
4 4 13094
3 3 33899

output:

48008

result:

ok answer is '48008'

Test #3:

score: 5
Accepted
time: 3ms
memory: 26164kb

input:

5 12 5 3
171 1 1627 14 3959
1 2 3
2 3 1
3 4 2
4 5 3
5 1 3
1 2 3
2 4 2
2 4 2
5 1 3
2 5 3
4 2 3
5 3 2
2 1 61934
4 2 20655
3 4 52501

output:

-1

result:

ok answer is '-1'

Test #4:

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

input:

5 12 5 3
19 198 196 250 2129
1 2 2
2 3 2
3 4 1
4 5 1
5 1 2
2 5 1
5 2 2
2 5 2
4 1 2
2 4 2
3 1 2
4 5 1
4 3 69347
5 2 15485
3 5 52501

output:

54866

result:

ok answer is '54866'

Test #5:

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

input:

25 45 52497 185
781 50 344 27 238 816 699 683 322 300 7 708 8016 1933 524 2206 7138 540 2685 18266 189 1585 3401 21085 6529
1 2 5
2 3 5
3 4 2
4 5 4
5 6 4
6 7 3
7 8 4
8 9 5
9 10 3
10 11 3
11 12 3
12 13 1
13 14 5
14 15 2
15 16 1
16 17 2
17 18 1
18 19 4
19 20 1
20 21 4
21 22 2
22 23 4
23 24 4
24 25 3
25 1 5
7 17 4
3 20 5
10 13 2
15 18 3
7 12 2
16 22 4
11 18 5
11 15 1
5 16 2
8 20 1
19 23 2
7 23 5
2 19 5
10 2 3
5 19 2
15 24 3
14 8 5
13 23 3
6 2 5
5 17 5
20860 10 85872
46311 7 43389
34782 8 62574492
3...

output:

19100096713

result:

ok answer is '19100096713'

Test #6:

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

input:

25 45 52501 186
77 297 468 52 308 370 2572 101 1399 5099 42 3 828 1634 1060 701 3144 3094 3726 982 2435 2528 2264 18084 2423
1 2 2
2 3 5
3 4 3
4 5 1
5 6 4
6 7 3
7 8 3
8 9 1
9 10 4
10 11 3
11 12 4
12 13 1
13 14 3
14 15 4
15 16 5
16 17 2
17 18 5
18 19 2
19 20 2
20 21 1
21 22 2
22 23 2
23 24 2
24 25 2
25 1 4
3 20 4
19 15 4
13 18 1
1 7 2
4 7 3
2 8 3
13 22 3
25 16 4
9 15 5
16 19 1
9 20 5
25 22 4
14 19 2
14 6 5
14 4 5
6 23 1
1 18 5
5 13 1
2 20 1
1 18 4
32938 15 29025
28494 3 9007
45349 17 334661853
45...

output:

16261622399

result:

ok answer is '16261622399'

Test #7:

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

input:

35 50 52497 187
474 273 85 203 627 261 76 1970 1523 5280 1406 970 3977 1371 1161 2524 684 719 852 2877 1998 3540 846 2082 9946 570 8917 2947 19161 3624 3200 3022 1786 1621 5078
1 2 1
2 3 3
3 4 1
4 5 2
5 6 2
6 7 1
7 8 2
8 9 1
9 10 1
10 11 5
11 12 1
12 13 5
13 14 2
14 15 5
15 16 5
16 17 3
17 18 1
18 19 4
19 20 4
20 21 1
21 22 3
22 23 5
23 24 1
24 25 3
25 26 2
26 27 1
27 28 5
28 29 5
29 30 4
30 31 3
31 32 4
32 33 5
33 34 2
34 35 2
35 1 3
15 33 4
3 10 5
12 25 3
14 25 1
7 15 5
23 14 3
6 9 2
7 32 5
13...

output:

16727334141

result:

ok answer is '16727334141'

Test #8:

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

input:

20 40 52497 185
49 289 88 678 41 299 1326 194 622 1527 9216 1515 401 352 2350 1809 1092 5017 1820 1812
1 2 5
2 3 5
3 4 5
4 5 5
5 6 4
6 7 3
7 8 3
8 9 5
9 10 4
10 11 2
11 12 4
12 13 2
13 14 4
14 15 5
15 16 1
16 17 1
17 18 2
18 19 3
19 20 5
20 1 2
1 9 2
8 14 1
4 16 1
2 12 4
1 14 2
14 9 5
18 9 4
13 4 5
10 6 4
20 16 5
10 18 4
9 14 2
17 1 4
4 13 1
15 6 5
3 19 2
7 2 3
12 8 5
2 18 4
3 10 3
14946 20 28768
9628 1 18188
11279 18 56572
31231 9 79231
34880 20 8162
14984 10 13685
45058 4 4915
34978 6 75740
15...

output:

17017559829

result:

ok answer is '17017559829'

Test #9:

score: 5
Accepted
time: 3ms
memory: 16844kb

input:

45 45 999999474 187
172 770 127 321 2616 499 5851 4338 1129 377 106 1365 1195 703 1332 3066 645 1950 12782 3900 376 11640 220 2574 8777 3059 3059 18567 748 24887 20621 1002 361 11 5345 34362 11404 16476 2218 20221 4008 5087 1022 21615 41579
1 2 4
2 3 2
3 4 3
4 5 5
5 6 5
6 7 5
7 8 3
8 9 1
9 10 2
10 11 5
11 12 3
12 13 1
13 14 4
14 15 4
15 16 4
16 17 5
17 18 1
18 19 3
19 20 2
20 21 4
21 22 4
22 23 2
23 24 3
24 25 4
25 26 1
26 27 2
27 28 1
28 29 3
29 30 5
30 31 4
31 32 3
32 33 3
33 34 3
34 35 3
35 3...

output:

2192904771297

result:

ok answer is '2192904771297'

Test #10:

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

input:

50 50 999999972 188
166 387 401 159 479 183 1211 1271 1581 615 2057 669 432 2821 2814 2632 1695 7751 2260 2722 996 3686 1555 631 13221 3853 407 1665 3020 607 5855 3698 4153 3417 4299 6531 4710 1289 10317 6013 4404 1774 32428 261 31197 4274 5181 6124 4563 5333
1 2 3
2 3 5
3 4 5
4 5 3
5 6 2
6 7 2
7 8 2
8 9 2
9 10 2
10 11 3
11 12 2
12 13 4
13 14 5
14 15 1
15 16 3
16 17 5
17 18 5
18 19 5
19 20 4
20 21 5
21 22 1
22 23 4
23 24 1
24 25 2
25 26 4
26 27 4
27 28 3
28 29 1
29 30 2
30 31 1
31 32 1
32 33 5
3...

output:

1306756880996

result:

ok answer is '1306756880996'

Test #11:

score: 5
Accepted
time: 72ms
memory: 19776kb

input:

30 45 964010246 0
50 5 1364 669 913 1084 284 7529 1448 486 1208 11208 1281 2565 2974 9101 570 2792 2539 542 15806 2403 4516 2641 4873 1056 5131 24290 4312 5867
1 2 3
2 3 3
3 4 4
4 5 4
5 6 2
6 7 4
7 8 3
8 9 3
9 10 3
10 11 4
11 12 5
12 13 3
13 14 5
14 15 2
15 16 1
16 17 5
17 18 3
18 19 3
19 20 3
20 21 4
21 22 3
22 23 3
23 24 4
24 25 5
25 26 1
26 27 2
27 28 3
28 29 3
29 30 2
30 1 1
25 13 3
27 9 3
6 22 1
17 27 2
9 21 4
4 17 3
14 6 5
26 6 4
4 24 4
13 21 4
12 24 3
7 12 2
25 7 5
1 16 3
28 18 3

output:

2502418347081

result:

ok answer is '2502418347081'

Test #12:

score: 5
Accepted
time: 111ms
memory: 19788kb

input:

35 50 990789960 0
44 213 166 80 3022 487 649 616 475 1141 795 102 1132 194 289 1055 1173 1477 10494 17252 421 280 2578 640 1214 691 2595 4528 8182 4506 13146 4643 2740 26836 5968
1 2 1
2 3 1
3 4 4
4 5 5
5 6 4
6 7 4
7 8 4
8 9 3
9 10 1
10 11 4
11 12 4
12 13 4
13 14 1
14 15 5
15 16 5
16 17 1
17 18 5
18 19 4
19 20 2
20 21 3
21 22 2
22 23 5
23 24 2
24 25 3
25 26 4
26 27 4
27 28 1
28 29 3
29 30 3
30 31 1
31 32 5
32 33 1
33 34 4
34 35 4
35 1 1
24 20 5
20 2 4
33 6 3
7 25 2
1 20 1
7 33 3
19 28 4
25 13 4
...

output:

4194426729874

result:

ok answer is '4194426729874'

Test #13:

score: 5
Accepted
time: 65ms
memory: 19684kb

input:

30 45 939748758 0
130 138 428 236 203 654 1071 592 1719 518 1375 1254 924 2172 2880 6255 3011 2688 17400 1383 708 4255 3929 13855 8364 343 247 7003 2380 3307
1 2 3
2 3 5
3 4 2
4 5 1
5 6 1
6 7 3
7 8 2
8 9 3
9 10 4
10 11 2
11 12 5
12 13 4
13 14 1
14 15 1
15 16 4
16 17 1
17 18 3
18 19 2
19 20 4
20 21 4
21 22 1
22 23 4
23 24 1
24 25 4
25 26 1
26 27 4
27 28 1
28 29 4
29 30 3
30 1 1
4 15 5
24 30 2
8 17 4
5 8 4
13 17 1
27 3 5
5 12 1
23 17 5
7 24 4
25 11 4
19 22 3
14 20 1
18 23 4
18 21 2
2 6 4

output:

1736300115608

result:

ok answer is '1736300115608'

Test #14:

score: 5
Accepted
time: 68ms
memory: 19896kb

input:

30 50 978105877 10
21 93 486 741 104 980 322 542 1377 33 911 30 1786 9715 2553 2621 317 397 751 2991 7586 3423 3280 21465 3271 2739 3684 3760 4484 5435
1 2 3
2 3 5
3 4 2
4 5 5
5 6 4
6 7 1
7 8 2
8 9 5
9 10 1
10 11 1
11 12 2
12 13 1
13 14 5
14 15 4
15 16 4
16 17 4
17 18 1
18 19 3
19 20 1
20 21 1
21 22 1
22 23 5
23 24 4
24 25 2
25 26 1
26 27 5
27 28 4
28 29 1
29 30 1
30 1 3
29 26 3
5 20 4
8 16 2
14 21 3
11 2 5
28 13 4
8 25 1
4 7 2
11 29 1
8 28 5
7 29 4
11 28 5
8 16 3
25 29 2
9 1 5
12 27 3
11 16 4
9...

output:

1746483071396

result:

ok answer is '1746483071396'

Test #15:

score: 5
Accepted
time: 63ms
memory: 18564kb

input:

30 50 900969268 10
37 379 526 182 173 732 1319 3040 4688 6301 163 472 2590 10857 383 2887 1084 1734 3094 3093 2626 385 21941 1065 2731 1302 5225 2592 1460 2978
1 2 5
2 3 2
3 4 4
4 5 5
5 6 1
6 7 1
7 8 4
8 9 1
9 10 4
10 11 4
11 12 3
12 13 1
13 14 1
14 15 5
15 16 5
16 17 2
17 18 5
18 19 4
19 20 4
20 21 4
21 22 5
22 23 1
23 24 3
24 25 3
25 26 2
26 27 4
27 28 1
28 29 2
29 30 1
30 1 5
7 2 3
9 2 5
7 19 2
30 1 5
2 30 1
9 14 4
26 30 1
16 20 5
20 14 3
7 19 3
2 15 3
8 20 1
18 27 4
24 27 1
16 29 1
4 12 4
17...

output:

1147285073996

result:

ok answer is '1147285073996'

Test #16:

score: 5
Accepted
time: 146ms
memory: 17652kb

input:

35 50 932365859 196
98 32 189 289 340 194 568 856 298 126 559 1732 703 1534 10331 2934 1843 7175 17558 1069 3912 3620 156 3765 893 4210 9491 4325 1514 14716 775 276 1197 4808 2370
1 2 3
2 3 1
3 4 3
4 5 2
5 6 2
6 7 2
7 8 3
8 9 3
9 10 5
10 11 1
11 12 2
12 13 3
13 14 4
14 15 5
15 16 4
16 17 2
17 18 3
18 19 5
19 20 4
20 21 4
21 22 5
22 23 5
23 24 5
24 25 2
25 26 3
26 27 1
27 28 4
28 29 4
29 30 2
30 31 1
31 32 2
32 33 4
33 34 4
34 35 1
35 1 4
25 28 1
9 16 1
26 20 4
33 9 3
16 24 5
14 29 1
3 30 4
14 26...

output:

1458164877593

result:

ok answer is '1458164877593'

Test #17:

score: 5
Accepted
time: 175ms
memory: 16320kb

input:

39 50 974099211 197
160 50 1719 3731 943 334 630 467 520 882 2646 1444 658 1260 2529 1540 707 1378 11561 3983 1997 867 929 927 1436 892 23201 5345 4742 648 5695 4826 28546 5661 4346 28984 2133 5860 760
1 2 1
2 3 1
3 4 3
4 5 4
5 6 4
6 7 3
7 8 3
8 9 4
9 10 1
10 11 4
11 12 1
12 13 5
13 14 2
14 15 5
15 16 5
16 17 1
17 18 5
18 19 1
19 20 4
20 21 3
21 22 4
22 23 3
23 24 5
24 25 2
25 26 1
26 27 2
27 28 2
28 29 4
29 30 4
30 31 2
31 32 2
32 33 1
33 34 3
34 35 1
35 36 1
36 37 3
37 38 3
38 39 4
39 1 4
7 13...

output:

3547211642863

result:

ok answer is '3547211642863'

Test #18:

score: 5
Accepted
time: 384ms
memory: 16940kb

input:

50 501 998244353 199
33 49 418 315 699 556 1015 461 92 556 6796 896 997 126 7777 924 3278 1291 1671 207 1767 20414 160 21663 2663 1402 3827 3595 5349 1916 3178 2921 2669 2412 18078 5915 492 6362 7669 724 4678 1143 2330 2826 32591 4146 6453 46589 8544 869
8 19 4
4 48 4
6 45 3
1 40 2
21 27 3
1 28 3
28 37 5
23 41 4
3 24 5
22 29 3
1 31 3
36 49 1
2 23 5
11 29 4
19 48 2
15 31 1
29 35 4
13 44 5
7 50 2
20 23 4
28 48 5
12 37 1
3 20 3
33 50 4
18 44 1
43 50 2
23 42 2
9 34 4
7 46 4
33 42 2
34 37 4
33 47 3
1...

output:

9849899673519

result:

ok answer is '9849899673519'

Test #19:

score: 5
Accepted
time: 387ms
memory: 17552kb

input:

50 501 997163873 199
33 49 418 315 699 556 1015 461 92 556 6796 896 997 126 7777 924 3278 1291 1671 207 1767 20414 160 21663 2663 1402 3827 3595 5349 1916 3178 2921 2669 2412 18078 5915 492 6362 7669 724 4678 1143 2330 2826 32591 4146 6453 46589 8544 869
8 19 4
4 48 4
6 45 3
1 40 2
21 27 3
1 28 3
28 37 5
23 41 4
3 24 5
22 29 3
1 31 3
36 49 1
2 23 5
11 29 4
19 48 2
15 31 1
29 35 4
13 44 5
7 50 2
20 23 4
28 48 5
12 37 1
3 20 3
33 50 4
18 44 1
43 50 2
23 42 2
9 34 4
7 46 4
33 42 2
34 37 4
33 47 3
1...

output:

9838255244438

result:

ok answer is '9838255244438'

Test #20:

score: 5
Accepted
time: 367ms
memory: 16628kb

input:

50 501 943934719 200
162 53 261 3878 65 1169 80 1380 1406 1268 8289 1775 521 13496 439 2560 1640 117 3129 335 1881 3958 2407 19027 464 10169 3069 4249 3051 4569 700 12963 7923 3343 3306 8291 3756 1751 6860 4089 488 3935 8355 6185 42968 8661 3604 39456 9036 47170
28 45 3
3 18 4
7 43 4
8 41 3
40 46 1
5 39 2
13 46 4
36 42 5
36 46 2
20 23 5
21 36 1
10 50 3
8 36 3
17 45 2
24 26 4
7 18 3
1 48 2
10 12 2
35 42 5
13 28 4
9 34 4
8 14 4
17 22 5
6 49 1
6 16 2
7 28 2
15 29 1
10 46 4
11 32 3
3 24 2
20 33 3
7 ...

output:

10464274815267

result:

ok answer is '10464274815267'

Extra Test:

score: 0
Extra Test Passed