This solution is outdated. To rescore this solution, sign in.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
p = [0;2;3;1;5;6;4;7;9;10;11;12;13;17;14;16;8;18;19;20;21;22;23;15;25;26;24];
m = sliding3d(p);
for i = 1:numel(m)
if round(m(i)) == m(i) && m(i) <= numel(p) && m(i) > 0
zero=find(p == 0);
[a0 b0 c0] = ind2sub([3 3 3],zero);
[a1 b1 c1] = ind2sub([3 3 3],m(i));
if abs(a1 - a0) + abs(b1 - b0) + abs(c1 - c0) == 1
p([m(i) zero]) = p([zero m(i)]);
end
end
end
assert(isequal(p,[1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24;25;26;0]))
|
2 | Pass |
p = [1;0;2;4;8;5;7;9;18;10;21;12;11;14;15;16;17;6;13;3;19;20;22;24;25;23;26];
m = sliding3d(p);
for i = 1:numel(m)
if round(m(i)) == m(i) && m(i) <= numel(p) && m(i) > 0
zero=find(p == 0);
[a0 b0 c0] = ind2sub([3 3 3],zero);
[a1 b1 c1] = ind2sub([3 3 3],m(i));
if abs(a1 - a0) + abs(b1 - b0) + abs(c1 - c0) == 1
p([m(i) zero]) = p([zero m(i)]);
end
end
end
assert(isequal(p,[1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24;25;26;0]))
|
3 | Pass |
p = [1;4;3;19;10;6;7;2;9;20;11;0;16;14;12;5;13;18;22;23;21;17;15;24;25;8;26];
m = sliding3d(p);
for i = 1:numel(m)
if round(m(i)) == m(i) && m(i) <= numel(p) && m(i) > 0
zero=find(p == 0);
[a0 b0 c0] = ind2sub([3 3 3],zero);
[a1 b1 c1] = ind2sub([3 3 3],m(i));
if abs(a1 - a0) + abs(b1 - b0) + abs(c1 - c0) == 1
p([m(i) zero]) = p([zero m(i)]);
end
end
end
assert(isequal(p,[1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24;25;26;0]))
|
4 | Pass |
p = [1;5;3;10;7;0;13;9;24;22;2;15;16;11;17;12;8;6;19;20;21;26;14;23;4;25;18];
m = sliding3d(p);
for i = 1:numel(m)
if round(m(i)) == m(i) && m(i) <= numel(p) && m(i) > 0
zero=find(p == 0);
[a0 b0 c0] = ind2sub([3 3 3],zero);
[a1 b1 c1] = ind2sub([3 3 3],m(i));
if abs(a1 - a0) + abs(b1 - b0) + abs(c1 - c0) == 1
p([m(i) zero]) = p([zero m(i)]);
end
end
end
assert(isequal(p,[1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24;25;26;0]))
|
8396 Solvers
Remove the polynomials that have positive real elements of their roots.
447 Solvers
205 Solvers
232 Solvers
Is this a valid Tic Tac Toe State?
92 Solvers