QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#797577#7254. MergeHuangHanShengAC ✓36ms66432kbC++17715b2024-12-03 13:57:122024-12-03 13:57:13

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
3 1 2 4
3 1 2 4

output:

14

result:

ok 1 number(s): "14"

Test #2:

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

input:

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

output:

127224

result:

ok 1 number(s): "127224"

Test #3:

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

input:

4
3 4 2 1
3 4 2 1

output:

14

result:

ok 1 number(s): "14"

Test #4:

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

input:

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

output:

114167

result:

ok 1 number(s): "114167"

Test #5:

score: 0
Accepted
time: 29ms
memory: 65372kb

input:

2000
670 1363 819 1306 1666 692 986 221 1454 730 183 558 1063 1198 835 1986 1916 186 53 1612 461 70 1078 592 520 112 497 265 266 1110 1779 1353 1205 340 231 319 1458 1436 1869 774 1335 1028 1867 1953 1370 1319 808 525 1725 1709 1807 485 331 968 820 1309 1121 1308 1565 1842 422 1381 178 1400 895 945 ...

output:

93204593

result:

ok 1 number(s): "93204593"

Test #6:

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

input:

2000
1453 657 1716 895 1737 1287 1805 697 1536 1110 717 1322 1333 619 388 249 1356 1991 1255 1565 368 1029 972 395 1735 632 1028 696 1276 54 1470 671 976 452 1164 329 1047 340 768 185 1371 1250 1707 538 221 952 410 20 1770 1942 1335 1835 459 1425 261 1118 523 1076 1648 967 1132 974 802 186 396 223 8...

output:

871232262

result:

ok 1 number(s): "871232262"

Test #7:

score: 0
Accepted
time: 26ms
memory: 65396kb

input:

2000
1590 861 1841 461 858 975 1097 1789 915 181 1832 958 1857 888 1600 1250 684 1229 1385 1164 1889 1597 379 1829 1596 803 1613 289 1487 385 1700 1916 72 1369 297 397 1168 1958 1812 1422 1018 1929 1073 457 1200 1759 255 1171 395 1774 680 1872 959 1875 105 860 904 205 807 1736 703 1667 262 237 1134 ...

output:

924915868

result:

ok 1 number(s): "924915868"

Test #8:

score: 0
Accepted
time: 21ms
memory: 65472kb

input:

2000
1364 266 1806 1961 352 1294 1600 164 1420 1889 1766 84 161 86 990 1290 155 1557 348 1052 1613 1590 570 1900 1817 58 143 277 1709 1130 800 582 650 326 29 701 2 238 1025 1524 1623 1933 1342 1467 1677 1861 1417 354 943 1124 505 1649 1576 1802 1268 1419 485 1105 1488 1745 1587 1372 1734 695 1522 13...

output:

869060421

result:

ok 1 number(s): "869060421"

Test #9:

score: 0
Accepted
time: 28ms
memory: 65020kb

input:

2000
593 1986 361 350 1390 1739 904 11 1649 79 1772 1044 620 417 199 1917 1740 89 997 1402 326 408 1393 1696 1839 1857 776 503 207 688 1923 1758 1116 933 1107 1898 1566 1650 640 1854 1871 1618 1256 1171 1929 845 222 971 1055 1989 567 1595 870 1005 360 1507 632 657 1679 436 517 906 1077 664 86 859 15...

output:

818371685

result:

ok 1 number(s): "818371685"

Test #10:

score: 0
Accepted
time: 36ms
memory: 66252kb

input:

2000
409 236 534 1161 1244 987 1072 351 938 1149 1280 1422 269 1949 416 1587 982 1418 1688 958 1668 1683 1000 1884 840 1015 575 679 1510 639 129 159 1892 802 1305 940 702 1998 1214 1004 463 568 1908 1070 1005 1916 1313 942 1772 410 1399 1522 617 248 564 1239 773 112 420 387 926 548 1229 633 649 1967...

output:

942562490

result:

ok 1 number(s): "942562490"

Test #11:

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

input:

15
8 11 10 4 9 5 7 15 12 6 2 14 3 1 13
8 11 5 4 9 14 13 6 2 15 10 3 1 7 12

output:

51252311

result:

ok 1 number(s): "51252311"

Test #12:

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

input:

500
406 87 288 81 140 110 141 333 470 254 405 291 315 36 266 455 31 458 480 495 285 85 310 11 200 93 448 218 312 89 423 204 354 304 104 114 56 339 459 476 153 436 208 165 269 332 349 17 134 456 426 79 462 10 428 120 282 209 472 387 268 95 151 175 167 211 487 138 410 46 445 220 57 493 500 148 156 29 ...

output:

297186118

result:

ok 1 number(s): "297186118"

Test #13:

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

input:

207
64 107 132 136 4 169 97 196 151 175 197 54 1 66 48 15 150 18 79 8 129 38 158 3 119 168 101 5 76 69 123 88 137 20 133 166 55 178 87 92 145 104 121 125 159 141 49 206 89 188 192 91 58 51 17 37 40 13 122 23 171 62 110 43 53 130 164 187 152 68 90 72 96 61 198 10 28 41 108 36 111 93 14 190 120 71 81 ...

output:

846756442

result:

ok 1 number(s): "846756442"

Test #14:

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

input:

830
372 605 291 732 697 545 594 271 62 10 423 252 696 522 815 109 638 802 396 548 67 539 819 645 130 151 701 765 677 744 377 359 426 37 427 756 462 270 216 317 587 215 757 76 796 445 733 152 68 280 509 540 146 206 658 803 275 28 389 657 122 660 581 800 610 763 209 264 301 393 205 467 650 827 468 15 ...

output:

166755606

result:

ok 1 number(s): "166755606"

Test #15:

score: 0
Accepted
time: 9ms
memory: 32600kb

input:

842
701 491 172 104 175 270 761 484 420 338 403 536 673 397 166 5 32 248 733 119 576 148 689 53 116 529 659 33 262 245 389 101 304 523 44 95 470 399 52 271 361 605 41 379 13 807 319 610 809 308 463 303 603 637 516 210 806 132 20 395 209 409 645 561 559 64 744 684 726 413 467 204 625 371 345 38 574 5...

output:

796699016

result:

ok 1 number(s): "796699016"

Test #16:

score: 0
Accepted
time: 32ms
memory: 65936kb

input:

1987
692 1185 1483 570 1675 1075 941 707 547 552 1875 450 1230 770 438 252 916 1722 1667 1232 819 172 915 1517 1569 1418 1602 1815 361 1906 702 1243 93 440 1386 795 1510 1347 222 592 28 1333 515 1402 1390 610 1343 237 1561 525 616 1890 884 112 1036 1933 326 1685 1317 635 420 1136 519 1079 1634 177 1...

output:

454107423

result:

ok 1 number(s): "454107423"

Test #17:

score: 0
Accepted
time: 36ms
memory: 65844kb

input:

2000
1276 884 348 1297 1715 1134 1705 866 1495 73 1844 1315 1732 353 1256 1607 610 168 532 547 573 1716 1686 456 645 719 1978 713 808 476 1903 1948 270 1724 839 704 705 1367 687 615 523 124 1080 904 483 795 1233 939 1128 1358 78 440 321 497 1896 525 349 1693 663 1376 915 1042 458 419 1574 1450 729 2...

output:

885124973

result:

ok 1 number(s): "885124973"

Test #18:

score: 0
Accepted
time: 31ms
memory: 65344kb

input:

2000
335 1518 499 702 1040 26 473 1287 159 180 1420 578 735 1591 232 421 1104 1847 1833 1328 143 1372 301 1661 899 547 1565 1773 1651 1608 1346 713 1816 1219 1519 1559 76 344 636 568 383 492 117 1712 1127 542 1674 1711 236 233 1777 1466 254 1090 1290 157 585 453 43 167 1284 269 412 983 826 1179 1208...

output:

533363746

result:

ok 1 number(s): "533363746"

Test #19:

score: 0
Accepted
time: 25ms
memory: 65008kb

input:

2000
576 1083 348 547 1983 212 667 225 1378 827 45 1946 499 1648 44 1672 1731 506 232 1460 408 171 137 235 361 1403 1922 1131 1331 1436 1589 1981 831 716 515 293 265 1703 34 1528 1394 1178 1531 962 966 1492 1958 630 979 1632 1127 1643 252 643 591 1099 1105 952 490 406 764 1185 32 761 1386 825 810 10...

output:

85330480

result:

ok 1 number(s): "85330480"

Test #20:

score: 0
Accepted
time: 28ms
memory: 65216kb

input:

2000
1396 478 663 359 1597 1679 1683 13 1175 1773 833 147 99 354 1126 1483 1426 71 1277 1747 118 472 1798 1974 244 1289 445 1877 715 750 1130 288 1217 872 741 570 139 319 1832 1213 1245 789 210 631 119 1414 396 863 797 94 1365 429 662 705 1620 1310 1657 669 574 1382 1132 1203 1299 1750 629 159 1419 ...

output:

532508477

result:

ok 1 number(s): "532508477"

Test #21:

score: 0
Accepted
time: 28ms
memory: 65504kb

input:

2000
1993 1233 639 818 424 1628 113 1647 966 1983 546 846 944 927 85 335 19 120 1227 1745 1198 32 1338 472 1373 1812 1725 1008 781 1650 1108 1301 155 626 587 1213 555 467 535 1512 1471 129 375 1784 671 578 1543 912 1287 266 1819 1107 1025 612 501 450 1413 1199 1249 1220 1386 1246 1222 1988 1106 1498...

output:

539291280

result:

ok 1 number(s): "539291280"

Test #22:

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

input:

2000
1604 1018 493 1409 454 1055 989 964 247 63 1446 174 1903 1165 437 561 1696 606 1072 537 857 1379 880 1008 135 307 1553 1188 1595 648 1747 1829 1564 1697 1100 1437 1726 1796 965 346 1612 324 1728 178 92 991 1194 1951 1973 1286 472 1242 315 1421 1133 724 478 665 306 1296 1908 511 967 1526 1999 84...

output:

412556822

result:

ok 1 number(s): "412556822"

Test #23:

score: 0
Accepted
time: 29ms
memory: 65080kb

input:

2000
1173 512 1126 10 767 1120 227 970 1412 323 1064 1695 1981 285 1944 366 1422 154 310 185 1834 754 652 1618 986 856 1654 573 275 1114 1793 664 213 1243 1980 1858 1338 1457 741 1870 373 1074 1061 930 508 697 1168 1128 1194 1441 648 1773 1156 172 136 1880 1747 1737 1107 1184 727 123 316 44 1900 192...

output:

411296417

result:

ok 1 number(s): "411296417"

Test #24:

score: 0
Accepted
time: 31ms
memory: 65204kb

input:

2000
1821 879 1756 1422 126 335 1954 773 816 1684 1516 1913 1359 1109 374 596 102 762 813 283 8 518 507 1992 706 1317 84 969 89 1518 434 1379 49 428 1206 221 1981 965 1115 317 1494 1571 1655 1935 1214 1244 480 80 1799 1570 474 1080 736 929 1638 784 440 530 1121 1675 183 163 267 1477 1832 396 35 1439...

output:

226460305

result:

ok 1 number(s): "226460305"

Test #25:

score: 0
Accepted
time: 31ms
memory: 65632kb

input:

2000
1848 1826 1443 404 371 284 1454 1852 815 282 1957 443 1946 1496 483 175 959 1046 1318 596 931 816 432 1463 106 482 946 1161 537 1150 1660 1125 801 351 1421 1379 656 421 551 136 1740 1048 32 701 781 1506 606 1619 6 1269 1625 169 1131 1863 93 1701 1901 497 849 1215 948 1966 734 805 1222 1862 526 ...

output:

957651538

result:

ok 1 number(s): "957651538"

Test #26:

score: 0
Accepted
time: 27ms
memory: 66324kb

input:

2000
38 609 293 323 1087 582 648 1827 1296 172 1363 104 1686 1400 1678 1787 1983 1802 1439 966 504 1437 711 1144 1374 304 530 1895 1976 347 1473 490 1135 1266 443 52 890 812 875 299 841 660 226 597 608 1215 334 1214 1591 99 1426 1663 1928 1750 814 1405 397 231 343 1007 1935 1069 1035 989 1925 939 32...

output:

341647321

result:

ok 1 number(s): "341647321"

Test #27:

score: 0
Accepted
time: 30ms
memory: 65156kb

input:

2000
1780 717 1695 993 1859 611 1760 1723 171 801 504 1720 1060 1717 1680 220 1903 898 237 1984 132 797 1631 1636 1023 1752 65 378 1806 636 1286 165 430 597 1591 1596 398 1811 293 1194 931 1972 1757 908 1759 1313 1898 314 966 1767 967 483 1189 1783 1028 803 1605 231 115 635 660 1438 1204 1772 974 19...

output:

173790999

result:

ok 1 number(s): "173790999"

Test #28:

score: 0
Accepted
time: 23ms
memory: 66432kb

input:

2000
540 1833 517 1246 1572 1343 1949 1073 1156 1561 402 62 1127 1978 692 1683 24 649 1849 1899 35 116 975 501 662 1585 391 175 317 329 301 669 1179 1344 131 1014 1257 1204 257 860 880 1770 139 1892 1097 435 1260 1456 1869 1058 1078 1494 1049 1888 1989 1230 398 271 795 1366 1516 413 857 1384 983 972...

output:

575844333

result:

ok 1 number(s): "575844333"

Test #29:

score: 0
Accepted
time: 30ms
memory: 65640kb

input:

2000
975 1406 1959 1520 1535 1917 480 229 550 873 55 415 52 1731 1949 854 1365 830 1315 1851 1545 156 255 1202 234 1634 1306 1147 297 1870 1390 231 35 1015 282 53 730 684 751 1653 879 1434 373 597 912 1694 1103 1837 910 961 556 1040 681 468 1738 208 194 1466 334 82 1782 1523 345 687 1612 1798 1526 2...

output:

124113402

result:

ok 1 number(s): "124113402"

Test #30:

score: 0
Accepted
time: 25ms
memory: 65976kb

input:

2000
1016 1166 97 1269 329 926 1218 199 985 172 833 1215 1616 548 58 721 120 656 1825 1417 1779 1485 1783 928 1682 508 1517 1389 1153 443 925 661 1000 107 431 995 1055 1612 286 1294 1837 648 1489 658 521 327 923 1807 1134 93 1339 1829 1091 487 1951 1 83 1480 1317 695 49 484 1567 10 831 1547 1540 6 7...

output:

772298216

result:

ok 1 number(s): "772298216"

Test #31:

score: 0
Accepted
time: 29ms
memory: 65996kb

input:

2000
1127 523 497 908 703 586 308 1908 1618 565 381 836 1757 1235 710 1696 411 468 1569 368 669 763 1352 1679 179 1218 56 1462 1195 1514 305 1976 1339 1289 1161 1800 519 1267 661 1820 755 1940 721 1050 1061 395 727 1663 1019 323 1422 1904 493 754 698 1052 1340 1315 139 1991 1387 1058 1334 1221 676 9...

output:

987517833

result:

ok 1 number(s): "987517833"

Test #32:

score: 0
Accepted
time: 25ms
memory: 65620kb

input:

2000
506 698 1065 1863 22 203 900 1464 1665 618 380 248 485 497 1865 992 1277 1751 489 1245 549 1483 408 92 1726 230 1270 214 1963 1570 36 1142 940 1988 923 1115 1389 1660 997 844 496 813 1441 738 1670 1842 759 832 1887 1550 141 892 1559 268 181 854 162 1307 4 597 1269 89 965 1018 1388 917 1201 363 ...

output:

556361907

result:

ok 1 number(s): "556361907"

Test #33:

score: 0
Accepted
time: 30ms
memory: 64996kb

input:

2000
601 1037 1084 673 911 1390 298 1090 649 1049 18 513 1577 896 1439 4 851 979 1345 907 887 640 1187 1500 1415 483 5 455 1707 1562 160 975 1723 337 1667 1512 1898 1887 1953 945 306 414 83 1909 1368 700 1635 1802 214 328 805 134 1106 593 1327 1765 1742 1369 494 1219 669 522 881 1793 1580 1600 1695 ...

output:

521773283

result:

ok 1 number(s): "521773283"

Test #34:

score: 0
Accepted
time: 21ms
memory: 65164kb

input:

2000
555 697 806 1151 1494 1687 1374 1923 1548 554 782 286 1648 31 671 1033 1234 481 305 1398 1190 344 581 1685 758 1892 1316 1612 239 270 1681 46 336 957 1138 54 175 1498 956 1487 868 1587 1433 279 69 361 1765 1484 1136 1427 174 12 1875 74 636 1391 809 192 1941 1971 1177 649 1489 1994 1903 656 1793...

output:

384881759

result:

ok 1 number(s): "384881759"

Test #35:

score: 0
Accepted
time: 31ms
memory: 65868kb

input:

2000
779 899 528 1770 983 1115 1562 775 125 1711 103 1589 1419 1382 227 1228 1730 471 1143 376 1740 1705 1674 1370 55 1737 1810 1958 395 548 902 276 1358 440 1297 1460 1509 1070 738 458 164 1899 704 1427 1554 1886 1497 1426 212 855 1356 1078 1815 1942 1631 982 795 1811 757 1189 1651 1355 611 904 180...

output:

685928356

result:

ok 1 number(s): "685928356"

Test #36:

score: 0
Accepted
time: 25ms
memory: 66308kb

input:

2000
963 1397 1664 1219 1097 768 967 1429 888 1290 333 1970 1620 1300 1223 369 791 74 652 1866 443 1125 838 1904 1359 298 1997 819 1105 1554 313 614 1149 21 928 1734 195 672 15 1381 335 202 1564 401 1493 1964 1511 1391 1510 1608 1444 1615 448 1707 1892 470 1634 850 17 1991 1820 454 555 930 1822 1921...

output:

662795068

result:

ok 1 number(s): "662795068"

Test #37:

score: 0
Accepted
time: 26ms
memory: 66228kb

input:

2000
571 970 1650 721 47 156 103 78 1938 690 775 144 504 1440 15 1525 102 1262 1231 1631 392 1012 1636 886 1093 333 1630 1697 778 1387 708 1306 1655 531 800 1447 1755 964 121 1464 3 994 315 1209 1037 1218 175 963 1772 1399 337 1176 228 281 1932 1364 953 974 925 391 14 1046 908 243 786 491 961 68 117...

output:

433152820

result:

ok 1 number(s): "433152820"

Test #38:

score: 0
Accepted
time: 29ms
memory: 66232kb

input:

2000
1861 1294 1135 220 242 1490 756 622 634 1245 1028 363 1866 1507 1153 1285 544 1590 1267 380 241 354 81 1429 1466 1343 1362 1945 1474 1626 905 401 1389 1299 74 1804 164 206 1027 1851 1906 57 1527 1107 755 399 12 1139 105 528 1136 644 16 13 1366 1073 1308 447 513 1176 885 1723 1376 1911 610 624 1...

output:

397376242

result:

ok 1 number(s): "397376242"

Test #39:

score: 0
Accepted
time: 30ms
memory: 65668kb

input:

2000
1046 173 1271 580 147 1138 583 1746 42 1789 1386 1497 189 1937 1489 1149 641 1649 754 8 1391 895 1793 710 997 1577 894 302 1560 1818 1230 514 1974 1201 1686 1265 1801 315 1304 337 1088 74 150 1996 447 1646 121 1547 1731 996 702 1883 789 529 1935 1256 62 444 1451 1379 304 1443 1017 1511 265 929 ...

output:

68124727

result:

ok 1 number(s): "68124727"

Test #40:

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

input:

4
1 2 3 4
1 2 3 4

output:

14

result:

ok 1 number(s): "14"

Test #41:

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

input:

4
1 2 3 4
1 2 4 3

output:

28

result:

ok 1 number(s): "28"

Test #42:

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

input:

4
1 2 3 4
1 3 2 4

output:

28

result:

ok 1 number(s): "28"

Test #43:

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

input:

4
1 2 3 4
1 3 4 2

output:

34

result:

ok 1 number(s): "34"

Test #44:

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

input:

4
1 2 3 4
1 4 2 3

output:

34

result:

ok 1 number(s): "34"

Test #45:

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

input:

4
1 2 3 4
1 4 3 2

output:

36

result:

ok 1 number(s): "36"

Test #46:

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

input:

4
1 2 3 4
2 1 3 4

output:

28

result:

ok 1 number(s): "28"

Test #47:

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

input:

4
1 2 3 4
2 1 4 3

output:

36

result:

ok 1 number(s): "36"

Test #48:

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

input:

4
1 2 3 4
2 3 1 4

output:

34

result:

ok 1 number(s): "34"

Test #49:

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

input:

4
1 2 3 4
2 3 4 1

output:

41

result:

ok 1 number(s): "41"

Test #50:

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

input:

4
1 2 3 4
2 4 1 3

output:

45

result:

ok 1 number(s): "45"

Test #51:

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

input:

4
1 2 3 4
2 4 3 1

output:

46

result:

ok 1 number(s): "46"

Test #52:

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

input:

4
1 2 3 4
3 1 2 4

output:

34

result:

ok 1 number(s): "34"

Test #53:

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

input:

4
1 2 3 4
3 1 4 2

output:

45

result:

ok 1 number(s): "45"

Test #54:

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

input:

4
1 2 3 4
3 2 1 4

output:

36

result:

ok 1 number(s): "36"

Test #55:

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

input:

4
1 2 3 4
3 2 4 1

output:

46

result:

ok 1 number(s): "46"

Test #56:

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

input:

4
1 2 3 4
3 4 1 2

output:

54

result:

ok 1 number(s): "54"

Test #57:

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

input:

4
1 2 3 4
3 4 2 1

output:

52

result:

ok 1 number(s): "52"

Test #58:

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

input:

4
1 2 3 4
4 1 2 3

output:

41

result:

ok 1 number(s): "41"

Test #59:

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

input:

4
1 2 3 4
4 1 3 2

output:

46

result:

ok 1 number(s): "46"

Test #60:

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

input:

4
1 2 3 4
4 2 1 3

output:

46

result:

ok 1 number(s): "46"

Test #61:

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

input:

4
1 2 3 4
4 2 3 1

output:

44

result:

ok 1 number(s): "44"

Test #62:

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

input:

4
1 2 3 4
4 3 1 2

output:

52

result:

ok 1 number(s): "52"

Test #63:

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

input:

4
1 2 3 4
4 3 2 1

output:

50

result:

ok 1 number(s): "50"