Cody

Solution 550545

Submitted on 29 Dec 2014 by goc3
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))

arr = 1 2 4 5 7 8 10 arr = 1 4 5 8 10 arr = 4 5 10 arr = 4 10 arr = 4

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

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

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

arr = Columns 1 through 8 1 2 3 4 5 6 7 8 Columns 9 through 16 9 10 11 12 13 14 15 16 Columns 17 through 24 17 18 19 20 21 22 23 24 Columns 25 through 32 25 26 27 28 29 30 31 32 Columns 33 through 40 33 34 35 36 37 38 39 40 Columns 41 through 48 41 42 43 44 45 46 47 48 Columns 49 through 56 49 51 52 53 54 55 56 57 Columns 57 through 64 58 59 60 61 62 63 64 65 Columns 65 through 72 66 67 68 69 70 71 72 73 Columns 73 through 80 74 75 76 77 78 79 80 81 Columns 81 through 88 82 83 84 85 86 87 88 89 Columns 89 through 96 90 91 92 93 94 95 96 97 Columns 97 through 104 98 99 101 102 103 104 105 106 Columns 105 through 112 107 108 109 110 111 112 113 114 Columns 113 through 120 115 116 117 118 119 120 121 122 Columns 121 through 128 123 124 125 126 127 128 129 130 Columns 129 through 136 131 132 133 134 135 136 137 138 Columns 137 through 144 139 140 141 142 143 144 145 146 Columns 145 through 152 147 148 149 151 152 153 154 155 Columns 153 through 160 156 157 158 159 160 161 162 163 Columns 161 through 168 164 165 166 167 168 169 170 171 Columns 169 through 176 172 173 174 175 176 177 178 179 Columns 177 through 184 180 181 182 183 184 185 186 187 Columns 185 through 192 188 189 190 191 192 193 194 195 Columns 193 through 200 196 197 198 199 201 202 203 204 Columns 201 through 208 205 206 207 208 209 210 211 212 Columns 209 through 216 213 214 215 216 217 218 219 220 Columns 217 through 224 221 222 223 224 225 226 227 228 Columns 225 through 232 229 230 231 232 233 234 235 236 Columns 233 through 240 237 238 239 240 241 242 243 244 Columns 241 through 248 245 246 247 248 249 251 252 253 Columns 249 through 256 254 255 256 257 258 259 260 261 Columns 257 through 264 262 263 264 265 266 267 268 269 Columns 265 through 272 270 271 272 273 274 275 276 277 Columns 273 through 280 278 279 280 281 282 283 284 285 Columns 281 through 288 286 287 288 289 290 291 292 293 Columns 289 through 296 294 295 296 297 298 299 301 302 Columns 297 through 304 303 304 305 306 307 308 309 310 Columns 305 through 312 311 312 313 314 315 316 317 318 Columns 313 through 320 319 320 321 322 323 324 325 326 Columns 321 through 328 327 328 329 330 331 332 333 334 Columns 329 through 336 335 336 337 338 339 340 341 342 Columns 337 through 344 343 344 345 346 347 348 349 351 Columns 345 through 352 352 353 354 355 356 357 358 359 Columns 353 through 360 360 361 362 363 364 365 366 367 Columns 361 through 368 368 369 370 371 372 373 374 375 Columns 369 through 376 376 377 378 379 380 381 382 383 Columns 377 through 384 384 385 386 387 388 389 390 391 Columns 385 through 392 392 393 394 395 396 397 398 399 Columns 393 through 400 401 402 403 404 405 406 407 408 Columns 401 through 408 409 410 411 412 413 414 415 416 Columns 409 through 416 417 418 419 420 421 422 423 424 Columns 417 through 424 425 426 427 428 429 430 431 432 Columns 425 through 432 433 434 435 436 437 438 439 440 Columns 433 through 440 441 442 443 444 445 446 447 448 Columns 441 through 448 449 451 452 453 454 455 456 457 Columns 449 through 456 458 459 460 461 462 463 464 465 Columns 457 through 464 466 467 468 469 470 471 472 473 Columns 465 through 472 474 475 476 477 478 479 480 481 Columns 473 through 480 482 483 484 485 486 487 488 489 Columns 481 through 488 490 491 492 493 494 495 496 497 Columns 489 through 496 498 499 501 502 503 504 505 506 Columns 497 through 504 507 508 509 510 511 512 513 514 Columns 505 through 512 515 516 517 518 519 520 521 522 Columns 513 through 520 523 524 525 526 527 528 529 530 Columns 521 through 528 531 532 533 534 535 536 537 538 Columns 529 through 536 539 540 541 542 543 544 545 546 Columns 537 through 544 547 548 549 551 552 553 554 555 Columns 545 through 552 556 557 558 559 560 561 562 563 Columns 553 through 560 564 565 566 567 568 569 570 571 Columns 561 through 568 572 573 574 575 576 577 578 579 Columns 569 through 576 580 581 582 583 584 585 586 587 Columns 577 through 584 588 589 590 591 592 593 594 595 Columns 585 through 592 596 597 598 599 601 602 603 604 Columns 593 through 600 605 606 607 608 609 610 611 612 Columns 601 through 608 613 614 615 616 617 618 619 620 Columns 609 through 616 621 622 623 624 625 626 627 628 Columns 617 through 624 629 630 631 632 633 634 635 636 Columns 625 through 632 637 638 639 640 641 642 643 644 Columns 633 through 640 645 646 647 648 649 651 652 653 Columns 641 through 648 654 655 656 657 658 659 660 661 Columns 649 through 656 662 663 ...

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

arr = Columns 1 through 16 1 2 3 4 6 7 8 9 11 12 13 14 16 17 18 19 Columns 17 through 24 21 22 23 24 26 27 28 29 arr = Columns 1 through 16 1 2 3 4 7 8 9 11 13 14 16 17 19 21 22 23 Columns 17 through 20 26 27 28 29 arr = 2 3 4 7 9 11 13 14 17 19 21 22 26 27 28 29 arr = 3 4 7 9 13 14 17 19 22 26 27 28 arr = 3 4 7 9 14 17 19 22 27 28 arr = 3 4 9 14 17 19 27 28 arr = 3 4 14 17 19 27 arr = 3 4 14 17 27 arr = 3 4 14 27 arr = 3 4 14 arr = 3 4 14 arr = 3 14 arr = 3 14 arr = 3

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

arr = 1 2 3 4 5 6 7 8 9 arr = 1 2 3 4 5 6 7 8 9 arr = 2 3 4 5 6 7 8 9 arr = 2 4 5 6 7 8 9 arr = 2 4 5 7 8 9 arr = 2 4 5 7 8 9 arr = 4 5 7 8 9 arr = 4 5 7 8 arr = 4 5 7 8 arr = 4 5 7 8 arr = 4 7 8 arr = 4 7 8 arr = 4 7 8 arr = 4 8 arr = 4 8 arr = 4 8 arr = 4 8 arr = 4 8 arr = 8

6   Fail
%% assert(isequal(decimate(2048,2),1))

arr = Columns 1 through 8 1 3 5 7 9 11 13 15 Columns 9 through 16 17 19 21 23 25 27 29 31 Columns 17 through 24 33 35 37 39 41 43 45 47 Columns 25 through 32 49 51 53 55 57 59 61 63 Columns 33 through 40 65 67 69 71 73 75 77 79 Columns 41 through 48 81 83 85 87 89 91 93 95 Columns 49 through 56 97 99 101 103 105 107 109 111 Columns 57 through 64 113 115 117 119 121 123 125 127 Columns 65 through 72 129 131 133 135 137 139 141 143 Columns 73 through 80 145 147 149 151 153 155 157 159 Columns 81 through 88 161 163 165 167 169 171 173 175 Columns 89 through 96 177 179 181 183 185 187 189 191 Columns 97 through 104 193 195 197 199 201 203 205 207 Columns 105 through 112 209 211 213 215 217 219 221 223 Columns 113 through 120 225 227 229 231 233 235 237 239 Columns 121 through 128 241 243 245 247 249 251 253 255 Columns 129 through 136 257 259 261 263 265 267 269 271 Columns 137 through 144 273 275 277 279 281 283 285 287 Columns 145 through 152 289 291 293 295 297 299 301 303 Columns 153 through 160 305 307 309 311 313 315 317 319 Columns 161 through 168 321 323 325 327 329 331 333 335 Columns 169 through 176 337 339 341 343 345 347 349 351 Columns 177 through 184 353 355 357 359 361 363 365 367 Columns 185 through 192 369 371 373 375 377 379 381 383 Columns 193 through 200 385 387 389 391 393 395 397 399 Columns 201 through 208 401 403 405 407 409 411 413 415 Columns 209 through 216 417 419 421 423 425 427 429 431 Columns 217 through 224 433 435 437 439 441 443 445 447 Columns 225 through 232 449 451 453 455 457 459 461 463 Columns 233 through 240 465 467 469 471 473 475 477 479 Columns 241 through 248 481 483 485 487 489 491 493 495 Columns 249 through 256 497 499 501 503 505 507 509 511 Columns 257 through 264 513 515 517 519 521 523 525 527 Columns 265 through 272 529 531 533 535 537 539 541 543 Columns 273 through 280 545 547 549 551 553 555 557 559 Columns 281 through 288 561 563 565 567 569 571 573 575 Columns 289 through 296 577 579 581 583 585 587 589 591 Columns 297 through 304 593 595 597 599 601 603 605 607 Columns 305 through 312