Cody

# Problem 803. Twist 'n' Match

Solution 2052396

Submitted on 9 Dec 2019 by Alexander
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
n = 2; m = 1; a = twist_n_match(n,m); [r,c] = size(a); assert(r==n && c==n); assert(isequal(nnz(a==rot90(a)),m));

in = 2 in = 3

2   Pass
n = 3; m = 7; a = twist_n_match(n,m); [r,c] = size(a); assert(r==n && c==n); assert(isequal(nnz(a==rot90(a)),m));

in = 2

3   Pass
n = 6; m = 6; a = twist_n_match(n,m); [r,c] = size(a); assert(r==n && c==n); assert(isequal(nnz(a==rot90(a)),m));

in = 2 in = 3 in = 4 in = 5 in = 6 in = 7 in = 8 in = 9 in = 10 in = 11 in = 12 in = 13 in = 14 in = 15 in = 16 in = 17 in = 18 in = 19 in = 20 in = 21 in = 22

4   Pass
n = 10; m = 11; a = twist_n_match(n,m); [r,c] = size(a); assert(r==n && c==n); assert(isequal(nnz(a==rot90(a)),m));

in = 2 in = 3 in = 4 in = 5 in = 6 in = 7 in = 8 in = 9 in = 10 in = 11 in = 12 in = 13 in = 14 in = 15 in = 16 in = 17 in = 18 in = 19 in = 20 in = 21 in = 22 in = 23 in = 24 in = 25 in = 26 in = 27 in = 28 in = 29 in = 30 in = 31 in = 32 in = 33 in = 34 in = 35 in = 36 in = 37 in = 38 in = 39 in = 40 in = 41 in = 42 in = 43 in = 44 in = 45 in = 46 in = 47 in = 48 in = 49 in = 50 in = 51 in = 52 in = 53 in = 54 in = 55 in = 56 in = 57 in = 58 in = 59 in = 60 in = 61 in = 62 in = 63 in = 64 in = 65 in = 66 in = 67 in = 68 in = 69

5   Pass
n = 10; m = 14; a = twist_n_match(n,m); [r,c] = size(a); assert(r==n && c==n); assert(isequal(nnz(a==rot90(a)),m));

in = 2 in = 3 in = 4 in = 5 in = 6 in = 7 in = 8 in = 9 in = 10 in = 11 in = 12 in = 13 in = 14 in = 15 in = 16 in = 17 in = 18 in = 19 in = 20 in = 21 in = 22 in = 23 in = 24 in = 25 in = 26 in = 27 in = 28 in = 29 in = 30 in = 31 in = 32 in = 33 in = 34 in = 35 in = 36 in = 37 in = 38 in = 39 in = 40 in = 41 in = 42 in = 43 in = 44 in = 45 in = 46 in = 47 in = 48 in = 49 in = 50 in = 51 in = 52 in = 53 in = 54 in = 55 in = 56 in = 57 in = 58 in = 59 in = 60 in = 61 in = 62 in = 63

6   Pass
n = 20; m = 83; a = twist_n_match(n,m); [r,c] = size(a); assert(r==n && c==n); assert(isequal(nnz(a==rot90(a)),m));

in = 2 in = 3 in = 4 in = 5 in = 6 in = 7 in = 8 in = 9 in = 10 in = 11 in = 12 in = 13 in = 14 in = 15 in = 16 in = 17 in = 18 in = 19 in = 20 in = 21 in = 22 in = 23 in = 24 in = 25 in = 26 in = 27 in = 28 in = 29 in = 30 in = 31 in = 32 in = 33 in = 34 in = 35 in = 36 in = 37 in = 38 in = 39 in = 40 in = 41 in = 42 in = 43 in = 44 in = 45 in = 46 in = 47 in = 48 in = 49 in = 50 in = 51 in = 52 in = 53 in = 54 in = 55 in = 56 in = 57 in = 58 in = 59 in = 60 in = 61 in = 62 in = 63 in = 64 in = 65 in = 66 in = 67 in = 68 in = 69 in = 70 in = 71 in = 72 in = 73 in = 74 in = 75 in = 76 in = 77 in = 78 in = 79 in = 80 in = 81 in = 82 in = 83 in = 84 in = 85 in = 86 in = 87 in = 88 in = 89 in = 90 in = 91 in = 92 in = 93 in = 94 in = 95 in = 96 in = 97 in = 98 in = 99 in = 100 in = 101 in = 102 in = 103 in = 104 in = 105 in = 106 in = 107 in = 108 in = 109 in = 110 in = 111 in = 112 in = 113 in = 114 in = 115 in = 116 in = 117 in = 118 in = 119 in = 120 in = 121 in = 122 in = 123 in = 124 in = 125 in = 126 in = 127 in = 128 in = 129 in = 130 in = 131 in = 132 in = 133 in = 134 in = 135 in = 136 in = 137 in = 138 in = 139 in = 140 in = 141 in = 142 in = 143 in = 144 in = 145 in = 146 in = 147 in = 148 in = 149 in = 150 in = 151 in = 152 in = 153 in = 154 in = 155 in = 156 in = 157 in = 158 in = 159 in = 160 in = 161 in = 162 in = 163 in = 164 in = 165 in = 166 in = 167 in = 168 in = 169 in = 170 in = 171 in = 172 in = 173 in = 174 in = 175 in = 176 in = 177 in = 178 in = 179 in = 180 in = 181 in = 182 in = 183 in = 184 in = 185 in = 186 in = 187 in = 188 in = 189 in = 190 in = 191 in = 192 in = 193 in = 194 in = 195 in = 196 in = 197 in = 198 in = 199 in = 200 in = 201 in = 202 in = 203 in = 204 in = 205 in = 206 in = 207 in = 208 in = 209 in = 210 in = 211 in = 212 in = 213 in = 214 in = 215 in = 216 in = 217 in = 218 in = 219

7   Pass
n = 21; m = 1; a = twist_n_match(n,m); [r,c] = size(a); assert(r==n && c==n); assert(isequal(nnz(a==rot90(a)),m));

in = 2 in = 3 in = 4 in = 5 in = 6 in = 7 in = 8 in = 9 in = 10 in = 11 in = 12 in = 13 in = 14 in = 15 in = 16 in = 17 in = 18 in = 19 in = 20 in = 21 in = 22 in = 23 in = 24 in = 25 in = 26 in = 27 in = 28 in = 29 in = 30 in = 31 in = 32 in = 33 in = 34 in = 35 in = 36 in = 37 in = 38 in = 39 in = 40 in = 41 in = 42 in = 43 in = 44 in = 45 in = 46 in = 47 in = 48 in = 49 in = 50 in = 51 in = 52 in = 53 in = 54 in = 55 in = 56 in = 57 in = 58 in = 59 in = 60 in = 61 in = 62 in = 63 in = 64 in = 65 in = 66 in = 67 in = 68 in = 69 in = 70 in = 71 in = 72 in = 73 in = 74 in = 75 in = 76 in = 77 in = 78 in = 79 in = 80 in = 81 in = 82 in = 83 in = 84 in = 85 in = 86 in = 87 in = 88 in = 89 in = 90 in = 91 in = 92 in = 93 in = 94 in = 95 in = 96 in = 97 in = 98 in = 99 in = 100 in = 101 in = 102 in = 103 in = 104 in = 105 in = 106 in = 107 in = 108 in = 109 in = 110 in = 111 in = 112 in = 113 in = 114 in = 115 in = 116 in = 117 in = 118 in = 119 in = 120 in = 121 in = 122 in = 123 in = 124 in = 125 in = 126 in = 127 in = 128 in = 129 in = 130 in = 131 in = 132 in = 133 in = 134 in = 135 in = 136 in = 137 in = 138 in = 139 in = 140 in = 141 in = 142 in = 143 in = 144 in = 145 in = 146 in = 147 in = 148 in = 149 in = 150 in = 151 in = 152 in = 153 in = 154 in = 155 in = 156 in = 157 in = 158 in = 159 in = 160 in = 161 in = 162 in = 163 in = 164 in = 165 in = 166 in = 167 in = 168 in = 169 in = 170 in = 171 in = 172 in = 173 in = 174 in = 175 in = 176 in = 177 in = 178 in = 179 in = 180 in = 181 in = 182 in = 183 in = 184 in = 185 in = 186 in = 187 in = 188 in = 189 in = 190 in = 191 in = 192 in = 193 in = 194 in = 195 in = 196 in = 197 in = 198 in = 199 in = 200 in = 201 in = 202 in = 203 in = 204 in = 205 in = 206 in = 207 in = 208 in = 209 in = 210 in = 211 in = 212 in = 213 in = 214 in = 215 in = 216 in = 217 in = 218 in = 219 in = 220 in = 221 in = 222 in = 223 in = 224 in = 225 in = 226 in = 227 in = 228 in = 229 in = 230 in = 231 in = 232 in = 233 in = 234 in = 235 in = 236 in = 237 in = 238 in = 239 in = 240 in = 241 in = 242 in = 243 in = 244 in = 245 in = 246 in = 247 in = 248 in = 249 in = 250 in = 251 in = 252 in = 253 in = 254 in = 255 in = 256 in = 257 in = 258 in = 259 in = 260 in = 261 in = 262 in = 263 in = 264 in = 265 in = 266 in = 267 in = 268 in = 269 in = 270 in = 271 in = 272 in = 273 in = 274 in = 275 in = 276 in = 277 in = 278 in = 279 in = 280 in = 281 in = 282 in = 283 in = 284 in = 285 in = 286 in = 287 in = 288 in = 289 in = 290 in = 291 in = 292 in = 293 in = 294 in = 295 in = 296 in = 297 in = 298 in = 299 in = 300 in = 301 in = 302 in = 303 in = 304 in = 305 in = 306 in = 307 in = 308 in = 309 in = 310 in = 311 in = 312 in = 313 in = 314 in = 315 in = 316 in = 317 in = 318 in = 319 in = 320 in = 321 in = 322 in = 323 in = 324 in = 325 in = 326 in = 327 in = 328 in = 329 in = 330 in = 331 in = 332 in = 333 in = 334 in = 335 in = 336 in = 337 in = 338 in = 339 in = 340 in = 341 in = 342 in = 343 in = 344 in = 345 in = 346 in = 347 in = 348 in = 349 in = 350 in = 351 in = 352 in = 353 in = 354 in = 355 in = 356 in = 357 in = 358 in = 359 in = 360 in = 361 in = 362 in = 363 in = 364 in = 365 in = 366 in = 367 in = 368 in = 369 in = 370 in = 371 in = 372 in = 373 in = 374 in = 375 in = 376 in = 377 in = 378 in = 379 in = 380 in = 381 in = 382 in = 383 in = 384 in = 385 in = 386 in = 387 in = 388 in = 389 in = 390 in = 391 in = 392 in = 393 in = 394 in = 395 in = 396 in = 397 in = 398 in = 399 in = 400 in = 401 in = 402 in = 403 in = 404 in = 405 in = 406 in = 407 in = 408 in = 409 in = 410 in = 411 in = 412 in = 413 in = 414 in = 415 in = 416 in = 417 in = 418 in = 419 in = 420 in = 421 in = 422