CT35200

The Blackglass Pack Limit

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the obsidian flows of Blackglass, Farmer the inventory keeper keeps careful count of the vaults. assign crews to the morning shifts, every figure matters. Task: n items each have a weight and a value; take each at most once within capacity W. Print the maximum total value. Input format: First line: n and W. Second line: n weights. Third line: n values. Output format: Print the maximum value. Constraints: 1 <= n <= 100; 1 <= W <= 10000; 1 <= wi,vi <= 10^6.

Example 1:

Input: 100 10000 384 65 761 801 930 888 132 707 393 727 825 768 989 156 969 128 530 781 87 131 649 756 244 381 780 829 274 480 385 175 121 204 892 990 203 402 405 983 806 348 466 697 481 916 14 903 253 129 37 693 49 416 255 281 937 934 593 298 784 1000 174 115 564 47 568 402 650 241 372 379 400 771 348 757 101 888 294 589 569 472 717 888 633 209 538 73 299 161 995 207 448 214 119 261 504 798 216 97 600 386 730305 926717 106382 581146 36090 567175 246378 492483 17964 581304 472914 655302 434733 576522 747080 390097 57253 941666 653712 273276 273168 770673 500732 312654 373579 568998 687243 155512 129804 914589 765205 82981 351247 805333 706362 931942 428836 29953 890127 878810 839623 128140 593313 276528 177729 881308 945512 789408 38516 295023 834758 337755 54672 563801 645970 409618 741787 39422…
Output: 26311800

Example 2:

Input: 100 10000 532 734 869 922 842 258 412 930 548 505 925 290 460 296 195 74 977 75 925 102 726 512 153 240 992 901 890 380 607 969 462 335 102 236 821 415 166 678 523 910 783 949 151 785 246 411 81 640 970 66 208 130 522 652 983 959 405 558 743 954 176 831 342 93 584 117 403 285 331 719 95 920 203 168 342 41 258 423 613 387 967 814 731 515 528 711 923 172 747 598 261 389 265 272 750 865 128 923 481 442 615809 306038 582370 225592 623788 386467 547987 12234 854870 146594 875847 317050 698754 865071 574623 364045 275193 612579 74337 580868 353838 81366 80438 644204 596542 904610 378293 675328 788639 741748 494750 16465 735535 646552 141181 801031 433354 234679 632376 238930 905592 370779 978393 306440 983387 324580 319401 806504 834082 548670 178249 57437 213083 913193 194510 698988 782293 8479…
Output: 23213155

Example 3:

Input: 100 10000 335 754 661 671 209 577 444 769 840 517 978 812 912 197 315 606 671 41 517 544 111 356 925 880 18 85 171 925 780 148 729 349 900 190 287 314 648 123 559 907 682 356 748 247 803 181 666 502 242 931 632 24 664 647 684 917 154 767 226 626 656 719 382 830 561 351 483 932 789 908 745 174 937 369 531 921 446 93 203 949 325 277 841 279 339 161 453 971 916 281 809 393 573 29 724 790 532 13 262 157 374675 216483 713522 104213 65830 119468 41552 18369 779383 5359 117317 321017 806465 978032 391510 875713 446717 572379 655972 657885 716104 400584 330306 539874 313477 961732 387525 899553 454659 79126 488397 761433 403311 545690 905699 563272 340265 139959 546666 294863 748051 312118 151236 155159 199903 108268 756476 852603 625447 660552 492170 11547 367454 34819 303104 851893 335482 555839…
Output: 26202559

Constraints:

1 <= n <= 100; 1 <= W <= 10000; 1 <= wi,vi <= 10^6.

Loading...
Test Cases:No test cases
No test cases available.
The Blackglass Pack Limit - MEDIUM Coding Problem | CodeTikki