Cody

# Problem 1092. Decimation

Solution 2101568

Submitted on 22 Jan 2020 by Asif Newaz
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
assert(isequal(decimate(10,3),4))

b = 1 a = 1 2 4 5 7 8 10 a = 10 1 2 4 5 7 8 b = 1 a = 10 1 4 5 8 a = 8 10 1 4 5 b = 2 a = 8 10 4 5 a = 4 5 8 10 b = 1 a = 4 5 10 a = 10 4 5 b = 0 a = 10 4 a = 10 4 c = 1 a = 10 4 10 a = 10 4 a = 4

2   Pass
assert(isequal(decimate(1024,3),676))

b = 1 a = Columns 1 through 14 1 2 4 5 7 8 10 11 13 14 16 17 19 20 Columns 15 through 28 22 23 25 26 28 29 31 32 34 35 37 38 40 41 Columns 29 through 42 43 44 46 47 49 50 52 53 55 56 58 59 61 62 Columns 43 through 56 64 65 67 68 70 71 73 74 76 77 79 80 82 83 Columns 57 through 70 85 86 88 89 91 92 94 95 97 98 100 101 103 104 Columns 71 through 84 106 107 109 110 112 113 115 116 118 119 121 122 124 125 Columns 85 through 98 127 128 130 131 133 134 136 137 139 140 142 143 145 146 Columns 99 through 112 148 149 151 152 154 155 157 158 160 161 163 164 166 167 Columns 113 through 126 169 170 172 173 175 176 178 179 181 182 184 185 187 188 Columns 127 through 140 190 191 193 194 196 197 199 200 202 203 205 206 208 209 Columns 141 through 154 211 212 214 215 217 218 220 221 223 224 226 227 229 230 Columns 155 through 168 232 233 235 236 238 239 241 242 244 245 247 248 250 251 Columns 169 through 182 253 254 256 257 259 260 262 263 265 266 268 269 271 272 Columns 183 through 196 274 275 277 278 280 281 283 284 286 287 289 290 292 293 Columns 197 through 210 295 296 298 299 301 302 304 305 307 308 310 311 313 314 Columns 211 through 224 316 317 319 320 322 323 325 326 328 329 331 332 334 335 Columns 225 through 238 337 338 340 341 343 344 346 347 349 350 352 353 355 356 Columns 239 through 252 358 359 361 362 364 365 367 368 370 371 373 374 376 377 Columns 253 through 266 379 380 382 383 385 386 388 389 391 392 394 395 397 398 Columns 267 through 280 400 401 403 404 406 407 409 410 412 413 415 416 418 419 Columns 281 through 294 421 422 424 425 427 428 430 431 433 434 436 437 439 440 Columns 295 through 308 442 443 445 446 448 449 451 452 454 455 457 458 460 461 Columns 309 through 322 463 464 466 467 469 470 472 473 475 476 478 479 481 482 Columns 323 through 336 484 485 487 488 490 491 493 494 496 497 499 500 502 503 Columns 337 through 350 505 506 508 509 511 512 514 515 517 518 520 521 523 524 Columns 351 through 364 526 527 529 530 532 533 535 536 538 539 541 542 544 545 Columns 365 through 378 547 548 550 551 553 554 556 557 559 560 562 563 565 566 Columns 379 through 392 568 569 571 572 574 575 577 578 580 581 583 584 586 587 Columns 393 through 406 589 590 592 593 595 596 598 599 601 602 604 605 607 608 Columns 407 through 420 610 611 613 614 616 617 619 620 622 623 625 626 628 629 Columns 421 through 434 631 632 634 635 637 638 640 641 643 644 646 647 649 650 Columns 435 through 448 652 653 655 656 658 659 661 662 664 665 667 668 670 671 Columns 449 through 462 673 674 676 677 679 680 682 683 685 686 688 689 691 692 Columns 463 through 476 694 695 697 698 700 701 703 704 706 707 709 710 712 713 Columns 477 through 490 715 716 718 719 721 722 724 725 727 728 730 731 733 734 Columns 491 through 504 736 737 739 740 742 743 745 746 748 749 751 752 754 755 Columns 505 through 518 757 758 760 761 763 764 766 767 769 770 772 773 775 776 Columns 519 through 532 778 779 781 782 784 785 787 788 790 791 793 794 796 797 Columns 533 through 546 799 800 802 803 805 806 808 809 811 812 814 815 817 818 Columns 547 through 560 820 821 823 824 826 827 829 830 832 833 835 836 838 839 Columns 561 through 574 841 842 844 845 847 848 850 851 853 854 856 857 859 860 Columns 575 through 588 862 863 865 866 868 869 871 872 874 875 877 878 880 881 Columns 589 through 602 883 884 886 887 889 890 892 893 895 896 898 899 901 902 Columns 603 through 616 904 905 907 908 910 911 913 914 916 917 919 920 922 923 Columns 617 through 630 925 926 928 929 931 932 934 935 937 938 940 941 943 944 Columns 631 through 644 946 947 949 950 952 953 955 956 958 959 961 962 964 965 Columns 645 through 658 967 968 970 971 973 974 976 977 979 980 982 983 985 986 Columns 659 through 672 988 989 991 992 994 995 997 998 1000 1001 1003 1004 1006 1007 Columns 673 through 683 1009 1010 1012 1013 1015 1016 1018 1019 1021 1022 1024 a = Columns 1 through 14 1024 1 2 4 5 7 8 10 11 13 14 16 17 19 Columns 15 through 28 20 22 23 25 26 28 29 31 32 34 35 37 3...

3   Pass
assert(isequal(decimate(2012,50),543))

4   Pass
assert(isequal(decimate(30,5),3))

b = 0 a = 1 2 3 4 6 7 8 9 11 12 13 14 16 17 18 19 21 22 23 24 26 27 28 29 a = 1 2 3 4 6 7 8 9 11 12 13 14 16 17 18 19 21 22 23 24 26 27 28 29 b = 4 a = 1 2 3 4 7 8 9 11 13 14 16 17 19 21 22 23 26 27 28 29 a = 26 27 28 29 1 2 3 4 7 8 9 11 13 14 16 17 19 21 22 23 b = 0 a = 26 27 28 29 2 3 4 7 9 11 13 14 17 19 21 22 a = 26 27 28 29 2 3 4 7 9 11 13 14 17 19 21 22 b = 1 a = 26 27 28 29 3 4 7 9 13 14 17 19 22 a = 22 26 27 28 29 3 4 7 9 13 14 17 19 b = 3 a = 22 26 27 28 3 4 7 9 14 17 19 a = 14 17 19 22 26 27 28 3 4 7 9 b = 1 a = 14 17 19 22 27 28 3 4 9 a = 9 14 17 19 22 27 28 3 4 b = 4 a = 9 14 17 19 27 28 3 4 a = 27 28 3 4 9 14 17 19 b = 3 a = 27 28 3 4 14 17 19 a = 14 17 19 27 28 3 4 b = 2 a = 14 17 19 27 3 4 a = 3 4 14 17 19 27 b = 1 a = 3 4 14 17 27 a = 27 3 4 14 17 b = 0 a = 27 3 4 14 a = 27 3 4 14 c = 1 a = 27 3 4 14 27 a = 27 3 4 14 a = 3 4 14 b = 3 a = 3 4 14 a = 3 4 14 c = 2 a = 3 4 14 3 4 a = 3 4 14 3 a = 14 3 b = 2 a = 14 3 a = 14 3 c = 3

5   Pass
assert(isequal(decimate(10,10),8))

b = 0 a = 1 2 3 4 5 6 7 8 9 a = 1 2 3 4 5 6 7 8 9 c = 1 a = 1 2 3 4 5 6 7 8 9 1 a = 1 2 3 4 5 6 7 8 9 a = 2 3 4 5 6 7 8 9 b = 8 a = 2 3 4 5 6 7 8 9 a = 2 3 4 5 6 7 8 9 c = 2 a = 2 3 4 5 6 7 8 9 2 3 a = 2 3 4 5 6 7 8 9 2 a = 4 5 6 7 8 9 2 b = 7 a = 4 5 6 7 8 9 2 a = 4 5 6 7 8 9 2 c = 3 a = 4 5 6 7 8 9 2 4 5 6 a = 4 5 6 7 8 9 2 4 5 a = 7 8 9 2 4 5 b = 6 a = 7 8 9 2 4 5 a = 7 8 9 2 4 5 c = 4 a = 7 8 9 2 4 5 7 8 9 2 a = 7 8 9 2 4 5 7 8 9 a = 4 5 7 8 9 b = 5 a = 4 5 7 8 9 a = 4 5 7 8 9 c = 5 a = 4 5 7 8 9 4 5 7 8 9 a = 4 5 7 8 9 4 5 7 8 a = 4 5 7 8 b = 4 a = 4 5 7 8 a = 4 5 7 8 c = 6

6   Pass
assert(isequal(decimate(2048,2),1))

b = 0 a = Columns 1 through 14 1 3 5 7 9 11 13 15 17 19 21 23 25 27 Columns 15 through 28 29 31 33 35 37 39 41 43 45 47 49 51 53 55 Columns 29 through 42 57 59 61 63 65 67 69 71 73 75 77 79 81 83 Columns 43 through 56 85 87 89 91 93 95 97 99 101 103 105 107 109 111 Columns 57 through 70 113 115 117 119 121 123 125 127 129 131 133 135 137 139 Columns 71 through 84 141 143 145 147 149 151 153 155 157 159 161 163 165 167 Columns 85 through 98 169 171 173 175 177 179 181 183 185 187 189 191 193 195 Columns 99 through 112 197 199 201 203 205 207 209 211 213 215 217 219 221 223 Columns 113 through 126 225 227 229 231 233 235 237 239 241 243 245 247 249 251 Columns 127 through 140 253 255 257 259 261 263 265 267 269 271 273 275 277 279 Columns 141 through 154 281 283 285 287 289 291 293 295 297 299 301 303 305 307 Columns 155 through 168 309 311 313 315 317 319 321 323 325 327 329 331 333 335 Columns 169 through 182 337 339 341 343 345 347 349 351 353 355 357 359 361 363 Columns 183 through 196 365 367 369 371 373 375 377 379 381 383 385 387 389 391 Columns 197 through 210 393 395 397 399 401 403 405 407 409 411 413 415 417 419 Columns 211 through 224 421 423 425 427 429 431 433 435 437 439 441 443 445 447 Columns 225 through 238 449 451 453 455 457 459 461 463 465 467 469 471 473 475 Columns 239 through 252 477 479 481 483 485 487 489 491 493 495 497 499 501 503 Columns 253 through 266 505 507 509 511 513 515 517 519 521 523 525 527 529 531 Columns 267 through 280 533 535 537 539 541 543 545 547 549 551 553 555 557 559 Columns 281 through 294 561 563 565 567 569 571 573 575 577 579 581 583 585 587 Columns 295 through 308 589 591 593 595 597 599 601 603 605 607 609 611 613 615 Columns 309 through 322 617 619 621 623 625 627 629 631 633 635 637 639 641 643 Columns 323 through 336 645 647 649 651 653 655 657 659 661 663 665 667 669 671 Columns 337 through 350 673 675 677 679 681 683 685 687 689 691 693 695 697 699 Columns 351 through 364 701 703 705 707 709 711 713 715 717 719 721 723 725 727 Columns 365 through 378 729 731 733 735 737 739 741 743 745 747 749 751 753 755 Columns 379 through 392 757 759 761 763 765 767 769 771 773 775 777 779 781 783 Columns 393 through 406 785 787 789 791 793 795 797 799 801 803 805 807 809 811 Columns 407 through 420 813 815 817 819 821 823 825 827 829 831 833 835 837 839 Columns 421 through 434 841 843 845 847 849 851 853 855 857 859 861 863 865 867 Columns 435 through 448 869 871 873 875 877 879 881 883 885 887 889 891 893 895 Columns 449 through 462 897 899 901 903 905 907 909 911 913 915 917 919 921 923 Columns 463 through 476 925 927 929 931 933 935 937 939 941 943 945 947 949 951 Columns 477 through 490 953 955 957 959 961 963 965 967 969 971 973 975 977 979 Columns 491 through 504 981 983 985 987 989 991 993 995 997 999 1001 1003 1005 1007 Columns 505 through 518 1009 1011 1013 1015 1017 1019 1021 1023 1025 1027 1029 1031 1033 1035 Columns 519 through 532 1037 1039 1041 1043 1045 1047 1049 1051 1053 1055 1057 1059 1061 1063 Columns 533 through 546 1065 1067 1069 1071 1073 1075 1077 1079 1081 1083 1085 1087 1089 1091 Columns 547 through 560 1093 1095 1097 1099 1101 1103 1105 1107 1109 1111 1113 1115 1117 1119 Columns 561 through 574 1121 1123 1125 1127 1129 1131 1133 1135 1137 1139 1141 1143 1145 1147 Columns 575 through 588 1149 1151 1153 1155 1157 1159 1161 1163 1165 1167 1169 1171 1173 1175 Columns 589 through 602 1177 1179 1181 1183 1185 1187 1189 1191 1193 1195 1197 1199 1201 1203 Columns 603 through 616 1205 1207 1209 1211 1213 1215 1217 1219 1221 1223 1225 1227 1229 1231 Columns 617 through 630 1233 1235 1237 1239 1241 1243 1245 1247 1249 1251 1253 1255 1257 1259 Columns 631 through 644 1261 1263 1265 1267 1269 1271 1273 1275 1277 1279 1281 1283 1285 1287 Columns 645 through 658 1289 1291 1293 1295 1297 1299 1301 1303 1305 1307 1309 1311 1313 1315 Columns 659 through 672 1317 1319 1321 1323 1325 1327 1329 1331 1333 1335 1337 1339 1341 1343 Columns 673 through 686 1345 1347 1349 1351 1353 1355 1357 1359 1361 1363 1365 1367 1369 1371 Columns 687 through 700 1373 1375 1377 1379 1381 1383 1385 1387 1389 1391 1393 1395 1397 1399 Columns 701 through 714 1401 1403 1405 1407 1409 1411 1413 1415 1417 1419...