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