Cody

# Problem 44353. Group-wise Euclidean distance

Solution 1984790

Submitted on 21 Oct 2019
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
assessFunctionAbsence({'regexp','regexpi','regexprep','str2num','tic','toc','persistent','global','rng','assert','!','system','unix','noCheater'},'FileName','groupDist.m')

2   Pass
fid = fopen('noCheater.p','Wb'); fwrite(fid, hex2dec(reshape([ '7630312E30307630302E30300007701CAB777FB100000015000000740000007E3D5C20F'...' '5319EEB8B0D3D9C9C87C18B91C13D7310D9D8E837C95E62D49A3FE08B071790DBC222B5'... '839E9A19EA6AA7CF3785A7E7CEC1CFE46E0E9A5DB7C82D69A4FAB7BF308D0871C342A5F'... 'EF9AF61623F1D97F80207388D54ABA3CB3D551617DA33AA3F5040CD425FC9B29E2A4233'... 'AE7C5ADEF399'],2,[]).')); rehash path; fclose(fid); assert(noCheater(),'Cheater detected!')

3   Pass
g = [2 1 3 2 1].'; x = [3 10 15 8 5].'; y_correct = [0 2 5 2 0 7 5 7 0]; assert(isequaln(y_correct,groupDist(x,g)))

group1 = 2 5 group2 = 1 4 group2 = 3 group1 = 1 4 group2 = 3 group1 = 3

4   Pass
g = [1 2 2].'; x = [0 0 5 12 3 4]; y_correct = [0 5; 5 0]; assert(isequal(y_correct,groupDist(x,g)))

group1 = 1 group2 = 2 3 group1 = 2 3

5   Pass
g = [2 2 3 3 3 1].'; x = [-5 12 3 4 -7 -24 25 4 9 40 0 0]; y_correct = [0 5 25; 5 0 22 25 22 0]; assert(isequal(y_correct,groupDist(x,g)))

group1 = 6 group2 = 1 2 group2 = 3 4 5 group1 = 1 2 group2 = 3 4 5 group1 = 3 4 5

6   Pass
g = randperm(10).'; x = rand(10,1); a = sortrows([g,x]); y_correct = abs(a(:,2)-a(:,2).'); assert(isequal(round(y_correct,10),round(groupDist(x,g),10)))

group1 = 3 group2 = 7 group2 = 6 group2 = 2 group2 = 4 group2 = 1 group2 = 10 group2 = 5 group2 = 8 group2 = 9 group1 = 7 group2 = 6 group2 = 2 group2 = 4 group2 = 1 group2 = 10 group2 = 5 group2 = 8 group2 = 9 group1 = 6 group2 = 2 group2 = 4 group2 = 1 group2 = 10 group2 = 5 group2 = 8 group2 = 9 group1 = 2 group2 = 4 group2 = 1 group2 = 10 group2 = 5 group2 = 8 group2 = 9 group1 = 4 group2 = 1 group2 = 10 group2 = 5 group2 = 8 group2 = 9 group1 = 1 group2 = 10 group2 = 5 group2 = 8 group2 = 9 group1 = 10 group2 = 5 group2 = 8 group2 = 9 group1 = 5 group2 = 8 group2 = 9 group1 = 8 group2 = 9 group1 = 9

7   Pass
g = [1,2,3].'; x = [2,5,10].'; y_correct = [0 3 8 3 0 5 8 5 0]; assert(isequaln(y_correct,groupDist(x,g)))

group1 = 1 group2 = 2 group2 = 3 group1 = 2 group2 = 3 group1 = 3

8   Pass
global t t = zeros(1,3); rng(923,'twister'); n = 5e3; d = 3; m = 5; x = rand(n,d); g = randi(m,n,1); y_correct = [0,0.00653919638188362,0.00319052186150122,0.00858841434457234,0.00359654235965771 0.00653919638188362,0,0.00855286615862212,0.00589790293838067,0.00484910151004134 0.00319052186150122,0.00855286615862212,0,0.00591041083080696,0.00483607360689871 0.00858841434457234,0.00589790293838067,0.00591041083080696,0,0.00695738487959094 0.00359654235965771,0.00484910151004134,0.00483607360689871,0.00695738487959094,0]; tic, y = groupDist(x,g); t(1) = toc; assert(isequal(round(y_correct,10),round(y,10)))

group1 = Columns 1 through 15 17 19 21 29 33 59 62 63 64 74 94 96 98 103 107 Columns 16 through 30 111 115 118 122 126 129 131 136 148 154 156 159 160 172 182 Columns 31 through 45 185 187 199 200 208 213 216 221 226 227 233 234 237 250 258 Columns 46 through 60 259 264 265 266 271 274 276 281 283 290 293 298 299 311 323 Columns 61 through 75 325 330 340 341 354 358 368 371 373 383 384 389 390 391 392 Columns 76 through 90 402 412 427 429 434 442 443 444 445 449 458 464 468 473 479 Columns 91 through 105 480 481 487 490 492 495 496 500 505 510 513 514 515 529 539 Columns 106 through 120 548 549 552 559 563 565 566 570 574 577 579 585 586 597 605 Columns 121 through 135 617 628 630 631 635 637 643 645 656 661 663 664 666 667 668 Columns 136 through 150 678 689 699 704 705 707 708 709 713 715 716 719 725 727 732 Columns 151 through 165 740 742 743 747 751 752 753 754 756 766 785 788 794 798 814 Columns 166 through 180 832 834 844 846 854 858 860 868 879 884 889 895 897 904 908 Columns 181 through 195 917 922 932 934 935 939 942 943 944 965 966 971 977 981 985 Columns 196 through 210 989 991 994 995 996 999 1003 1004 1007 1011 1016 1022 1025 1026 1027 Columns 211 through 225 1029 1032 1035 1037 1039 1043 1046 1063 1065 1069 1074 1075 1084 1091 1093 Columns 226 through 240 1095 1096 1103 1106 1111 1112 1115 1117 1119 1122 1127 1131 1133 1144 1147 Columns 241 through 255 1150 1157 1158 1160 1176 1194 1198 1200 1213 1214 1218 1219 1230 1232 1234 Columns 256 through 270 1235 1236 1239 1242 1243 1247 1254 1257 1266 1271 1272 1279 1281 1288 1296 Columns 271 through 285 1298 1303 1304 1306 1311 1312 1320 1339 1340 1343 1360 1364 1369 1375 1377 Columns 286 through 300 1378 1403 1406 1412 1413 1418 1423 1431 1433 1437 1451 1453 1455 1456 1457 Columns 301 through 315 1471 1474 1476 1480 1482 1488 1493 1499 1504 1515 1518 1521 1529 1546 1552 Columns 316 through 330 1555 1568 1579 1589 1611 1614 1617 1631 1637 1638 1639 1640 1642 1663 1674 Columns 331 through 345 1676 1677 1681 1683 1686 1690 1691 1693 1703 1705 1707 1717 1719 1721 1726 Columns 346 through 360 1733 1740 1744 1746 1748 1749 1750 1752 1759 1760 1766 1767 1776 1778 1787 Columns 361 through 375 1792 1800 1806 1814 1816 1822 1823 1826 1829 1830 1831 1834 1845 1847 1851 Columns 376 through 390 1853 1857 1864 1865 1889 1893 1894 1900 1903 1905 1915 1923 1924 1926 1934 Columns 391 through 405 1939 1942 1949 1954 1972 1974 1975 1989 1990 1996 1999 2002 2007 2010 2011 Columns 406 through 420 2013 2020 2028 2029 2039 2041 2045 2046 2054 2059 2066 2068 2069 2072 2075 Columns 421 through 435 2079 2080 2086 2087 2089 2090 2109 2120 2122 2124 2128 2132 2133 2135 2138 Columns 436 through 450 2143 2145 2146 2152 2164 2166 2170 2171 2180 2182 2183 2188 2195 2198 2202 Columns 451 through 465 2204 2216 2217 2222 2227 2228 2230 2234 2242 2243 2252 2256 2262 2271 2273 Columns 466 through 480 2274 2282 2287 2293 2300 2306 2308 2314 2320 2323 2325 2330 2341 2342 2345 Columns 481 through 495 2348 2352 2356 2359 2365 2373 2376 2385 2394 2402 2417 2418 2420 2424 2426 Columns 496 through 510 2439 2445 2446 2448 2452 2453 2468 2472 2473 2478 2485 2486 2490 2495 2509 Columns 511 through 525 2510 2513 2516 2518 2520 2525 2531 2534 2550 2557 2560 2565 2567 2571 2581 Columns 526 through 540 2589 2595 2606 2619 2622 2624 2626 2639 2646 2654 2655 2666 2669 2674 2685 Columns 541 through 555 2699 2700 2702 2703 2711 2716 2718 2721 2732 2737 2741 2743 2754 2756 2771 Columns 556 through 570 2774 2779 2781 2782 2788 2796 2798 2799 2801 2803 2805 2813 2816 2822 2824 Columns 571 through 585 2838 2839 2862 2863 2867 2868 2869 2877 2886 2898 2905 2915 2923 2933 2941 Columns 586 through 600 2942 2947 2961 2964 2969 2972 2974 2976 2978 2982 3000 3004 3006 3011 3027 Columns 601 through 615 3031 3034 3043 3046 3048 3049 3060 3062 3075 3077 3078 3085 3093 3097 3102 Columns 616 through 630 3109 3121 3122 3129 3138 3139 3141 3158 3160 3167 3170 3175 3176 3179 3180 Columns 631 through 645 3188 3191 3198 3201 3202 3203 3210 3229 3231 3235 3244 3247 3249 3250 3252 Columns 646 through 660 3257 3259 3261 3263 3266 3267 3274 3278 3280 3282 3287 3289 3293 3294 3295 Columns 661 through 675 3297 3308 3314 3327 3337 3338 3345 3351 3364 3366 3370 3373 3379 3389 3391 Columns 676 through 690 3397 3400 3408 3419 3424 3425 3435 3442 3445 3448 3461 3462 3469 3480 3486 Columns 691 through 705 3493 3494 3502 3505 3511 3512 3522 3525 3527 3530 3535 3536 3540 3544 3546 Columns 706 through 720 3549 3552 3565 3566 3571 3575 3577 3579 3582 3585 3591 3592 35...

9   Pass
global t rng(123) rng(max('cody5'),'combRecursive'); n = 5e3; d = 3; m = 100; x = 10*rand(n,d); g = randi(m,n,1); tic, y = groupDist(x,g); t(2) = toc; assert(norm(y-y.') < 1e-11 && all(~diag(y)) && all(size(y)==m) && abs(det(y)-0.030846735888559)<1e-8 &&... abs(cond(y)-1.606720826682107e+04) < 1e-6 && abs(max(nonzeros(y))-1.058563379304832)<1e-10 &&... abs(mean(nonzeros(y))-0.419901913602729)<1e-8)

group1 = Columns 1 through 15 109 116 351 390 419 433 502 535 551 573 737 740 846 958 999 Columns 16 through 30 1087 1089 1139 1158 1248 1294 1390 1464 1499 1594 1623 1624 1694 1890 2026 Columns 31 through 45 2105 2286 2920 3007 3017 3020 3112 3115 3118 3146 3234 3897 4032 4042 4251 Columns 46 through 53 4312 4333 4377 4505 4560 4833 4834 4845 group2 = Columns 1 through 15 128 344 494 543 716 811 1001 1011 1039 1131 1176 1223 1378 1400 1645 Columns 16 through 30 2252 2284 2365 2416 2454 2516 2654 2683 2845 3076 3206 3440 3477 3567 3597 Columns 31 through 40 3714 3799 3936 4138 4322 4354 4372 4426 4440 4992 group2 = Columns 1 through 15 252 257 565 628 681 1021 1040 1090 1096 1226 1338 1449 1484 1567 1699 Columns 16 through 30 1757 1810 1822 1887 1896 2035 2122 2135 2177 2204 2206 2330 2384 2429 2435 Columns 31 through 45 2509 2517 2610 2687 2858 3005 3049 3078 3215 3299 3341 3381 3496 3625 3681 Columns 46 through 56 3767 3770 4023 4309 4364 4408 4630 4681 4886 4933 4979 group2 = Columns 1 through 15 157 236 238 266 337 393 436 615 702 741 912 1036 1198 1202 1638 Columns 16 through 30 1679 1691 2232 2275 2285 2312 2666 2801 2921 2951 3060 3193 3204 3220 3275 Columns 31 through 45 3279 3351 3467 3525 3933 3943 3953 4005 4018 4094 4493 4538 4542 4564 4672 Column 46 4688 group2 = Columns 1 through 15 142 281 291 373 415 528 541 623 770 911 936 963 1002 1181 1309 Columns 16 through 30 1320 1731 1804 1864 2004 2164 2235 2305 2345 2355 2391 2403 2906 3069 3226 Columns 31 through 45 3247 3356 3392 3491 3518 3565 3615 3664 3761 3818 4086 4273 4471 4507 4646 Column 46 4895 group2 = Columns 1 through 15 14 18 173 228 306 331 382 485 512 576 687 734 791 847 853 Columns 16 through 30 1100 1121 1324 1542 1703 1732 1748 1755 1861 1867 1870 1898 2064 2093 2189 Columns 31 through 45 2201 2407 2484 2566 2747 2759 3022 3308 3399 3442 3472 3773 3872 4274 4501 Columns 46 through 51 4582 4666 4682 4706 4806 4859 group2 = Columns 1 through 15 32 100 135 241 251 302 316 552 667 920 957 1265 1268 1323 1457 Columns 16 through 30 1587 1622 1629 1952 2086 2190 2296 2304 2375 2560 2576 2597 2669 2720 2850 Columns 31 through 45 2854 2935 3370 3494 3501 3563 3701 3706 3745 3792 3878 3927 3932 4007 4163 Columns 46 through 54 4186 4200 4201 4529 4671 4802 4850 4885 4980 group2 = Columns 1 through 15 23 46 515 708 819 896 965 1003 1140 1145 1237 1327 1353 1569 1578 Columns 16 through 30 1584 1960 2278 2397 2896 2898 2929 2948 3172 3184 3301 3318 3346 3379 3508 Columns 31 through 42 3600 3753 3801 3856 3870 4067 4140 4581 4702 4841 4907 4965 group2 = Columns 1 through 15 26 27 163 213 343 368 421 674 694 1092 1162 1243 1276 1381 1440 Columns 16 through 30 1517 1588 1618 1770 1880 1882 1948 2074 2244 2253 2393 2514 2529 2546 2607 Columns 31 through 45 2625 2632 2786 2841 2999 3034 3066 3102 3294 3358 3455 3469 3503 3504 3555 Columns 46 through 60 3604 3652 3673 3899 3955 3990 4071 4103 4250 4342 4344 4458 4492 4550 4674 Columns 61 through 65 4730 4740 4757 4762 4858 group2 = Columns 1 through 15 170 243 250 712 807 1048 1084 1203 1230 1252 1377 1580 1598 1740 1871 Columns 16 through 30 1943 1977 2091 2240 2332 2575 2627 2737 2753 2868 2946 2998 3107 3145 3272 Columns 31 through 45 3633 3663 3670 3718 3732 3866 3959 3962 4041 4043 4046 4048 4081 4143 4154 Columns 46 through 54 4370 4392 4585 4670 4684 4849 4861 4927 4976 group2 = Columns 1 through 15 218 248 545 657 727 838 954 1196 1434 1441 1492 1687 1824 1848 2075 Columns 16 through 30 2148 2264 2990 3051 3164 3278 3343 3359 3583 3613 3662 4134 4195 4204 4399 Columns 31 through 34 4448 4490 4686 4694 group2 = Columns 1 through 15 176 521 633 641 739 969 1343 1356 1528 1546 1563 1636 1706 1768 1791 Columns 16 through 30 1802 1878 1931 2046 2133 2249 2283 2308 2316 2346 2399 2462 2658 2769 2770 Columns 31 through 45 2818 2902 2969 3012 3058 3192 3305 3404 3430 3486 3776 3893 3942 3976 3998 Columns 46 through 60 4061 4253 4305 4417 4604 4623 4705 4739 4747 4783 4819 4824 4913 4966 4999 group2 = Columns 1 through 15 39 81 144 147 153 247 255 280 508 556 560 663 872 923 953 Columns 16 through 30 1110 1197 1415 1451 1508 1659 1714 1725 1975 2263 2294 2727 2775 2840 2866 Columns 31 through 45 3000 3011 3038 3199 3248 3264 3476 3527 3594 3601 3667 3746 3913 3919 4055 Columns 46 through 56 4069 4110 4216 4289 4347 4397 4559 4573 4768 4796 4810 group2 = Columns 1 through 15 86 119 121 130 298 312 366 496 574 634 640 700 834 927 941 Columns 16 through 30 959 1098 1105 1357 1420 1518 1811 2181 2358 2466 2539 2641 2813 2957 3033 Columns 31 through 45 3056 3064 3150 3222 3243 3283 3542 3659 3826 4169 4375 4398 4462 4512 4546 Columns 46 through 49 ...

10   Pass
global t rng(sum('Cody5, Oct. 16, 2017'),'multFibonacci') n = 5e3; d = 1e2; m = 100; x = 5*randn(n,d) + 20; g = randi(m,n,1); tic, y = groupDist(x,g); t(3) = toc; assert(norm(y-y.') < 1e-11 && all(~diag(y)) && all(size(y)==m) && ... abs(cond(y)-2.024633860688276e+02) < 1e-8 && abs(max(nonzeros(y))-57.768463869822135)<1e-10 &&... abs(mean(nonzeros(y))-53.852605466762945)<1e-8)

group1 = Columns 1 through 15 166 173 286 355 400 406 432 565 643 650 692 817 1083 1110 1124 Columns 16 through 30 1195 1679 1854 1997 2138 2158 2257 2263 2269 2307 2330 2361 2472 2721 2892 Columns 31 through 45 2945 3064 3215 3349 3374 3376 3398 3400 3495 3597 3815 3933 3953 4005 4156 Columns 46 through 56 4270 4462 4496 4534 4538 4585 4634 4703 4738 4787 4829 group2 = Columns 1 through 15 160 234 308 338 418 433 558 601 634 917 947 1036 1091 1104 1202 Columns 16 through 30 1326 1635 1695 1788 1812 1933 1939 2072 2306 2377 2426 2496 2757 2868 2900 Columns 31 through 45 2911 3058 3209 3367 3399 3637 3764 3970 4216 4328 4380 4597 4733 4802 4903 Column 46 4947 group2 = Columns 1 through 15 6 205 484 531 536 564 788 857 901 916 934 1005 1057 1105 1222 Columns 16 through 30 1238 1256 1260 1431 1452 1644 1707 2018 2054 2056 2129 2135 2303 2435 2481 Columns 31 through 45 2903 2996 3154 3162 3325 3392 3462 3490 3540 3901 3917 3938 4013 4078 4301 Columns 46 through 53 4481 4519 4533 4571 4684 4843 4867 4911 group2 = Columns 1 through 15 224 314 420 494 559 587 726 967 1017 1041 1094 1196 1509 1561 1568 Columns 16 through 30 1697 1722 1735 1850 1935 1979 2108 2579 2623 2649 2664 2708 3035 3421 3496 Columns 31 through 39 3542 3660 3829 4095 4136 4324 4512 4516 4984 group2 = Columns 1 through 15 19 40 445 465 547 715 756 762 770 842 880 908 1060 1097 1125 Columns 16 through 30 1210 1237 1331 1440 1465 1515 1522 1531 1692 1791 1816 1817 2010 2163 2205 Columns 31 through 45 2454 2716 2926 3104 3182 3225 3254 3286 3339 3402 3551 3755 3838 4137 4383 Columns 46 through 56 4414 4443 4463 4607 4623 4810 4861 4899 4927 4982 4995 group2 = Columns 1 through 15 147 228 295 343 574 618 679 722 723 769 863 919 1028 1032 1096 Columns 16 through 30 1198 1201 1613 1654 1705 1734 1824 1886 1894 1965 2033 2066 2685 2688 2701 Columns 31 through 41 2736 3152 3294 3319 3430 3772 3835 4001 4235 4490 4537 group2 = Columns 1 through 15 86 114 189 281 441 792 827 1011 1081 1106 1127 1673 1724 1822 1954 Columns 16 through 30 2057 2074 2103 2106 2372 2603 2617 2670 2695 2944 2993 3052 3084 3087 3236 Columns 31 through 45 3270 3315 3412 3616 3789 3803 3992 4079 4144 4202 4231 4492 4575 4717 4772 Columns 46 through 47 4778 4814 group2 = Columns 1 through 15 39 46 83 138 146 177 264 413 498 532 600 879 1020 1068 1176 Columns 16 through 30 1247 1253 1338 1367 1546 1610 1740 1763 1768 1805 1908 2117 2171 2245 2329 Columns 31 through 45 2555 2588 2672 2718 2729 2857 2904 3322 3460 3566 3615 3677 4067 4145 4149 Columns 46 through 48 4499 4551 4586 group2 = Columns 1 through 15 97 126 164 187 226 384 457 513 542 633 711 888 1102 1245 1258 Columns 16 through 30 1270 1505 1539 1590 1615 1820 1889 1924 2020 2047 2371 2430 2439 2533 2687 Columns 31 through 45 2699 2782 2878 3002 3039 3149 3157 3232 3576 3697 3736 3944 3997 4007 4125 Columns 46 through 55 4199 4387 4415 4436 4599 4646 4664 4819 4836 4962 group2 = Columns 1 through 15 198 200 214 275 319 346 567 586 602 673 698 774 943 987 1007 Columns 16 through 30 1080 1166 1206 1259 1267 1587 1599 1721 1739 1970 2002 2035 2039 2282 2295 Columns 31 through 45 2370 2373 2424 2528 2668 2751 2884 3117 3234 3301 3395 3547 3575 3648 3661 Columns 46 through 54 3695 4022 4167 4214 4245 4306 4369 4480 4676 group2 = Columns 1 through 15 156 235 398 520 544 569 610 613 635 683 754 765 839 1066 1458 Columns 16 through 30 1793 1877 1903 2238 2446 2473 2665 2702 2861 2863 2865 2889 3034 3060 3074 Columns 31 through 45 3208 3222 3335 3342 3416 3445 3453 3474 3594 3777 3826 3879 3946 4106 4126 Columns 46 through 56 4153 4222 4234 4419 4563 4753 4806 4837 4918 4931 4977 group2 = Columns 1 through 15 90 108 1088 1246 1266 1295 1507 1618 1669 1833 1951 1980 2177 2242 2464 Columns 16 through 30 2501 2574 2666 2780 2872 3220 3303 3362 3440 3860 3909 3923 4031 4077 4238 Columns 31 through 36 4250 4273 4576 4630 4707 4792 group2 = Columns 1 through 15 154 218 331 335 435 450 624 816 950 952 1054 1347 1815 1844 1849 Columns 16 through 30 1922 2070 2080 2393 2443 2515 2771 2965 2976 2995 3089 3102 3229 3275 3489 Columns 31 through 45 3500 3503 3603 3715 3748 3843 3905 4237 4292 4338 4524 4574 4588 4589 4725 Columns 46 through 47 4748 4827 group2 = Columns 1 through 15 8 106 191 253 306 348 410 545 621 755 849 853 918 965 1136 Columns 16 through 30 1190 1283 1284 1303 1463 1602 1786 1823 1941 2003 2022 2085 2101 2266 2550 Columns 31 through 45 2602 2605 2773 2856 2933 3038 3053 3128 3147 3171 3313 3516 3666 3686 3734 Columns 46 through 57 3987 4000 4039 4089 4286 4438 4570 4632 4813 4852 4870 4888 group2 = Columns 1 through 15 31 139 261 334 709 728 869 964 1015 ...

11   Fail
global t fid = fopen('score.p','Wb'); fwrite(fid,uint8(sscanf([... '7630312E30307630302E3030000B901C454EFFB100000031000001330000018D483A60'... '366BC9545F84AE26323B67424D4E8A7A2E5B7D8ACAA45A1C3C5C8B33E245C95243E3CB'... 'AF5D0D993BDA70B7AB5DA365A83E8CA87FFC45265E23EF80943784C5F48E6E53D5DA34'... 'F1F2ECD34683EABE3B7461DC9E8004CC50B2A79D73495F6F625B5365602B2E6C6093D2'... '997D371DA457CE82327E686AF512A507B2CB62A375BFD1B283DDD2C01EDEF2771EDAA3'... '6ABB4852BA4061E20149688E812EB41A9AF8627EF35755492D2830EB8718BCFE88027E'... '6EA960B63A3B3E26E0451B1DCF14F3C20E70D9D93B08E7FF4AE8D82E7CC38042FD38F7'... 'A14D312EF5652823FEB7E8B52AF5C69F5E7D16B116B5F979EDA77459D6BB61B7971A51'... '041227DD601319D667DF62E8DA5E381FDD07A2806FE835BD2569E5315CDFC19C6B6A2B'... '4F0FF6BA803F1759ACAB133CCFAB6D5A5D002FC2C5F381F0'],'%2X'))); fclose(fid); score(round(5*sum(t))) fprintf('The execution time of test case %d is %.5f seconds \n',[5:7;t]) fprintf('The total execution time is %.5f seconds \n',sum(t)) assert(sum(t)<20, 'Sorry, your solution is too slow. The execution time must not exceed 20 seconds.')

The execution time of test case 5 is 3.80088 seconds The execution time of test case 6 is 5.33608 seconds The execution time of test case 7 is 13.02564 seconds The total execution time is 22.16260 seconds

Sorry, your solution is too slow. The execution time must not exceed 20 seconds.