Solution trying to avoid people meeting too often.
Wasn't able to get with 276 pairs without at least 4 pairs meetings 6 times.
Maybe it's impossible, or a very specific "intricate" solution which my search will not happen upon.
Only got 272 successful pairs, 4 people don't meet.
But at least no one meets more than 3 times.
Here's some extra info:
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | Pairs that meet 0 times: 4
Pairs that meet 1 times: 216
Pairs that meet 2 times: 24
Pairs that meet 3 times: 32
1 8 DONT MEET!
5 10 DONT MEET!
7 14 DONT MEET!
9 21 DONT MEET!
1 and 2 meet 1 times, e.g. day 2 on boat 2
1 and 3 meet 3 times, e.g. day 5 on boat 4
1 and 4 meet 1 times, e.g. day 1 on boat 3
1 and 5 meet 1 times, e.g. day 5 on boat 4
1 and 6 meet 1 times, e.g. day 4 on boat 3
1 and 7 meet 1 times, e.g. day 1 on boat 3
1 8 DONT MEET!
1 and 9 meet 1 times, e.g. day 6 on boat 1
1 and 10 meet 1 times, e.g. day 4 on boat 3
1 and 11 meet 1 times, e.g. day 5 on boat 4
1 and 12 meet 1 times, e.g. day 2 on boat 2
1 and 13 meet 3 times, e.g. day 6 on boat 1
1 and 14 meet 1 times, e.g. day 3 on boat 1
1 and 15 meet 1 times, e.g. day 6 on boat 1
1 and 16 meet 1 times, e.g. day 4 on boat 3
1 and 17 meet 1 times, e.g. day 5 on boat 4
1 and 18 meet 3 times, e.g. day 3 on boat 1
1 and 19 meet 1 times, e.g. day 3 on boat 1
1 and 20 meet 3 times, e.g. day 6 on boat 1
1 and 21 meet 1 times, e.g. day 2 on boat 2
1 and 22 meet 1 times, e.g. day 1 on boat 3
1 and 23 meet 1 times, e.g. day 6 on boat 1
1 and 24 meet 1 times, e.g. day 3 on boat 1
2 and 3 meet 1 times, e.g. day 1 on boat 2
2 and 4 meet 1 times, e.g. day 5 on boat 3
2 and 5 meet 1 times, e.g. day 1 on boat 2
2 and 6 meet 2 times, e.g. day 6 on boat 3
2 and 7 meet 1 times, e.g. day 4 on boat 4
2 and 8 meet 3 times, e.g. day 5 on boat 3
2 and 9 meet 1 times, e.g. day 5 on boat 3
2 and 10 meet 1 times, e.g. day 6 on boat 3
2 and 11 meet 1 times, e.g. day 4 on boat 4
2 and 12 meet 1 times, e.g. day 2 on boat 2
2 and 13 meet 2 times, e.g. day 5 on boat 3
2 and 14 meet 1 times, e.g. day 6 on boat 3
2 and 15 meet 1 times, e.g. day 3 on boat 2
2 and 16 meet 1 times, e.g. day 1 on boat 2
2 and 17 meet 1 times, e.g. day 6 on boat 3
2 and 18 meet 1 times, e.g. day 2 on boat 2
2 and 19 meet 1 times, e.g. day 5 on boat 3
2 and 20 meet 1 times, e.g. day 3 on boat 2
2 and 21 meet 3 times, e.g. day 4 on boat 4
2 and 22 meet 1 times, e.g. day 6 on boat 3
2 and 23 meet 2 times, e.g. day 4 on boat 4
2 and 24 meet 1 times, e.g. day 4 on boat 4
3 and 4 meet 1 times, e.g. day 6 on boat 4
3 and 5 meet 3 times, e.g. day 6 on boat 4
3 and 6 meet 1 times, e.g. day 4 on boat 3
3 and 7 meet 1 times, e.g. day 2 on boat 4
3 and 8 meet 1 times, e.g. day 1 on boat 2
3 and 9 meet 1 times, e.g. day 2 on boat 4
3 and 10 meet 1 times, e.g. day 4 on boat 3
3 and 11 meet 2 times, e.g. day 5 on boat 4
3 and 12 meet 1 times, e.g. day 6 on boat 4
3 and 13 meet 1 times, e.g. day 4 on boat 3
3 and 14 meet 1 times, e.g. day 3 on boat 1
3 and 15 meet 1 times, e.g. day 2 on boat 4
3 and 16 meet 2 times, e.g. day 4 on boat 3
3 and 17 meet 1 times, e.g. day 5 on boat 4
3 and 18 meet 1 times, e.g. day 3 on boat 1
3 and 19 meet 1 times, e.g. day 3 on boat 1
3 and 20 meet 1 times, e.g. day 5 on boat 4
3 and 21 meet 1 times, e.g. day 6 on boat 4
3 and 22 meet 1 times, e.g. day 2 on boat 4
3 and 23 meet 1 times, e.g. day 1 on boat 2
3 and 24 meet 2 times, e.g. day 6 on boat 4
4 and 5 meet 3 times, e.g. day 6 on boat 4
4 and 6 meet 1 times, e.g. day 2 on boat 3
4 and 7 meet 1 times, e.g. day 1 on boat 3
4 and 8 meet 1 times, e.g. day 5 on boat 3
4 and 9 meet 3 times, e.g. day 5 on boat 3
4 and 10 meet 1 times, e.g. day 3 on boat 4
4 and 11 meet 1 times, e.g. day 3 on boat 4
4 and 12 meet 2 times, e.g. day 6 on boat 4
4 and 13 meet 1 times, e.g. day 5 on boat 3
4 and 14 meet 1 times, e.g. day 2 on boat 3
4 and 15 meet 1 times, e.g. day 4 on boat 2
4 and 16 meet 1 times, e.g. day 3 on boat 4
4 and 17 meet 1 times, e.g. day 4 on boat 2
4 and 18 meet 2 times, e.g. day 4 on boat 2
4 and 19 meet 2 times, e.g. day 5 on boat 3
4 and 20 meet 1 times, e.g. day 1 on boat 3
4 and 21 meet 1 times, e.g. day 6 on boat 4
4 and 22 meet 1 times, e.g. day 1 on boat 3
4 and 23 meet 1 times, e.g. day 2 on boat 3
4 and 24 meet 1 times, e.g. day 6 on boat 4
5 and 6 meet 1 times, e.g. day 2 on boat 3
5 and 7 meet 1 times, e.g. day 3 on boat 3
5 and 8 meet 1 times, e.g. day 1 on boat 2
5 and 9 meet 1 times, e.g. day 4 on boat 2
5 10 DONT MEET!
5 and 11 meet 1 times, e.g. day 5 on boat 4
5 and 12 meet 1 times, e.g. day 6 on boat 4
5 and 13 meet 1 times, e.g. day 3 on boat 3
5 and 14 meet 1 times, e.g. day 2 on boat 3
5 and 15 meet 1 times, e.g. day 4 on boat 2
5 and 16 meet 1 times, e.g. day 1 on boat 2
5 and 17 meet 3 times, e.g. day 5 on boat 4
5 and 18 meet 1 times, e.g. day 4 on boat 2
5 and 19 meet 1 times, e.g. day 2 on boat 3
5 and 20 meet 1 times, e.g. day 5 on boat 4
5 and 21 meet 1 times, e.g. day 6 on boat 4
5 and 22 meet 1 times, e.g. day 3 on boat 3
5 and 23 meet 3 times, e.g. day 3 on boat 3
5 and 24 meet 1 times, e.g. day 6 on boat 4
6 and 7 meet 1 times, e.g. day 5 on boat 2
6 and 8 meet 1 times, e.g. day 3 on boat 2
6 and 9 meet 1 times, e.g. day 1 on boat 4
6 and 10 meet 3 times, e.g. day 6 on boat 3
6 and 11 meet 1 times, e.g. day 1 on boat 4
6 and 12 meet 1 times, e.g. day 5 on boat 2
6 and 13 meet 2 times, e.g. day 4 on boat 3
6 and 14 meet 3 times, e.g. day 6 on boat 3
6 and 15 meet 1 times, e.g. day 3 on boat 2
6 and 16 meet 1 times, e.g. day 4 on boat 3
6 and 17 meet 1 times, e.g. day 6 on boat 3
6 and 18 meet 1 times, e.g. day 5 on boat 2
6 and 19 meet 1 times, e.g. day 2 on boat 3
6 and 20 meet 1 times, e.g. day 3 on boat 2
6 and 21 meet 1 times, e.g. day 3 on boat 2
6 and 22 meet 1 times, e.g. day 6 on boat 3
6 and 23 meet 2 times, e.g. day 5 on boat 2
6 and 24 meet 1 times, e.g. day 1 on boat 4
7 and 8 meet 1 times, e.g. day 6 on boat 2
7 and 9 meet 1 times, e.g. day 2 on boat 4
7 and 10 meet 1 times, e.g. day 5 on boat 2
7 and 11 meet 3 times, e.g. day 6 on boat 2
7 and 12 meet 1 times, e.g. day 5 on boat 2
7 and 13 meet 1 times, e.g. day 3 on boat 3
7 14 DONT MEET!
7 and 15 meet 1 times, e.g. day 2 on boat 4
7 and 16 meet 1 times, e.g. day 6 on boat 2
7 and 17 meet 1 times, e.g. day 3 on boat 3
7 and 18 meet 3 times, e.g. day 6 on boat 2
7 and 19 meet 1 times, e.g. day 6 on boat 2
7 and 20 meet 1 times, e.g. day 1 on boat 3
7 and 21 meet 1 times, e.g. day 4 on boat 4
7 and 22 meet 3 times, e.g. day 3 on boat 3
7 and 23 meet 3 times, e.g. day 5 on boat 2
7 and 24 meet 1 times, e.g. day 4 on boat 4
8 and 9 meet 1 times, e.g. day 5 on boat 3
8 and 10 meet 1 times, e.g. day 2 on boat 1
8 and 11 meet 1 times, e.g. day 6 on boat 2
8 and 12 meet 1 times, e.g. day 4 on boat 1
8 and 13 meet 1 times, e.g. day 5 on boat 3
8 and 14 meet 1 times, e.g. day 4 on boat 1
8 and 15 meet 1 times, e.g. day 3 on boat 2
8 and 16 meet 3 times, e.g. day 6 on boat 2
8 and 17 meet 1 times, e.g. day 2 on boat 1
8 and 18 meet 1 times, e.g. day 6 on boat 2
8 and 19 meet 3 times, e.g. day 6 on boat 2
8 and 20 meet 3 times, e.g. day 4 on boat 1
8 and 21 meet 1 times, e.g. day 3 on boat 2
8 and 22 meet 1 times, e.g. day 4 on boat 1
8 and 23 meet 1 times, e.g. day 1 on boat 2
8 and 24 meet 1 times, e.g. day 2 on boat 1
9 and 10 meet 1 times, e.g. day 3 on boat 4
9 and 11 meet 3 times, e.g. day 3 on boat 4
9 and 12 meet 1 times, e.g. day 3 on boat 4
9 and 13 meet 3 times, e.g. day 6 on boat 1
9 and 14 meet 1 times, e.g. day 1 on boat 4
9 and 15 meet 3 times, e.g. day 6 on boat 1
9 and 16 meet 1 times, e.g. day 3 on boat 4
9 and 17 meet 1 times, e.g. day 4 on boat 2
9 and 18 meet 1 times, e.g. day 4 on boat 2
9 and 19 meet 1 times, e.g. day 5 on boat 3
9 and 20 meet 1 times, e.g. day 6 on boat 1
9 21 DONT MEET!
9 and 22 meet 1 times, e.g. day 2 on boat 4
9 and 23 meet 1 times, e.g. day 6 on boat 1
9 and 24 meet 1 times, e.g. day 1 on boat 4
10 and 11 meet 1 times, e.g. day 3 on boat 4
10 and 12 meet 3 times, e.g. day 5 on boat 2
10 and 13 meet 1 times, e.g. day 4 on boat 3
10 and 14 meet 1 times, e.g. day 6 on boat 3
10 and 15 meet 1 times, e.g. day 1 on boat 1
10 and 16 meet 3 times, e.g. day 4 on boat 3
10 and 17 meet 3 times, e.g. day 6 on boat 3
10 and 18 meet 1 times, e.g. day 5 on boat 2
10 and 19 meet 1 times, e.g. day 1 on boat 1
10 and 20 meet 1 times, e.g. day 2 on boat 1
10 and 21 meet 1 times, e.g. day 1 on boat 1
10 and 22 meet 1 times, e.g. day 6 on boat 3
10 and 23 meet 1 times, e.g. day 5 on boat 2
10 and 24 meet 1 times, e.g. day 2 on boat 1
11 and 12 meet 1 times, e.g. day 3 on boat 4
11 and 13 meet 1 times, e.g. day 1 on boat 4
11 and 14 meet 1 times, e.g. day 1 on boat 4
11 and 15 meet 1 times, e.g. day 2 on boat 4
11 and 16 meet 2 times, e.g. day 6 on boat 2
11 and 17 meet 1 times, e.g. day 5 on boat 4
11 and 18 meet 1 times, e.g. day 6 on boat 2
11 and 19 meet 1 times, e.g. day 6 on boat 2
11 and 20 meet 1 times, e.g. day 5 on boat 4
11 and 21 meet 1 times, e.g. day 4 on boat 4
11 and 22 meet 1 times, e.g. day 2 on boat 4
11 and 23 meet 1 times, e.g. day 4 on boat 4
11 and 24 meet 2 times, e.g. day 4 on boat 4
12 and 13 meet 1 times, e.g. day 2 on boat 2
12 and 14 meet 1 times, e.g. day 4 on boat 1
12 and 15 meet 1 times, e.g. day 1 on boat 1
12 and 16 meet 1 times, e.g. day 3 on boat 4
12 and 17 meet 1 times, e.g. day 1 on boat 1
12 and 18 meet 2 times, e.g. day 5 on boat 2
12 and 19 meet 2 times, e.g. day 4 on boat 1
12 and 20 meet 1 times, e.g. day 4 on boat 1
12 and 21 meet 3 times, e.g. day 6 on boat 4
12 and 22 meet 1 times, e.g. day 4 on boat 1
12 and 23 meet 1 times, e.g. day 5 on boat 2
12 and 24 meet 1 times, e.g. day 6 on boat 4
13 and 14 meet 1 times, e.g. day 1 on boat 4
13 and 15 meet 1 times, e.g. day 6 on boat 1
13 and 16 meet 1 times, e.g. day 4 on boat 3
13 and 17 meet 1 times, e.g. day 3 on boat 3
13 and 18 meet 1 times, e.g. day 2 on boat 2
13 and 19 meet 1 times, e.g. day 5 on boat 3
13 and 20 meet 1 times, e.g. day 6 on boat 1
13 and 21 meet 1 times, e.g. day 2 on boat 2
13 and 22 meet 1 times, e.g. day 3 on boat 3
13 and 23 meet 2 times, e.g. day 6 on boat 1
13 and 24 meet 1 times, e.g. day 1 on boat 4
14 and 15 meet 1 times, e.g. day 5 on boat 1
14 and 16 meet 1 times, e.g. day 5 on boat 1
14 and 17 meet 1 times, e.g. day 6 on boat 3
14 and 18 meet 1 times, e.g. day 3 on boat 1
14 and 19 meet 3 times, e.g. day 4 on boat 1
14 and 20 meet 1 times, e.g. day 4 on boat 1
14 and 21 meet 1 times, e.g. day 5 on boat 1
14 and 22 meet 3 times, e.g. day 6 on boat 3
14 and 23 meet 1 times, e.g. day 2 on boat 3
14 and 24 meet 3 times, e.g. day 5 on boat 1
15 and 16 meet 1 times, e.g. day 5 on boat 1
15 and 17 meet 2 times, e.g. day 4 on boat 2
15 and 18 meet 1 times, e.g. day 4 on boat 2
15 and 19 meet 1 times, e.g. day 1 on boat 1
15 and 20 meet 2 times, e.g. day 6 on boat 1
15 and 21 meet 3 times, e.g. day 5 on boat 1
15 and 22 meet 2 times, e.g. day 5 on boat 1
15 and 23 meet 1 times, e.g. day 6 on boat 1
15 and 24 meet 1 times, e.g. day 5 on boat 1
16 and 17 meet 1 times, e.g. day 2 on boat 1
16 and 18 meet 1 times, e.g. day 6 on boat 2
16 and 19 meet 1 times, e.g. day 6 on boat 2
16 and 20 meet 1 times, e.g. day 2 on boat 1
16 and 21 meet 1 times, e.g. day 5 on boat 1
16 and 22 meet 1 times, e.g. day 5 on boat 1
16 and 23 meet 1 times, e.g. day 1 on boat 2
16 and 24 meet 2 times, e.g. day 5 on boat 1
17 and 18 meet 1 times, e.g. day 4 on boat 2
17 and 19 meet 1 times, e.g. day 1 on boat 1
17 and 20 meet 2 times, e.g. day 5 on boat 4
17 and 21 meet 1 times, e.g. day 1 on boat 1
17 and 22 meet 2 times, e.g. day 6 on boat 3
17 and 23 meet 1 times, e.g. day 3 on boat 3
17 and 24 meet 1 times, e.g. day 2 on boat 1
18 and 19 meet 2 times, e.g. day 6 on boat 2
18 and 20 meet 1 times, e.g. day 1 on boat 3
18 and 21 meet 1 times, e.g. day 2 on boat 2
18 and 22 meet 1 times, e.g. day 1 on boat 3
18 and 23 meet 1 times, e.g. day 5 on boat 2
18 and 24 meet 1 times, e.g. day 3 on boat 1
19 and 20 meet 1 times, e.g. day 4 on boat 1
19 and 21 meet 1 times, e.g. day 1 on boat 1
19 and 22 meet 1 times, e.g. day 4 on boat 1
19 and 23 meet 1 times, e.g. day 2 on boat 3
19 and 24 meet 1 times, e.g. day 3 on boat 1
20 and 21 meet 1 times, e.g. day 3 on boat 2
20 and 22 meet 2 times, e.g. day 4 on boat 1
20 and 23 meet 1 times, e.g. day 6 on boat 1
20 and 24 meet 1 times, e.g. day 2 on boat 1
21 and 22 meet 1 times, e.g. day 5 on boat 1
21 and 23 meet 1 times, e.g. day 4 on boat 4
21 and 24 meet 3 times, e.g. day 6 on boat 4
22 and 23 meet 1 times, e.g. day 3 on boat 3
22 and 24 meet 1 times, e.g. day 5 on boat 1
23 and 24 meet 1 times, e.g. day 4 on boat 4
|
New code with the penalties for meeting too often: (It's super ugly lol)
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | #include <bits/stdc++.h>
using namespace std;
// Random Number Generation {{{
mt19937 rng((int) chrono::steady_clock::now().time_since_epoch().count());
int randint(int l, int r) { return rng() % (r-l+1) + l; }
//}}}
signed main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
const int N = 24;
const int B = 4;
const int per_b = N/B;
const int D = 6;
vector A(D, vector<int>(N));
for (auto &d : A) {
iota(begin(d), end(d), 0LL);
shuffle(begin(d), end(d), rng);
}
int cur_score = 0;
int cur_same = 0;
vector meets(N, vector<int>(N));
auto cost = [&](int x) {
if (x <= 3) return 0;
return 1 << x;
};
auto total_score = [](int score, int same) {
return 4*score - same;
};
auto delta_meet = [&](int a, int b, int delta) {
cur_score += delta * !!meets[a][b];
cur_same += delta * cost(meets[a][b]);
};
for (auto const& d : A) {
for (int bi = 0; bi < B; bi++) {
for (int i = bi*per_b; i < (bi+1)*per_b; i++) {
for (int j = i+1; j < (bi+1)*per_b; j++) {
auto [a, b] = minmax(d[i], d[j]);
delta_meet(a, b, -1);
meets[a][b]++;
delta_meet(a, b, +1);
}
}
}
}
auto add_person = [&](int di, int bi, int pi, int delta) {
auto const& d = A[di];
int pi_idx = bi*per_b + pi;
for (int i = bi*per_b; i < (bi+1)*per_b; i++) {
if (i == pi_idx) continue;
auto [a, b] = minmax(d[pi_idx], d[i]);
delta_meet(a, b, -1);
meets[a][b] += delta;
delta_meet(a, b, +1);
}
};
// Needs bi != bj
auto swap_people = [&](int di, int bi, int bj, int pi, int pj) {
add_person(di, bi, pi, -1);
add_person(di, bj, pj, -1);
int pi_idx = bi*per_b + pi;
int pj_idx = bj*per_b + pj;
swap(A[di][pi_idx], A[di][pj_idx]);
add_person(di, bi, pi, +1);
add_person(di, bj, pj, +1);
};
auto score_brute = [&]() {
vector<vector<bool>> ok(N, vector<bool>(N));
for (auto &d : meets) fill(begin(d), end(d), 0);
for (auto const& d : A) {
for (int bi = 0; bi < B; bi++) {
for (int i = bi*per_b; i < (bi+1)*per_b; i++) {
for (int j = i+1; j < (bi+1)*per_b; j++) {
auto [a, b] = minmax(d[i], d[j]);
ok[a][b] = true;
meets[a][b]++;
}
}
}
}
int sum = 0;
for (auto const& oki : ok) {
sum += accumulate(begin(oki), end(oki), 0LL);
}
cur_score = 0;
cur_same = 0;
for (int i = 0; i < N; i++) {
for (int j = i+1; j < N; j++) {
cur_score += !!meets[i][j];
cur_same += cost(meets[i][j]);
}
}
return sum;
};
vector<vector<int>> solution;
int solution_score = 0;
int solution_same = 0;
for (int it = 0; it < 100'000'000; it++) {
int di = randint(0, D-1);
int bi = randint(0, B-2);
int bj = randint(bi+1, B-1);
int pi = randint(0, per_b-1);
int pj = randint(0, per_b-1);
int before = cur_score;
int before_same = cur_same;
swap_people(di, bi, bj, pi, pj);
/* if (pair{before, -before_same} > pair{cur_score, -cur_same}) { */
if (total_score(before, before_same) > total_score(cur_score, cur_same)) {
swap_people(di, bi, bj, pi, pj);
}
if (total_score(cur_score, cur_same) > total_score(solution_score, solution_same)) {
solution = A;
solution_score = cur_score;
solution_same = cur_same;
cout << "NewSolution " << solution_score << ' ' << solution_same << endl;
}
if (it % 100000 == 0) {
cout << "Checkpoint " << it << ' ' << cur_score << ' ' << cur_same << endl;
cout << "Solution " << it << ' ' << solution_score << ' ' << solution_same << endl;
A = solution;
shuffle(begin(A[di]), end(A[di]), rng);
score_brute();
cout << "AfterShuffle " << it << ' ' << cur_score << ' ' << cur_same << endl;
}
}
/* if (solution_score != N*(N-1)/2) { */
/* cout << "Solution Not Found :(" << endl; */
/* exit(0); */
/* } */
A = solution;
for (int di = 0; di < D; di++) {
cout << "Day " << di+1 << endl;
for (int bi = 0; bi < B; bi++) {
cout << "Boat " << bi+1 << ": ";
for (int i = per_b*bi; i < per_b*(bi+1); i++) {
cout << A[di][i]+1 << ' ';
if (A[di][i]+1 < 10) cout << ' ';
}
cout << endl;
}
cout << endl;
}
}
|