QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#115461#6629. Travelling Traderznstz#4 3ms4212kbC++202.7kb2023-06-26 09:51:592024-05-31 14:13:38

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

2 1
1 2
255959470 961356354

output:

1217315824
2
1 2 

result:

ok correct!

Test #2:

score: 0
Wrong Answer
time: 2ms
memory: 4036kb

input:

1000 1
730 89
762 280
923 523
740 22
679 350
448 769
102 712
154 965
219 32
238 289
484 502
183 311
999 682
806 450
275 101
131 197
749 720
131 937
960 202
503 320
95 262
595 133
809 560
659 451
843 218
258 842
564 316
729 727
413 237
606 531
469 258
612 8
707 539
359 680
957 639
381 708
104 490
234...

output:

5058766
1000
1 283 728 642 392 460 418 961 471 704 391 902 654 858 623 466 140 267 276 940 688 407 801 641 273 449 548 622 542 169 396 423 668 386 442 242 430 978 58 416 443 995 305 535 957 454 639 412 493 75 62 828 617 741 845 839 861 901 718 269 636 723 525 109 482 97 772 216 71 128 474 189 563 4 ...

result:

wrong answer dist(1, 283) = 2 > k = 1

Subtask #2:

score: 0
Wrong Answer

Test #12:

score: 7
Accepted
time: 1ms
memory: 3936kb

input:

2 2
2 1
243296356 635616793

output:

878913149
2
1 2 

result:

ok correct!

Test #13:

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

input:

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

output:

33
10
1 2 8 6 5 9 7 3 10 4 

result:

wrong answer dist(8, 6) = 3 > k = 2

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 4
Accepted

Test #83:

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

input:

2000 3
1359 90
1703 163
158 188
360 1501
195 664
1414 215
1546 1756
536 1096
1726 1223
1150 104
1757 703
1982 282
1023 998
1180 419
576 1759
1496 1993
44 670
1703 952
855 849
1998 1399
1280 980
1533 1090
1270 678
1680 387
469 1734
1799 263
473 588
303 226
5 295
1489 1471
1094 1667
1912 210
1368 1360...

output:

1008611451196
2000
1 379 1954 1539 1091 961 1613 1300 454 1237 1101 1617 1369 562 867 1256 901 1040 709 88 916 1291 129 523 674 1788 832 1961 452 1903 1349 1808 1428 1656 560 739 183 877 301 775 1973 1548 191 1265 936 1087 1672 1344 33 1679 565 1963 1330 774 276 139 926 1325 524 1334 1397 1019 1231 ...

result:

ok correct!

Test #84:

score: 4
Accepted
time: 3ms
memory: 4052kb

input:

2000 3
1727 567
1783 1850
205 985
323 1094
1153 821
1756 117
377 1928
1026 1303
1343 1814
268 745
242 948
1140 1218
7 1675
101 1798
1403 1752
1184 671
87 248
1953 30
1580 1441
507 1438
525 419
901 421
1585 1405
1575 883
1952 1930
1988 1325
615 722
994 1202
178 474
1978 1500
899 481
216 409
999 1817
...

output:

1012330476243
2000
1 369 1789 598 269 202 1079 694 1545 1454 1724 88 1364 1696 1158 1918 131 1589 1832 1725 67 761 1634 693 220 257 993 1275 1046 319 838 1326 1479 1333 477 517 1580 1441 723 1205 163 1561 1768 1631 84 880 778 975 158 1359 1755 1321 354 1710 1728 1689 1713 1797 1002 827 1298 1129 292...

result:

ok correct!

Test #85:

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

input:

2000 3
1213 130
101 508
72 1199
1550 1096
1099 861
1515 627
1299 1672
1338 105
1444 1019
15 1560
1949 971
52 1312
30 529
186 1687
1917 484
1971 349
537 1223
1955 1377
300 1060
1786 1811
1960 90
1959 1353
1831 1548
303 511
1073 1197
863 1527
1379 994
31 9
1247 1707
1395 1532
29 1544
119 296
1919 1554...

output:

1001405462082
2000
1 1365 1976 605 1487 810 1721 1986 1557 751 1774 1836 574 1658 1802 1491 1450 954 1703 146 295 729 1955 1377 242 1809 222 650 93 1610 381 435 1503 1069 1801 710 1303 388 1208 1310 1483 63 1357 1639 1265 1709 948 1367 625 1152 434 898 333 578 281 666 1307 1008 396 1631 1266 1511 14...

result:

ok correct!

Test #86:

score: 4
Accepted
time: 3ms
memory: 4164kb

input:

2000 3
532 64
99 960
1271 519
1141 1056
1986 1889
930 817
639 1188
841 771
1334 179
1336 1163
1687 1909
281 1300
1410 207
1018 1471
1645 972
711 1504
623 1739
1905 1959
1423 738
1747 34
1684 204
61 1012
1092 1350
1977 1130
62 473
1623 1021
1157 227
427 832
1900 1792
1910 584
265 330
1874 1186
1797 1...

output:

1002207066842
2000
1 861 1513 1106 1637 1773 466 762 1255 182 1295 1808 313 416 488 103 59 838 1772 1667 1178 228 994 1430 1913 713 351 345 992 1839 778 997 1834 857 595 317 1143 1799 1830 923 618 240 789 1882 926 547 1100 1017 269 1634 828 1218 78 1519 63 1088 389 403 352 1742 1503 553 1962 953 121...

result:

ok correct!

Test #87:

score: 4
Accepted
time: 3ms
memory: 4012kb

input:

2000 3
1 2
1 3
2 4
2 5
3 6
3 7
4 8
4 9
5 10
5 11
6 12
6 13
7 14
7 15
8 16
8 17
9 18
9 19
10 20
10 21
11 22
11 23
12 24
12 25
13 26
13 27
14 28
14 29
15 30
15 31
16 32
16 33
17 34
17 35
18 36
18 37
19 38
19 39
20 40
20 41
21 42
21 43
22 44
22 45
23 46
23 47
24 48
24 49
25 50
25 51
26 52
26 53
27 54
2...

output:

995663027103
2000
1 5 21 85 341 1365 1364 682 1367 1366 683 340 1361 1360 680 1363 1362 681 170 343 1373 1372 686 1375 1374 687 342 1369 1368 684 1371 1370 685 171 84 337 1349 1348 674 1351 1350 675 336 1345 1344 672 1347 1346 673 168 339 1357 1356 678 1359 1358 679 338 1353 1352 676 1355 1354 677 1...

result:

ok correct!

Test #88:

score: 4
Accepted
time: 3ms
memory: 4072kb

input:

2000 3
1 2
1 3
1 4
2 5
2 6
2 7
3 8
3 9
3 10
4 11
4 12
4 13
5 14
5 15
5 16
6 17
6 18
6 19
7 20
7 21
7 22
8 23
8 24
8 25
9 26
9 27
9 28
10 29
10 30
10 31
11 32
11 33
11 34
12 35
12 36
12 37
13 38
13 39
13 40
14 41
14 42
14 43
15 44
15 45
15 46
16 47
16 48
16 49
17 50
17 51
17 52
18 53
18 54
18 55
19 5...

output:

1000109641799
2000
1 7 61 547 1640 1641 1642 546 1637 1638 1639 545 1634 1635 1636 182 550 1649 1650 1651 549 1646 1647 1648 548 1643 1644 1645 183 553 1658 1659 1660 552 1655 1656 1657 551 1652 1653 1654 184 60 538 1613 1614 1615 537 1610 1611 1612 536 1607 1608 1609 179 541 1622 1623 1624 540 1619...

result:

ok correct!

Test #89:

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

input:

2 3
1 2
820567835 309877233

output:

1130445068
2
1 2 

result:

ok correct!

Test #90:

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

input:

50 3
28 1
40 30
17 31
41 25
1 30
38 6
19 9
50 6
37 4
5 44
13 31
21 46
35 14
25 10
36 41
42 32
37 11
27 20
48 45
31 10
42 17
29 40
26 35
43 3
23 24
27 34
42 39
25 5
7 18
35 48
15 31
30 23
20 17
42 12
39 16
7 32
17 3
41 38
31 47
13 8
33 9
22 33
49 48
29 11
31 19
26 31
41 2
40 17
20 21
4 4 10 2 7 6 3 4...

output:

270
50
1 28 23 24 40 11 4 37 29 3 43 20 34 27 46 21 42 7 18 32 16 39 12 31 8 13 25 2 38 50 6 36 41 44 5 10 15 47 9 22 33 19 35 14 49 45 48 26 17 30 

result:

ok correct!

Test #91:

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

input:

2000 3
1651 76
620 463
764 704
1648 768
1235 1183
915 523
1417 75
758 442
1952 271
1018 947
659 320
1976 562
337 965
1184 35
1234 1609
664 1444
580 737
1331 720
1314 973
945 1890
1760 1986
210 567
186 12
1306 1774
224 1073
1885 314
641 1144
1524 446
1148 1576
859 1438
1991 343
89 1665
140 537
183 14...

output:

994118359072
2000
1 1145 974 1998 1374 581 559 1997 1214 917 681 1429 735 1848 1634 403 1587 41 1047 1575 1666 1291 802 1006 1829 1216 1051 55 1241 203 1212 1503 457 785 990 1207 577 777 387 78 1451 550 955 713 1437 1617 220 982 804 183 1119 710 1471 565 1796 1761 1938 494 1646 861 1386 1657 1210 27...

result:

ok correct!

Test #92:

score: 4
Accepted
time: 3ms
memory: 4080kb

input:

2000 3
574 1963
1305 849
1271 853
1365 1853
12 1402
1010 1462
1353 494
74 1688
1786 1435
405 1012
1229 924
1085 1565
713 1742
796 1929
1844 1725
801 79
1089 1137
1255 1331
1659 754
341 1929
1233 956
615 1455
1798 867
1105 1943
196 790
1357 678
1160 1797
1310 1963
857 792
35 1464
1576 1251
1628 913
1...

output:

1002312168974
2000
1 1317 1911 810 1680 1842 676 1592 1101 1418 843 179 1467 202 468 857 451 1714 819 712 685 148 1246 1817 52 1651 788 53 804 115 1051 1912 1549 1144 1835 5 329 1833 1274 51 1239 156 1989 1238 820 772 475 554 1221 30 1924 245 1308 1285 248 773 1445 50 1332 620 933 987 1773 791 1345 ...

result:

ok correct!

Test #93:

score: 4
Accepted
time: 3ms
memory: 4152kb

input:

2000 3
684 1375
1184 445
1723 1722
473 1351
1019 941
1595 1572
718 56
974 696
308 1015
650 1134
338 1313
210 277
1735 1134
1053 283
1112 1862
90 450
1762 1042
1903 1927
1472 337
312 1925
815 1234
1226 206
1371 994
108 1604
1249 674
1509 1501
1232 1669
1519 1474
1368 780
953 749
1201 1422
351 325
101...

output:

1000468940262
2000
1 224 241 911 1927 1903 145 1510 485 568 693 66 1716 1447 306 781 1383 517 960 1740 1524 1747 948 1463 737 128 685 964 1186 1665 1369 1817 1449 212 811 977 1454 290 194 273 894 509 1717 182 1820 579 758 907 58 1210 95 1534 1450 1894 79 874 1786 1434 1570 744 402 203 1952 1746 801 ...

result:

ok correct!

Test #94:

score: 4
Accepted
time: 3ms
memory: 4152kb

input:

2000 3
1317 1228
1811 1659
491 1756
1622 1016
730 1196
873 59
1567 441
144 1469
1726 647
698 1631
1985 1711
1005 616
1286 964
1408 625
246 1404
125 1488
16 982
1576 1223
750 1845
1831 604
1502 458
1043 1552
1360 921
180 1800
266 1261
1021 1308
1421 625
99 403
891 1500
602 482
1520 610
486 1899
843 1...

output:

977343950277
2000
1 112 649 707 280 1250 1313 1947 168 913 259 951 1456 1258 1638 1205 544 451 1444 985 452 1558 313 258 1163 1430 113 877 889 1860 17 350 684 1621 1849 631 993 1597 464 1225 1702 1733 1923 272 844 1869 797 1248 1234 1571 1725 1382 1731 1368 1831 1419 1871 11 604 172 1134 1667 1792 1...

result:

ok correct!

Test #95:

score: 4
Accepted
time: 3ms
memory: 4196kb

input:

2000 3
1188 1181
1574 1619
944 1974
626 789
1798 27
159 547
1759 1110
1304 1360
1172 997
1815 1043
1496 1948
1781 1513
1884 993
652 1079
1983 1436
88 1953
1221 174
383 1741
48 814
1532 1319
1039 1401
1737 1829
996 920
222 1902
590 1270
692 1504
1918 654
928 1602
208 1165
1251 1596
329 856
1068 577
2...

output:

985678197158
2000
1 219 1255 1104 463 1605 1175 381 130 1659 83 708 809 1219 306 859 816 699 388 1676 1716 1846 641 31 1806 478 1205 364 1588 577 1068 92 1484 1751 1827 1927 748 1706 1277 486 1766 700 553 496 1863 372 68 1770 666 1297 1271 1784 1135 1187 833 934 1162 1842 1479 1282 1009 555 900 259 ...

result:

ok correct!

Test #96:

score: 4
Accepted
time: 3ms
memory: 4052kb

input:

2000 3
892 807
1866 64
123 674
1147 1184
1897 1873
385 1877
7 1697
1753 234
191 1453
625 850
91 1195
320 1560
1827 43
426 1801
1338 1775
55 1070
1138 127
627 1985
225 882
232 1144
124 1208
1665 54
819 898
1038 1676
1642 327
1827 1548
559 1243
69 854
1806 195
943 654
1426 905
691 1598
532 1304
235 53...

output:

1023444069399
2000
1 669 1705 1544 1020 210 1011 379 873 1828 818 318 1090 582 679 117 1949 577 590 510 1431 1323 941 438 1521 337 141 1940 1711 654 943 475 1780 991 154 1109 218 241 248 1516 1143 362 408 1529 301 171 1037 1341 192 901 1045 1302 1663 1574 1061 924 424 1749 1364 1491 542 544 1438 322...

result:

ok correct!

Test #97:

score: 4
Accepted
time: 3ms
memory: 4148kb

input:

2000 3
1367 159
1497 1532
1105 440
1955 1658
129 1964
272 956
1165 1745
625 1694
257 726
645 476
623 1098
648 303
665 847
1304 1665
307 926
319 1098
619 1582
1920 1770
874 1257
1443 815
121 578
1280 943
555 1602
1575 583
545 447
1708 1104
911 146
347 1466
1108 1412
1548 567
451 1182
1449 813
634 168...

output:

1010882805670
2000
1 1857 977 1119 496 443 1660 884 227 1922 1167 1706 1476 40 174 1545 1734 117 828 3 1895 1490 181 1635 839 1288 1760 241 554 1374 260 1656 1815 1821 970 724 1929 1444 1459 916 962 1301 1272 1305 992 666 296 815 1443 1452 606 803 1406 677 1647 1995 1832 1103 1116 1632 519 853 1085 ...

result:

ok correct!

Test #98:

score: 4
Accepted
time: 3ms
memory: 4060kb

input:

2000 3
1611 477
1551 698
1677 1706
712 1391
685 1755
1645 749
1510 671
1952 809
1398 368
213 1597
361 1006
651 971
437 409
1563 1815
704 16
42 404
930 26
1857 1089
1832 173
877 850
1876 1304
349 628
515 241
1700 787
1627 1311
1106 1040
1527 1685
591 1374
1350 359
240 359
456 1245
397 637
297 972
83 ...

output:

1014963178537
2000
1 1785 1787 807 1932 1360 1237 1483 1193 1024 1861 742 104 1241 1634 1458 504 1208 1001 468 1897 27 221 542 1438 96 1195 1441 120 612 1023 500 152 862 1733 413 430 781 1138 1204 418 57 392 317 1251 1566 331 660 1335 1614 1172 974 329 34 398 234 162 322 1328 650 1744 1088 250 495 1...

result:

ok correct!

Test #99:

score: 4
Accepted
time: 3ms
memory: 4092kb

input:

2000 3
1595 236
1251 497
809 946
633 735
282 191
1643 1997
1563 640
366 1468
640 1510
1781 1617
1157 1659
535 1144
990 1887
687 1221
675 931
214 809
196 724
330 427
596 271
221 1994
947 841
520 640
1251 1215
1331 1042
640 149
1617 1887
202 1223
1400 1429
1127 898
106 1015
615 1707
968 1043
490 1299
...

output:

1003217858982
2000
1 609 1074 1463 891 1532 379 596 271 928 75 113 1332 1442 416 1509 638 1002 763 1582 1371 614 392 1718 1046 538 48 1687 1542 1555 529 1389 291 118 905 1234 1384 1073 1414 347 1337 498 1832 1933 1702 1119 1117 1204 1056 1195 1947 218 961 1474 1957 1023 1151 155 467 1118 100 298 148...

result:

ok correct!

Test #100:

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

input:

2000 3
988 1
204 1
1 1855
1 226
26 1
1 1079
1 1825
572 1
50 1
1 1215
1 1532
1 1118
1 770
108 1
1 1207
1845 1
432 1
1369 1
1 879
1 203
460 1
154 1
135 1
492 1
1 873
1 1625
1212 1
1 107
1321 1
1818 1
1 292
1 1427
49 1
1 1233
1 1712
1579 1
418 1
1 793
1 1090
1 1842
1302 1
1 227
201 1
1 912
654 1
1 69
1...

output:

996901666648
2000
1 988 204 1855 226 26 1079 1825 572 50 1215 1532 1118 770 108 1207 1845 432 1369 879 203 460 154 135 492 873 1625 1212 107 1321 1818 292 1427 49 1233 1712 1579 418 793 1090 1842 1302 227 201 912 654 69 51 746 1953 354 1172 1656 896 1550 125 1729 297 1234 1940 1336 186 1515 14 1823 ...

result:

ok correct!

Test #101:

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

input:

1999 3
1773 1351
1 1076
1754 1646
1267 1
1157 983
1 978
1 1751
1392 1119
379 1
1 5
1 360
613 769
1 1472
1 1447
851 1
1867 1319
175 1
976 1
1760 1519
1 1718
1 1919
1 835
757 1060
1000 1
1331 1412
338 1
1341 11
1563 1415
1713 1127
772 477
1855 1
168 1248
600 1
335 1825
704 928
236 919
1815 1692
729 57...

output:

1997213132735
1999
1 842 1076 1719 1267 1100 978 1798 1751 1375 379 858 5 1110 360 746 1472 1475 1447 1621 851 216 175 1477 976 1602 1718 1018 1919 1282 835 637 1000 1796 338 532 1855 1770 600 1483 1592 1074 1869 49 1517 899 1874 1382 392 878 1935 856 85 1129 492 1309 953 1740 1205 1817 239 370 1009...

result:

ok correct!

Test #102:

score: 4
Accepted
time: 3ms
memory: 4200kb

input:

1997 3
1399 516
1 716
1426 1537
965 594
1856 855
1284 1479
1566 927
1454 1924
890 1748
84 1373
95 1672
185 1374
1 1082
34 1
211 782
1298 176
1310 776
1661 594
1931 428
980 916
693 1664
1598 91
981 1
30 1
536 121
154 1558
668 641
1637 1
777 13
302 673
889 360
1 1282
929 1
1035 204
1168 1923
190 151
8...

output:

1995219549052
1997
1 40 968 522 716 27 5 1350 1082 181 511 1600 34 1384 584 1055 981 1332 565 1451 30 1404 1484 933 1637 1977 65 680 1282 529 313 1010 929 954 887 18 1478 429 1004 451 996 477 1922 1708 1492 825 107 1379 873 679 385 1363 393 1711 1789 668 641 1299 250 1894 1495 1131 1160 1482 10 1375...

result:

ok correct!

Test #103:

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

input:

1936 3
341 1240
946 1597
1195 959
1733 1240
615 937
184 592
1258 1799
1601 1409
880 1258
91 1718
1417 1139
916 1592
184 911
1852 180
452 1793
803 1343
180 1895
575 1888
171 1778
1176 1912
1173 107
1173 372
1108 1094
1066 1293
1139 1561
771 1835
651 1675
1637 1675
41 1879
1396 771
1772 497
1687 752
1...

output:

959283331124
1936
1 994 461 722 1183 219 380 879 1366 486 1744 1517 856 962 1373 1758 1685 1215 1665 1539 168 1326 986 977 670 1111 1911 855 1149 522 1825 971 1167 1198 433 1000 1869 1320 65 371 112 1114 677 643 1793 452 1871 857 1927 1910 142 850 924 888 696 1452 1515 1885 1513 1790 324 182 774 866...

result:

ok correct!

Test #104:

score: 4
Accepted
time: 3ms
memory: 4172kb

input:

2000 3
1370 1319
6 1661
982 1460
654 816
1368 70
841 1391
332 1111
107 46
387 1390
928 196
369 1792
742 337
1906 1604
1278 672
154 1991
1518 308
849 846
705 158
1835 1612
780 1779
881 1867
597 1965
1956 409
1099 1242
828 1821
1662 344
760 1126
911 306
948 1909
1296 830
1642 892
516 1614
957 796
1038...

output:

2000000000000
2000
1 1699 152 1065 1008 155 1616 1486 1792 616 1577 945 383 525 444 690 1212 1542 1749 1436 876 1571 654 661 1267 898 1056 729 846 53 507 430 1433 1430 1923 586 937 454 1987 46 1609 1359 1982 1000 712 241 148 775 16 310 866 1150 713 1518 673 831 695 739 59 1856 1621 1579 208 596 1963...

result:

ok correct!

Test #105:

score: 4
Accepted
time: 3ms
memory: 4212kb

input:

2000 3
531 824
1828 527
489 1172
118 1355
370 562
1080 1962
535 1707
1302 1749
1996 347
424 1282
236 30
1937 1327
395 1060
672 1730
850 1700
19 1215
1989 1284
762 1946
646 1551
1478 249
446 1426
906 1103
1765 267
177 785
1231 699
410 415
1905 1059
1518 1948
219 987
825 1030
1812 995
1260 962
149 786...

output:

987613898700
2000
1 1961 252 1554 1308 981 1492 1112 859 1465 314 554 1660 1419 884 614 1412 396 459 1141 845 793 107 137 592 201 185 106 1935 866 28 332 40 335 356 1423 1962 1407 1988 12 50 1460 544 1718 39 1670 1653 1732 1290 1570 1529 496 286 774 93 1601 155 497 1902 1067 1279 1843 392 1854 316 7...

result:

ok correct!

Subtask #6:

score: 0
Runtime Error

Dependency #5:

100%
Accepted

Test #106:

score: 0
Runtime Error

input:

200000 3
147012 182751
154277 181776
95094 76426
30313 86629
126223 49995
166060 157842
122541 40371
6521 182375
175030 110447
78367 175134
131250 97285
132337 99771
133031 2158
102720 163461
104670 46325
70722 156875
99733 7253
130400 31525
38020 23547
104556 120340
152061 174001
112957 138331
6972...

output:


result: