QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#150833#6339. CookiesJCY_100 ✓45ms200496kbC++172.5kb2023-08-26 13:50:232023-08-26 13:50:26

Judging History

你现在查看的是最新测评结果

  • [2023-08-26 13:50:26]
  • 评测
  • 测评结果:100
  • 用时:45ms
  • 内存:200496kb
  • [2023-08-26 13:50:23]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using i128 = __int128;
using u128 = unsigned __int128;
template <typename T>
void chkmax(T &x, const T &y) {
  if (x < y) x = y;
}
template <typename T>
void chkmin(T &x, const T &y) {
  if (y < x) x = y;
}
constexpr int MAXN = 15010;
int n, m, sum, a[MAXN], lim[MAXN];
bool can[MAXN];
vector<bitset<MAXN>> dp[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    sum += a[i];
    ++lim[1];
    --lim[a[i] + 1];
  }
  for (int i = 1; i <= sum; ++i) lim[i] += lim[i - 1];
  for (int i = 1; i <= sum; ++i) lim[i] += lim[i - 1];
  cin >> m;
  for (int i = 1, x; i <= m; ++i) {
    cin >> x;
    can[x] = true;
  }
  if (lim[1] == sum && can[sum]) {
    cout << "1\n" << n << " ";
    for (int i = 1; i <= n; ++i) cout << i << " \n"[i == n];
    return 0;
  }
  dp[1].resize(lim[1] + 1);
  for (int i = 1; i <= lim[1]; ++i)
    if (can[i]) dp[1][i][i] = 1;
  bitset<MAXN> now;
  for (int i = 1; i <= lim[1]; ++i) now[i] = 1;
  for (int i = 2; i <= sum; ++i) {
    for (int j = lim[i - 1] + 1; j <= lim[i]; ++j) now[j] = 1;
    bitset<MAXN> tmp;
    dp[i].resize(lim[i] / i + 1);
    for (int j = lim[i] / i, k = lim[i - 1] / (i - 1); j >= 1; --j) {
      if (!can[j]) continue;
      while (k >= j) tmp |= dp[i - 1][k--];
      dp[i][j] = tmp << j & now;
      if (dp[i][j][sum]) {
        cout << i << "\n";
        vector<int> vec;
        for (; i; --i) {
          while (!dp[i][j][sum]) ++j;
          vec.emplace_back(j);
          sum -= j;
        }
        vector<vector<int>> wys(vec.size());
        priority_queue<pair<int, int>> pq;
        for (int l = 0; l < (int)vec.size(); ++l) pq.emplace(vec[l], l);
        for (int l = 1; l <= n; ++l) {
          vector<pair<int, int>> temp;
          while (a[l]--) {
            int u = pq.top().second;
            temp.emplace_back(pq.top().first - 1, u);
            pq.pop();
            wys[u].emplace_back(l);
          }
          for (auto &s : temp) pq.emplace(s);
        }
        for (auto &l : wys) {
          cout << l.size() << " ";
          for (auto s : l) cout << s << " ";
          cout << "\n";
        }
        return 0;
      }
    }
  }
  cout << "-1\n";
  return 0;
}
// g++ cookies.cpp -o cookies -Wall -Wextra -Wshadow -O2 -std=c++14 -fsanitize=address,undefined
/*
2
1 1
1
1
*/

詳細信息

Subtask #1:

score: 6
Accepted

Test #1:

score: 6
Accepted
time: 1ms
memory: 3968kb

input:

1
1
1
1

output:

1
1 1

result:

ok good!

Test #2:

score: 0
Accepted
time: 1ms
memory: 4180kb

input:

2
1 1
1
1

output:

2
1 2 
1 1 

result:

ok good!

Test #3:

score: 0
Accepted
time: 1ms
memory: 3844kb

input:

2
1 1
1
2

output:

1
2 1 2

result:

ok good!

Test #4:

score: 0
Accepted
time: 1ms
memory: 4164kb

input:

2
1 1
2
1 2

output:

1
2 1 2

result:

ok good!

Test #5:

score: 0
Accepted
time: 1ms
memory: 4168kb

input:

4
1 1 1 1
2
2 3

output:

2
2 2 4 
2 1 3 

result:

ok good!

Test #6:

score: 0
Accepted
time: 1ms
memory: 3868kb

input:

8
1 1 1 1 1 1 1 1
3
1 4 5

output:

2
4 2 4 6 8 
4 1 3 5 7 

result:

ok good!

Test #7:

score: 0
Accepted
time: 0ms
memory: 10412kb

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

500
1 500 
1 499 
1 498 
1 497 
1 496 
1 495 
1 494 
1 493 
1 492 
1 491 
1 490 
1 489 
1 488 
1 487 
1 486 
1 485 
1 484 
1 483 
1 482 
1 481 
1 480 
1 479 
1 478 
1 477 
1 476 
1 475 
1 474 
1 473 
1 472 
1 471 
1 470 
1 469 
1 468 
1 467 
1 466 
1 465 
1 464 
1 463 
1 462 
1 461 
1 460 
1 459 
1 ...

result:

ok good!

Test #8:

score: 0
Accepted
time: 1ms
memory: 3848kb

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

1
500 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 10...

result:

ok good!

Test #9:

score: 0
Accepted
time: 1ms
memory: 4932kb

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

2
250 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 102 104 106 108 110 112 114 116 118 120 122 124 126 128 130 132 134 136 138 140 142 144 146 148 150 152 154 156 158 160 162 164 166 168 170 172 174...

result:

ok good!

Test #10:

score: 0
Accepted
time: 2ms
memory: 10520kb

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

-1

result:

ok no solution

Test #11:

score: 0
Accepted
time: 2ms
memory: 6316kb

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

11
45 16 27 38 49 60 71 82 93 104 115 126 137 148 159 170 181 192 203 214 225 236 247 258 269 280 291 302 313 324 335 346 357 368 379 390 401 412 423 434 445 456 467 478 489 500 
45 15 26 37 48 59 70 81 92 103 114 125 136 147 158 169 180 191 202 213 224 235 246 257 268 279 290 301 312 323 334 345 35...

result:

ok good!

Test #12:

score: 0
Accepted
time: 2ms
memory: 9488kb

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

250
2 250 500 
2 249 499 
2 248 498 
2 247 497 
2 246 496 
2 245 495 
2 244 494 
2 243 493 
2 242 492 
2 241 491 
2 240 490 
2 239 489 
2 238 488 
2 237 487 
2 236 486 
2 235 485 
2 234 484 
2 233 483 
2 232 482 
2 231 481 
2 230 480 
2 229 479 
2 228 478 
2 227 477 
2 226 476 
2 225 475 
2 224 474 ...

result:

ok good!

Test #13:

score: 0
Accepted
time: 1ms
memory: 6912kb

input:

484
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

22
22 22 44 66 88 110 132 154 176 198 220 242 264 286 308 330 352 374 396 418 440 462 484 
22 21 43 65 87 109 131 153 175 197 219 241 263 285 307 329 351 373 395 417 439 461 483 
22 20 42 64 86 108 130 152 174 196 218 240 262 284 306 328 350 372 394 416 438 460 482 
22 19 41 63 85 107 129 151 173 19...

result:

ok good!

Test #14:

score: 0
Accepted
time: 2ms
memory: 7820kb

input:

495
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

55
9 55 110 165 220 275 330 385 440 495 
9 54 109 164 219 274 329 384 439 494 
9 53 108 163 218 273 328 383 438 493 
9 52 107 162 217 272 327 382 437 492 
9 51 106 161 216 271 326 381 436 491 
9 50 105 160 215 270 325 380 435 490 
9 49 104 159 214 269 324 379 434 489 
9 48 103 158 213 268 323 378 43...

result:

ok good!

Test #15:

score: 0
Accepted
time: 2ms
memory: 5440kb

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

4
125 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 256 260 264 268 272 276 280 284 288 292 296 300 304 308 312 316 320 ...

result:

ok good!

Test #16:

score: 0
Accepted
time: 1ms
memory: 7164kb

input:

499
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

27
17 67 94 121 148 175 202 229 256 283 310 337 364 391 418 445 472 499 
17 66 93 120 147 174 201 228 255 282 309 336 363 390 417 444 471 498 
17 65 92 119 146 173 200 227 254 281 308 335 362 389 416 443 470 497 
17 64 91 118 145 172 199 226 253 280 307 334 361 388 415 442 469 496 
17 63 90 117 144 ...

result:

ok good!

Test #17:

score: 0
Accepted
time: 2ms
memory: 6808kb

input:

499
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

19
17 195 214 233 252 271 290 309 328 347 366 385 404 423 442 461 480 499 
23 86 104 122 140 158 176 194 213 232 251 270 289 308 327 346 365 384 403 422 441 460 479 498 
27 17 34 51 68 85 103 121 139 157 175 193 212 231 250 269 288 307 326 345 364 383 402 421 440 459 478 497 
27 16 33 50 67 84 102 1...

result:

ok good!

Test #18:

score: 0
Accepted
time: 2ms
memory: 5972kb

input:

499
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

7
64 58 65 72 79 86 93 100 107 114 121 128 135 142 149 156 163 170 177 184 191 198 205 212 219 226 233 240 247 254 261 268 275 282 289 296 303 310 317 324 331 338 345 352 359 366 373 380 387 394 401 408 415 422 429 436 443 450 457 464 471 478 485 492 499 
64 57 64 71 78 85 92 99 106 113 120 127 134 ...

result:

ok good!

Test #19:

score: 0
Accepted
time: 2ms
memory: 5444kb

input:

499
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

4
56 279 283 287 291 295 299 303 307 311 315 319 323 327 331 335 339 343 347 351 355 359 363 367 371 375 379 383 387 391 395 399 403 407 411 415 419 423 427 431 435 439 443 447 451 455 459 463 467 471 475 479 483 487 491 495 499 
56 278 282 286 290 294 298 302 306 310 314 318 322 326 330 334 338 342...

result:

ok good!

Test #20:

score: 0
Accepted
time: 0ms
memory: 4996kb

input:

499
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

2
213 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 171 173 175 177 179 181 183 185 187 189 191 193 195 197 199 201 203 205 207 209 211 213 215 217 219 221 223 225 227...

result:

ok good!

Test #21:

score: 0
Accepted
time: 3ms
memory: 10440kb

input:

499
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

-1

result:

ok no solution

Test #22:

score: 0
Accepted
time: 6ms
memory: 10440kb

input:

499
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

-1

result:

ok no solution

Test #23:

score: 0
Accepted
time: 2ms
memory: 6796kb

input:

493
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

17
18 204 221 238 255 272 289 306 323 340 357 374 391 408 425 442 459 476 493 
18 203 220 237 254 271 288 305 322 339 356 373 390 407 424 441 458 475 492 
18 202 219 236 253 270 287 304 321 338 355 372 389 406 423 440 457 474 491 
18 201 218 235 252 269 286 303 320 337 354 371 388 405 422 439 456 47...

result:

ok good!

Test #24:

score: 0
Accepted
time: 2ms
memory: 6860kb

input:

493
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

17
18 204 221 238 255 272 289 306 323 340 357 374 391 408 425 442 459 476 493 
18 203 220 237 254 271 288 305 322 339 356 373 390 407 424 441 458 475 492 
18 202 219 236 253 270 287 304 321 338 355 372 389 406 423 440 457 474 491 
18 201 218 235 252 269 286 303 320 337 354 371 388 405 422 439 456 47...

result:

ok good!

Test #25:

score: 0
Accepted
time: 2ms
memory: 6884kb

input:

493
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

17
16 238 255 272 289 306 323 340 357 374 391 408 425 442 459 476 493 
16 237 254 271 288 305 322 339 356 373 390 407 424 441 458 475 492 
16 236 253 270 287 304 321 338 355 372 389 406 423 440 457 474 491 
16 235 252 269 286 303 320 337 354 371 388 405 422 439 456 473 490 
16 234 251 268 285 302 31...

result:

ok good!

Test #26:

score: 0
Accepted
time: 2ms
memory: 6768kb

input:

493
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

17
16 238 255 272 289 306 323 340 357 374 391 408 425 442 459 476 493 
16 237 254 271 288 305 322 339 356 373 390 407 424 441 458 475 492 
16 236 253 270 287 304 321 338 355 372 389 406 423 440 457 474 491 
16 235 252 269 286 303 320 337 354 371 388 405 422 439 456 473 490 
16 234 251 268 285 302 31...

result:

ok good!

Test #27:

score: 0
Accepted
time: 2ms
memory: 6764kb

input:

493
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

17
16 238 255 272 289 306 323 340 357 374 391 408 425 442 459 476 493 
16 237 254 271 288 305 322 339 356 373 390 407 424 441 458 475 492 
16 236 253 270 287 304 321 338 355 372 389 406 423 440 457 474 491 
16 235 252 269 286 303 320 337 354 371 388 405 422 439 456 473 490 
16 234 251 268 285 302 31...

result:

ok good!

Subtask #2:

score: 7
Accepted

Test #28:

score: 7
Accepted
time: 0ms
memory: 4004kb

input:

1
15
1
1

output:

15
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 

result:

ok good!

Test #29:

score: 0
Accepted
time: 2ms
memory: 5876kb

input:

1
500
1
1

output:

500
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1...

result:

ok good!

Test #30:

score: 0
Accepted
time: 1ms
memory: 15476kb

input:

1
3000
1
1

output:

3000
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
...

result:

ok good!

Test #31:

score: 0
Accepted
time: 9ms
memory: 60080kb

input:

1
15000
1
1

output:

15000
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 ...

result:

ok good!

Test #32:

score: 0
Accepted
time: 1ms
memory: 3968kb

input:

2
2 1
1
1

output:

3
1 2 
1 1 
1 1 

result:

ok good!

Test #33:

score: 0
Accepted
time: 1ms
memory: 4128kb

input:

2
1 2
1
2

output:

-1

result:

ok no solution

Test #34:

score: 0
Accepted
time: 1ms
memory: 3920kb

input:

3
1 2 3
1
2

output:

3
2 2 3 
2 2 3 
2 1 3 

result:

ok good!

Test #35:

score: 0
Accepted
time: 0ms
memory: 3912kb

input:

3
3 2 1
1
3

output:

-1

result:

ok no solution

Test #36:

score: 0
Accepted
time: 0ms
memory: 3900kb

input:

3
2 2 2
1
2

output:

3
2 2 3 
2 1 3 
2 1 2 

result:

ok good!

Test #37:

score: 0
Accepted
time: 1ms
memory: 5004kb

input:

15
50 49 48 47 46 45 44 43 42 41 40 2 1 1 1
1
10

output:

50
10 1 3 4 5 6 7 8 9 10 15 
10 1 2 4 5 6 7 8 9 10 14 
10 1 2 4 5 6 7 8 9 10 13 
10 1 2 3 5 6 7 8 9 10 12 
10 1 2 3 5 6 7 8 9 10 12 
10 1 2 3 5 6 7 8 9 10 11 
10 1 2 3 4 6 7 8 9 10 11 
10 1 2 3 4 6 7 8 9 10 11 
10 1 2 3 4 6 7 8 9 10 11 
10 1 2 3 4 6 7 8 9 10 11 
10 1 2 3 4 5 7 8 9 10 11 
10 1 2 3 4 ...

result:

ok good!

Test #38:

score: 0
Accepted
time: 6ms
memory: 7428kb

input:

15
51 49 48 47 46 45 44 43 42 41 40 1 1 1 1
1
10

output:

-1

result:

ok no solution

Test #39:

score: 0
Accepted
time: 4ms
memory: 50600kb

input:

10
430 3078 390 349 3750 906 377 3374 1795 551
1
4

output:

3750
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8 10 
4 3 5 8...

result:

ok good!

Test #40:

score: 0
Accepted
time: 27ms
memory: 164940kb

input:

500
4 99 56 16 7 39 5 8 3 18 15 30 19 27 46 47 24 55 1 7 21 1 13 5 53 32 12 98 12 121 3 118 25 15 8 32 29 7 13 3 29 94 22 4 12 37 15 52 14 9 59 22 3 16 9 77 5 17 41 22 16 6 3 32 33 34 18 1 28 4 72 4 3 40 21 13 22 16 42 77 2 16 1 1 10 11 3 34 21 28 4 173 24 57 17 9 20 116 21 72 17 165 28 30 6 13 86 1...

output:

5000
3 177 328 500 
3 177 327 500 
3 177 327 500 
3 177 327 500 
3 177 327 500 
3 177 327 500 
3 177 327 500 
3 177 327 500 
3 177 327 500 
3 177 326 500 
3 177 326 500 
3 177 326 500 
3 177 325 500 
3 177 325 500 
3 177 325 500 
3 177 325 500 
3 177 324 500 
3 177 324 500 
3 177 324 500 
3 177 324 ...

result:

ok good!

Test #41:

score: 0
Accepted
time: 10ms
memory: 73132kb

input:

500
30 23 12 48 4 11 119 12 15 24 33 9 22 46 42 7 18 49 9 1 43 3 4 43 31 11 4 7 33 30 13 5 36 3 20 2 40 37 7 1 8 43 34 12 2 37 99 38 59 36 24 18 68 23 9 24 33 1 13 10 12 2 7 7 1 5 73 7 7 32 2 13 7 49 41 20 160 69 11 61 25 35 15 22 32 66 47 45 34 14 12 7 9 43 4 42 2 24 29 16 11 6 5 5 8 11 42 3 48 20 ...

output:

200
75 7 14 24 34 44 49 54 67 77 78 85 89 100 112 116 121 127 131 144 154 163 169 178 187 196 198 206 212 220 226 233 238 246 254 261 265 271 277 284 292 297 302 306 316 319 328 335 338 346 355 364 368 376 383 388 391 398 402 409 416 424 431 435 442 446 448 456 462 468 474 484 489 493 496 500 
75 7 ...

result:

ok good!

Test #42:

score: 0
Accepted
time: 5ms
memory: 44660kb

input:

500
6 60 24 11 17 58 8 42 30 60 38 34 54 23 5 12 32 6 35 11 60 42 35 60 25 60 37 40 5 22 24 26 17 17 60 21 7 29 13 7 56 12 8 16 8 20 11 60 12 60 32 56 30 55 12 23 26 60 60 6 18 60 60 21 21 16 28 23 60 9 16 4 8 5 20 4 60 59 39 20 8 27 8 7 6 8 10 30 18 15 60 60 41 48 17 24 17 60 10 42 6 13 22 21 14 18...

output:

60
250 2 6 7 9 10 12 13 16 19 21 22 24 25 26 28 31 34 35 38 41 44 48 50 51 52 54 55 58 59 61 62 63 66 68 69 75 77 78 80 85 89 91 92 93 95 98 99 102 106 108 109 112 113 116 117 124 125 128 129 130 131 133 137 138 139 142 144 145 146 147 151 153 156 158 159 161 162 163 166 168 170 172 174 177 178 180 ...

result:

ok good!

Test #43:

score: 0
Accepted
time: 2ms
memory: 31544kb

input:

122
121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 ...

output:

122
121 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 10...

result:

ok good!

Test #44:

score: 0
Accepted
time: 2ms
memory: 6000kb

input:

498
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

3
332 2 3 5 6 8 9 11 12 14 15 17 18 20 21 23 24 26 27 29 30 32 33 35 36 38 39 41 42 44 45 47 48 50 51 53 54 56 57 59 60 62 63 65 66 68 69 71 72 74 75 77 78 80 81 83 84 86 87 89 90 92 93 95 96 98 99 101 102 104 105 107 108 110 111 113 114 116 117 119 120 122 123 125 126 128 129 131 132 134 135 137 13...

result:

ok good!

Subtask #3:

score: 12
Accepted

Test #45:

score: 12
Accepted
time: 1ms
memory: 4008kb

input:

2
7 8
2
1 2

output:

8
1 2 
2 1 2 
2 1 2 
2 1 2 
2 1 2 
2 1 2 
2 1 2 
2 1 2 

result:

ok good!

Test #46:

score: 0
Accepted
time: 1ms
memory: 4164kb

input:

3
5 4 6
2
2 3

output:

6
2 2 3 
2 1 3 
2 1 3 
3 1 2 3 
3 1 2 3 
3 1 2 3 

result:

ok good!

Test #47:

score: 0
Accepted
time: 1ms
memory: 4016kb

input:

3
4 2 9
3
1 2 3

output:

9
1 3 
1 3 
1 3 
1 3 
1 3 
2 1 3 
2 1 3 
3 1 2 3 
3 1 2 3 

result:

ok good!

Test #48:

score: 0
Accepted
time: 1ms
memory: 3992kb

input:

4
3 5 4 3
2
3 4

output:

5
3 2 3 4 
3 2 3 4 
3 1 2 4 
3 1 2 3 
3 1 2 3 

result:

ok good!

Test #49:

score: 0
Accepted
time: 1ms
memory: 4160kb

input:

4
1 4 5 5
3
1 3 4

output:

5
3 2 3 4 
3 2 3 4 
3 2 3 4 
3 2 3 4 
3 1 3 4 

result:

ok good!

Test #50:

score: 0
Accepted
time: 1ms
memory: 4204kb

input:

4
3 3 6 3
3
2 3 4

output:

6
2 3 4 
2 3 4 
2 2 3 
2 1 3 
3 1 2 3 
4 1 2 3 4 

result:

ok good!

Test #51:

score: 0
Accepted
time: 1ms
memory: 3920kb

input:

5
4 3 3 3 1
3
2 4 5

output:

4
2 1 5 
4 1 2 3 4 
4 1 2 3 4 
4 1 2 3 4 

result:

ok good!

Test #52:

score: 0
Accepted
time: 1ms
memory: 3980kb

input:

5
4 3 3 3 2
3
3 4 5

output:

4
3 1 3 5 
3 1 2 4 
4 1 2 3 4 
5 1 2 3 4 5 

result:

ok good!

Test #53:

score: 0
Accepted
time: 0ms
memory: 4004kb

input:

5
4 4 4 2 1
3
2 4 5

output:

5
2 2 3 
2 1 3 
2 1 2 
4 1 2 3 4 
5 1 2 3 4 5 

result:

ok good!

Test #54:

score: 0
Accepted
time: 1ms
memory: 4008kb

input:

5
3 3 3 3 3
3
1 2 4

output:

5
1 5 
2 4 5 
4 1 2 3 5 
4 1 2 3 4 
4 1 2 3 4 

result:

ok good!

Test #55:

score: 0
Accepted
time: 1ms
memory: 4044kb

input:

6
3 3 3 2 2 2
3
2 4 6

output:

-1

result:

ok no solution

Test #56:

score: 0
Accepted
time: 0ms
memory: 4124kb

input:

6
3 3 3 2 2 2
3
2 5 6

output:

3
5 1 2 3 5 6 
5 1 2 3 4 6 
5 1 2 3 4 5 

result:

ok good!

Test #57:

score: 0
Accepted
time: 1ms
memory: 4008kb

input:

6
4 4 3 2 1 1
3
1 3 5

output:

5
3 2 3 6 
3 1 3 5 
3 1 2 4 
3 1 2 4 
3 1 2 3 

result:

ok good!

Test #58:

score: 0
Accepted
time: 1ms
memory: 4024kb

input:

6
7 2 2 2 1 1
5
2 3 4 5 6

output:

7
2 1 6 
2 1 5 
2 1 4 
2 1 4 
2 1 3 
2 1 2 
3 1 2 3 

result:

ok good!

Test #59:

score: 0
Accepted
time: 1ms
memory: 4152kb

input:

7
3 3 3 2 2 1 1
3
1 4 6

output:

4
1 7 
4 1 2 3 5 
4 1 2 3 4 
6 1 2 3 4 5 6 

result:

ok good!

Test #60:

score: 0
Accepted
time: 0ms
memory: 4008kb

input:

7
4 4 3 1 1 1 1
3
1 4 6

output:

6
1 7 
1 2 
1 1 
4 1 2 3 6 
4 1 2 3 5 
4 1 2 3 4 

result:

ok good!

Test #61:

score: 0
Accepted
time: 1ms
memory: 3944kb

input:

8
2 2 2 2 2 2 2 1
6
1 2 3 4 6 7

output:

3
4 2 4 6 8 
4 1 3 5 7 
7 1 2 3 4 5 6 7 

result:

ok good!

Test #62:

score: 0
Accepted
time: 1ms
memory: 4212kb

input:

8
3 3 3 2 1 1 1 1
4
4 6 7 8

output:

3
4 1 2 3 8 
4 1 2 3 4 
7 1 2 3 4 5 6 7 

result:

ok good!

Test #63:

score: 0
Accepted
time: 1ms
memory: 3944kb

input:

8
4 3 3 1 1 1 1 1
4
1 6 7 8

output:

8
1 3 
1 3 
1 2 
1 2 
1 1 
1 1 
1 1 
8 1 2 3 4 5 6 7 8 

result:

ok good!

Test #64:

score: 0
Accepted
time: 1ms
memory: 4004kb

input:

9
4 3 2 1 1 1 1 1 1
4
3 4 5 7

output:

4
3 1 5 9 
3 1 2 8 
4 1 2 3 7 
5 1 2 3 4 6 

result:

ok good!

Test #65:

score: 0
Accepted
time: 1ms
memory: 4112kb

input:

12
3 2 1 1 1 1 1 1 1 1 1 1
9
1 4 5 6 7 8 9 10 11

output:

3
5 1 3 6 9 12 
5 1 2 5 8 11 
5 1 2 4 7 10 

result:

ok good!

Test #66:

score: 0
Accepted
time: 1ms
memory: 4000kb

input:

14
2 1 1 1 1 1 1 1 1 1 1 1 1 1
14
1 2 3 4 5 6 7 8 9 10 11 12 13 14

output:

2
7 1 4 6 8 10 12 14 
8 1 2 3 5 7 9 11 13 

result:

ok good!

Test #67:

score: 0
Accepted
time: 1ms
memory: 3988kb

input:

4
2 2 2 1
2
1 4

output:

4
1 3 
1 2 
1 1 
4 1 2 3 4 

result:

ok good!

Subtask #4:

score: 45
Accepted

Dependency #1:

100%
Accepted

Dependency #3:

100%
Accepted

Test #68:

score: 45
Accepted
time: 0ms
memory: 6008kb

input:

150
24 12 11 10 9 9 9 9 9 8 8 7 7 7 7 7 6 6 6 6 6 6 6 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

25
18 2 4 7 10 14 18 23 28 34 42 50 62 70 81 93 106 125 150 
18 1 4 7 10 13 18 22 28 34 41 49 61 70 80 93 105 124 149 
18 1 4 7 10 13 17 22 28 34 41 49 61 70 80 92 105 123 148 
18 1 4 6 9 13 17 22 28 34 41 49 60 69 79 92 104 122 147 
18 1 3 6 9 13 17 22 27 33 40 48 60 69 79 91 104 121 146 
18 1 3 6 ...

result:

ok good!

Test #69:

score: 0
Accepted
time: 2ms
memory: 5488kb

input:

200
9 9 9 8 8 8 7 7 6 6 6 6 6 6 6 6 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

10
1 200 
9 1 2 3 5 6 8 11 15 199 
9 1 2 3 4 6 7 10 14 198 
9 1 2 3 4 5 7 9 13 197 
9 1 2 3 4 5 6 8 12 16 
78 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 28 30 32 34 36 38 40 42 44 55 58 61 64 67 70 71 74 76 79 81 84 86 89 91 94 96 99 101 104 106 109 111 114 116 119 121 124 ...

result:

ok good!

Test #70:

score: 0
Accepted
time: 2ms
memory: 5472kb

input:

250
8 7 7 7 7 6 6 6 6 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

9
1 250 
1 1 
33 1 2 3 4 5 7 8 9 11 12 14 16 17 20 22 25 27 30 32 36 41 46 51 56 105 111 117 123 221 228 235 242 249 
33 1 2 3 4 5 6 8 9 10 12 14 15 17 19 22 24 27 29 32 35 40 45 50 55 60 110 116 122 220 227 234 241 248 
33 1 2 3 4 5 6 7 9 10 12 13 15 17 19 21 24 26 29 31 34 39 44 49 54 59 109 115 1...

result:

ok good!

Test #71:

score: 0
Accepted
time: 2ms
memory: 5876kb

input:

300
8 6 6 5 5 5 5 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

9
22 3 6 11 17 86 94 102 110 118 192 201 210 219 228 237 246 255 264 273 282 291 300 
23 1 3 6 10 16 85 93 101 109 117 125 200 209 218 227 236 245 254 263 272 281 290 299 
23 1 3 5 9 15 84 92 100 108 116 124 199 208 217 226 235 244 253 262 271 280 289 298 
23 1 2 5 8 14 83 91 99 107 115 123 198 207 ...

result:

ok good!

Test #72:

score: 0
Accepted
time: 1ms
memory: 5476kb

input:

300
5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

6
6 2 4 6 288 294 300 
6 1 3 5 7 293 299 
63 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 19 21 23 25 27 29 31 33 35 37 39 41 128 131 134 175 179 183 187 191 195 199 203 207 211 215 219 223 227 231 235 239 243 247 251 255 259 263 267 271 275 279 283 287 292 298 
63 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1...

result:

ok good!

Test #73:

score: 0
Accepted
time: 0ms
memory: 5660kb

input:

350
5 5 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

6
2 2 350 
2 1 349 
53 1 2 3 4 5 6 7 8 9 10 11 13 15 17 19 21 23 25 27 216 220 224 228 232 236 240 244 248 252 256 260 264 268 272 276 280 284 288 292 296 300 304 308 312 316 320 324 328 332 336 340 344 348 
53 1 2 3 4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 26 215 219 223 227 231 235 239 243 247 251 2...

result:

ok good!

Test #74:

score: 0
Accepted
time: 2ms
memory: 6216kb

input:

70
51 39 26 24 21 18 16 15 15 12 11 10 10 9 9 9 8 8 7 7 7 7 7 7 6 6 6 6 6 6 6 5 5 5 5 5 5 5 4 4 4 4 4 4 3 3 3 3 3 3 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1
14
1 14 15 17 26 27 34 35 41 44 48 58 62 65

output:

56
1 2 
1 2 
1 2 
1 2 
1 2 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
14 1 2 4 5 7 10 13 17 21 26 32 39 48 70 
14 1 2 4 5 7 10 13 16 21 26 32 39 48 69 
14 1 2 4 5 7 10 13 16 21 26 32 38 48 68 
14 1 2 4 5 7 9 13 16 21 26 31 38 47 67 
14 1 2 4 5 7 9 12 16 21 ...

result:

ok good!

Test #75:

score: 0
Accepted
time: 2ms
memory: 5516kb

input:

70
22 22 20 19 18 15 14 13 13 13 12 12 12 12 12 12 11 11 10 9 9 9 9 9 9 9 8 8 8 8 8 7 6 6 6 6 6 5 5 5 5 5 5 5 4 4 3 3 3 3 3 3 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
9
1 3 7 9 16 17 62 68 69

output:

24
16 2 4 5 7 9 11 13 15 17 20 23 26 30 34 40 52 
16 2 4 5 7 8 10 13 15 17 20 23 26 30 34 40 51 
16 1 4 5 6 8 10 13 15 17 20 23 26 29 34 40 50 
16 1 4 5 6 8 10 12 15 17 19 23 26 29 33 39 49 
17 1 2 3 5 6 8 10 12 15 17 19 22 26 29 33 39 48 
17 1 2 3 5 6 8 10 12 14 17 19 22 25 29 33 39 47 
17 1 2 3 5 ...

result:

ok good!

Test #76:

score: 0
Accepted
time: 2ms
memory: 6368kb

input:

40
61 55 33 31 28 26 26 23 21 20 18 15 13 11 11 10 9 9 8 8 7 7 7 6 4 4 4 4 3 3 2 2 2 2 2 1 1 1 1 1
9
1 12 18 20 24 29 30 32 40

output:

79
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
12 1 2 4 5 6 8 10 12 15 19 24 40 
12 1 2 4 5 6 8 9 12 15 19 24 39 
12 1 2 4 5 6 8 9 11 ...

result:

ok good!

Test #77:

score: 0
Accepted
time: 1ms
memory: 6096kb

input:

127
64 32 32 16 16 16 16 8 8 8 8 8 8 8 8 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
7
1 2 4 8 16 32 64

output:

64
4 1 4 11 127 
4 1 4 11 126 
4 1 4 11 125 
4 1 4 11 124 
4 1 3 10 123 
4 1 3 10 122 
4 1 3 10 121 
4 1 3 10 120 
4 1 3 9 119 
4 1 3 9 118 
4 1 3 9 117 
4 1 3 9 116 
4 1 3 8 115 
4 1 3 8 114 
4 1 3 8 113 
4 1 3 8 112 
4 1 3 7 111 
4 1 3 7 110 
4 1 3 7 109 
4 1 3 7 108 
4 1 3 7 107 
4 1 3 7 106 
4 1...

result:

ok good!

Test #78:

score: 0
Accepted
time: 2ms
memory: 5588kb

input:

10
31 67 31 15 21 37 53 96 81 68
4
1 2 8 10

output:

115
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
2 8 9 
...

result:

ok good!

Test #79:

score: 0
Accepted
time: 2ms
memory: 5356kb

input:

40
24 20 23 12 7 11 20 16 1 4 2 21 12 13 7 17 5 15 4 24 17 8 13 8 15 9 16 21 12 7 3 16 6 5 21 8 11 12 11 23
5
8 12 13 27 29

output:

24
13 1 3 7 12 18 20 27 30 33 35 37 39 40 
13 1 3 7 12 18 20 27 28 32 35 37 39 40 
13 1 3 7 12 16 20 25 28 32 35 37 39 40 
13 1 3 7 12 16 20 25 28 32 35 37 39 40 
13 1 2 7 12 16 20 25 28 32 35 37 39 40 
13 1 2 3 8 16 20 23 28 32 35 37 39 40 
13 1 2 3 8 16 20 21 28 32 35 37 39 40 
13 1 2 3 8 14 20 21...

result:

ok good!

Test #80:

score: 0
Accepted
time: 2ms
memory: 5376kb

input:

40
2 18 20 17 18 15 12 4 6 12 13 20 2 15 22 20 21 8 8 1 3 9 22 16 5 8 12 11 8 16 4 19 14 13 13 16 24 21 1 11
14
1 4 5 8 10 13 14 21 23 24 32 33 34 36

output:

24
14 3 5 6 12 14 16 17 23 27 32 34 36 37 40 
14 3 4 6 12 14 16 17 23 27 32 34 36 37 40 
14 3 4 6 12 14 15 17 23 24 32 33 36 37 40 
14 3 4 6 11 14 15 17 23 24 30 33 36 37 38 
14 3 4 6 11 14 15 17 23 24 30 33 36 37 38 
14 3 4 6 11 14 15 17 23 24 30 33 36 37 38 
14 2 4 6 11 14 15 16 23 24 30 33 36 37 ...

result:

ok good!

Test #81:

score: 0
Accepted
time: 2ms
memory: 5044kb

input:

130
5 1 7 5 7 6 4 2 4 2 7 1 5 1 1 7 4 3 3 4 3 5 1 5 5 2 1 6 5 2 7 2 1 2 3 1 1 6 1 5 3 2 1 5 7 6 5 2 5 3 5 4 2 3 1 3 2 4 6 6 1 3 4 7 6 2 7 1 7 7 5 7 2 3 1 2 2 4 4 1 3 4 7 3 7 3 6 1 1 3 3 6 5 7 4 1 4 5 3 3 5 4 4 6 1 3 2 6 4 7 3 4 2 6 1 2 7 7 7 6 5 6 7 5 2 2 2 2 7 2
7
26 43 55 69 82 116 125

output:

7
55 3 4 5 7 11 16 17 24 28 29 31 40 45 46 47 51 59 60 64 65 67 69 70 72 73 78 81 83 85 86 87 92 93 94 97 98 101 102 104 106 108 110 111 113 114 117 118 119 120 121 123 124 126 129 130 
55 3 4 5 6 11 13 16 22 25 29 31 38 44 45 47 51 59 60 64 65 67 69 70 71 72 78 81 83 84 85 87 92 93 94 97 98 100 102...

result:

ok good!

Test #82:

score: 0
Accepted
time: 0ms
memory: 5012kb

input:

130
5 4 7 2 1 6 4 3 4 4 4 3 7 4 5 1 2 1 6 1 7 4 6 4 2 4 2 7 1 3 1 7 1 3 1 2 6 4 7 3 6 5 3 2 6 3 1 7 2 1 1 6 7 6 1 3 4 5 7 1 3 1 5 7 6 3 4 6 1 5 1 5 5 6 3 1 7 6 7 2 5 6 4 7 3 7 4 2 5 2 6 4 1 2 4 1 7 4 4 6 2 5 5 3 4 6 1 2 3 2 2 3 6 1 7 4 1 2 5 4 3 5 5 3 5 2 2 3 5 5
45
1 4 5 6 15 18 20 23 28 31 32 33 3...

output:

7
66 2 3 7 10 13 14 19 21 22 24 27 28 32 37 38 39 41 42 45 48 50 52 53 55 57 59 61 63 64 65 67 69 72 73 74 77 78 79 81 82 83 84 86 87 89 91 94 97 98 99 101 103 104 106 109 112 113 115 117 119 121 123 125 127 129 130 
66 2 3 6 9 12 13 15 21 22 23 26 28 32 36 38 39 41 42 45 48 49 52 53 54 57 59 60 63 ...

result:

ok good!

Test #83:

score: 0
Accepted
time: 2ms
memory: 6336kb

input:

130
2 6 1 6 1 4 5 4 3 4 4 7 6 3 6 1 2 7 4 5 1 5 4 2 6 3 6 3 1 1 2 7 2 5 6 1 5 1 6 3 7 4 4 6 6 1 7 1 1 3 2 7 3 6 1 7 2 5 5 1 5 1 1 4 6 2 4 5 1 2 6 2 1 6 4 2 6 4 5 6 5 4 1 5 6 6 1 2 1 6 2 1 6 1 2 6 4 3 1 4 6 3 7 7 7 3 3 5 1 6 2 7 6 6 6 2 4 3 3 7 4 6 3 7 3 2 3 4 1 3
9
2 3 4 6 8 9 10 16 17

output:

30
16 13 20 28 37 44 52 60 70 78 85 94 103 108 115 122 130 
16 13 20 28 37 44 52 59 69 78 85 93 102 108 114 122 130 
16 13 20 27 37 44 52 59 68 77 84 93 102 108 114 121 130 
16 12 20 27 37 44 52 59 68 77 84 93 102 108 114 121 129 
16 12 19 27 36 43 52 59 68 77 84 93 101 107 114 121 128 
16 12 19 27 ...

result:

ok good!

Test #84:

score: 0
Accepted
time: 2ms
memory: 4848kb

input:

70
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 7 6 6 6 6 6 6 6 6 6 5 5 5 5 5 5 5 5 5 5 5 5
20
1 2 3 4 6 7 8 9 10 13 21 24 30 31 33 40 45 46 54 70

output:

9
45 2 4 5 6 8 9 10 12 13 14 16 17 18 20 21 22 24 25 26 28 29 30 32 33 34 36 37 38 39 40 42 43 44 46 47 49 50 52 54 56 58 61 64 67 70 
45 1 3 5 6 7 9 10 11 13 14 15 17 18 19 21 22 23 25 26 27 29 30 31 33 34 35 37 38 39 40 41 43 44 45 47 48 50 52 54 56 58 61 64 67 70 
46 1 2 3 4 6 7 8 10 11 12 14 15 ...

result:

ok good!

Test #85:

score: 0
Accepted
time: 1ms
memory: 4768kb

input:

90
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 6 6 6 6 6 6 6 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2
20
1 2 3 6 7 8 9 10 13 20 24 30 32 46 53 63 68 69 70 79

output:

8
53 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 35 36 37 39 41 43 46 50 60 62 64 67 70 74 76 79 82 84 87 90 
53 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 36 37 39 41 43 45 49 59 62 64 66 70 73 76 79 81 ...

result:

ok good!

Test #86:

score: 0
Accepted
time: 1ms
memory: 4960kb

input:

120
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 6 6 6 6 6 6 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1
20
1 2 3 4 5 9 10 14 15 19 25 28 30 33 36 77 78 99 108 116

output:

9
36 2 3 4 5 6 8 9 10 11 12 14 15 16 17 18 20 21 22 23 24 26 27 28 30 31 33 35 37 40 43 47 53 100 107 112 120 
36 1 3 4 5 6 7 9 10 11 12 13 15 16 17 18 19 21 22 23 24 25 27 28 29 31 33 35 37 39 42 46 52 99 107 111 119 
36 1 2 4 5 6 7 8 10 11 12 13 14 16 17 18 19 20 22 23 24 25 26 28 29 31 32 34 36 3...

result:

ok good!

Test #87:

score: 0
Accepted
time: 2ms
memory: 4932kb

input:

200
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 ...

output:

5
13 140 145 150 155 160 165 170 175 180 185 190 195 200 
118 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 76 77 78 80 81 82 84 85 86 88 89 90 92 9...

result:

ok good!

Test #88:

score: 0
Accepted
time: 2ms
memory: 4916kb

input:

250
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

4
59 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 246 250 
147 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 ...

result:

ok good!

Test #89:

score: 0
Accepted
time: 2ms
memory: 5212kb

input:

300
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

5
33 6 8 10 12 14 16 18 20 22 23 25 26 28 29 31 32 34 35 37 38 40 41 43 44 46 48 51 54 57 60 290 295 300 
37 1 2 3 4 5 7 9 11 13 15 17 19 21 23 24 26 27 29 30 32 33 35 36 38 39 41 42 44 45 47 50 53 56 59 289 294 299 
45 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 25 27 28 30 31 33 34...

result:

ok good!

Test #90:

score: 0
Accepted
time: 2ms
memory: 5292kb

input:

100
9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
49
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 76 77 78 79 80 81 82 83 84 85 ...

output:

18
24 3 5 7 9 11 13 15 17 20 22 24 26 28 30 32 34 37 39 41 43 45 47 49 100 
24 2 5 7 9 11 13 15 17 19 22 24 26 28 30 32 34 36 39 41 43 45 47 49 99 
24 2 4 7 9 11 13 15 17 19 21 24 26 28 30 32 34 36 38 41 43 45 47 49 98 
24 2 4 6 9 11 13 15 17 19 21 23 26 28 30 32 34 36 38 40 43 45 47 49 97 
24 2 4 6...

result:

ok good!

Test #91:

score: 0
Accepted
time: 0ms
memory: 7724kb

input:

446
55 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

55
9 1 61 116 171 226 281 336 391 446 
9 1 60 115 170 225 280 335 390 445 
9 1 59 114 169 224 279 334 389 444 
9 1 58 113 168 223 278 333 388 443 
9 1 57 112 167 222 277 332 387 442 
9 1 56 111 166 221 276 331 386 441 
9 1 55 110 165 220 275 330 385 440 
9 1 54 109 164 219 274 329 384 439 
9 1 53 10...

result:

ok good!

Test #92:

score: 0
Accepted
time: 0ms
memory: 7228kb

input:

470
31 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

31
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
470 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...

result:

ok good!

Test #93:

score: 0
Accepted
time: 2ms
memory: 5620kb

input:

31
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
15
1 2 3 4 5 6 7 24 25 26 27 28 29 30 31

output:

35
6 3 4 6 8 11 16 
6 3 4 6 8 10 15 
6 3 4 6 8 10 15 
6 3 4 6 8 10 14 
7 1 3 4 6 8 10 14 
7 1 2 4 6 7 10 14 
7 1 2 4 5 7 10 13 
7 1 2 4 5 7 10 13 
7 1 2 4 5 7 9 13 
7 1 2 4 5 7 9 13 
7 1 2 4 5 7 9 12 
7 1 2 3 5 7 9 12 
7 1 2 3 5 7 9 12 
7 1 2 3 5 7 9 12 
7 1 2 3 5 7 9 12 
7 1 2 3 5 6 9 11 
7 1 2 3 5...

result:

ok good!

Test #94:

score: 0
Accepted
time: 2ms
memory: 5308kb

input:

100
1 14 14 8 2 2 5 16 7 1 4 7 7 2 7 2 1 1 4 5 2 14 9 3 7 1 11 4 7 4 2 8 17 1 7 1 7 2 11 3 3 2 1 7 1 9 1 7 3 3 4 2 1 10 1 1 1 3 8 7 1 1 1 2 4 1 3 16 5 9 3 3 1 3 2 3 7 11 1 3 1 11 13 4 1 3 1 17 1 2 1 16 11 4 9 5 6 4 1 2
7
1 2 4 8 16 32 64

output:

18
1 100 
2 33 88 
8 3 8 33 68 88 92 93 100 
8 3 8 33 68 83 88 92 97 
8 2 8 22 33 68 88 92 95 
8 2 8 22 33 68 88 92 95 
16 2 3 8 22 27 33 39 54 68 70 78 82 83 88 92 95 
16 2 3 8 22 27 33 39 46 68 70 78 82 83 88 92 95 
16 2 3 8 22 23 32 33 46 59 68 78 82 83 88 92 93 
16 2 3 8 22 23 27 33 39 54 68 78 ...

result:

ok good!

Test #95:

score: 0
Accepted
time: 2ms
memory: 5564kb

input:

350
3 1 1 2 1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 3 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 2 1 1 2 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 2 2 1 1 1 1 1 1 3 1 1 1 1 2 1 1 1 1 2 2 1 1 1 2 2 1 2 1 1 1 2 2 1 1 5 1 1 2 1 3 1 1 1 1 1 1 2 1 3 1 1 1 2 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 3 2 1 1 3 1 ...

output:

7
1 350 
2 206 308 
16 103 206 247 308 318 321 322 326 328 332 334 337 342 344 347 350 
32 103 206 233 247 276 279 281 283 285 288 291 293 296 298 300 303 305 308 310 313 317 320 322 325 327 331 333 336 341 344 346 349 
64 1 32 77 103 108 117 143 147 206 221 224 226 227 230 231 233 235 237 240 243 2...

result:

ok good!

Subtask #5:

score: 15
Accepted

Dependency #4:

100%
Accepted

Test #96:

score: 15
Accepted
time: 2ms
memory: 11620kb

input:

27
12 148 141 10 98 1 82 103 145 60 190 102 181 147 152 185 24 134 179 127 141 38 169 93 132 157 49
6
1 5 7 13 17 26

output:

190
13 9 11 12 13 15 16 18 19 20 23 24 26 27 
13 9 11 12 13 15 16 18 19 20 23 24 26 27 
13 9 11 12 13 15 16 18 19 20 23 24 26 27 
13 9 11 12 13 15 16 18 19 20 23 24 26 27 
13 9 11 12 13 15 16 18 19 20 23 24 26 27 
13 9 11 12 13 15 16 18 19 20 23 24 26 27 
13 9 11 12 13 15 16 18 19 20 23 24 26 27 
13...

result:

ok good!

Test #97:

score: 0
Accepted
time: 3ms
memory: 12024kb

input:

160
35 20 9 34 11 22 2 17 18 37 32 27 4 22 26 15 32 19 22 29 8 30 7 10 23 33 11 18 24 18 29 34 17 35 26 12 28 6 27 19 37 34 8 7 33 32 18 13 24 13 26 34 6 3 37 9 10 6 16 34 19 8 30 8 14 14 32 3 35 18 12 20 1 19 25 30 19 6 2 16 15 24 34 6 31 7 22 29 11 14 14 23 7 25 32 14 9 11 21 31 37 31 2 19 31 4 13...

output:

37
80 2 4 6 9 10 11 12 15 17 18 20 22 25 26 28 30 31 33 34 35 37 40 41 42 45 46 48 50 52 53 55 59 60 63 65 67 69 71 74 76 77 81 83 85 87 88 91 93 95 97 99 101 102 104 105 108 110 112 115 119 121 122 124 126 128 130 132 134 138 140 141 143 147 148 150 151 154 156 158 160 
80 2 4 6 9 10 11 12 15 17 18...

result:

ok good!

Test #98:

score: 0
Accepted
time: 1ms
memory: 11268kb

input:

600
5 6 6 1 7 4 1 2 8 3 4 4 8 6 4 9 6 2 2 8 8 6 6 1 3 2 3 2 5 5 1 7 8 8 3 6 6 3 2 7 6 4 9 6 7 8 2 4 5 8 9 6 1 1 5 5 1 4 3 3 4 5 6 6 8 4 8 8 3 5 6 2 8 1 3 3 7 7 3 1 2 4 8 8 5 5 5 5 9 5 9 1 6 5 1 6 4 1 4 6 7 6 5 4 6 8 4 5 5 3 9 9 7 6 5 3 3 5 8 5 6 5 4 8 4 1 2 5 1 7 5 3 9 3 4 8 6 9 4 9 5 7 9 7 5 3 9 4 ...

output:

9
133 13 16 21 34 43 50 51 67 73 84 89 91 111 112 119 133 136 138 140 143 147 152 154 157 158 159 166 169 175 178 188 189 192 194 206 211 214 225 233 239 254 255 259 262 264 267 273 283 290 294 296 309 322 323 325 326 327 330 332 344 348 353 376 380 382 385 390 391 395 396 397 408 414 416 419 424 42...

result:

ok good!

Test #99:

score: 0
Accepted
time: 3ms
memory: 11776kb

input:

400
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 14 14 14 14 14 13 13 13 13 13 13 13 12 12 12 12 12 12...

output:

15
90 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 83 84 86 88 91 96 100 395 400 
90 1 2 3 4 5 6 7 8 9 10 11 12...

result:

ok good!

Test #100:

score: 0
Accepted
time: 4ms
memory: 11756kb

input:

750
7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 ...

output:

8
109 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 102 104 106 108 110 112 114 116 118 120 122 124 126 128 130 132 134 136 138 140 142 144 146 148 150 152 154 156 158 160 162 164 166 168 170 172 174 176 178 18...

result:

ok good!

Test #101:

score: 0
Accepted
time: 6ms
memory: 13820kb

input:

460
13 13 13 13 13 13 13 13 13 13 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12...

output:

24
114 2 4 6 8 10 12 14 16 18 20 23 25 27 29 31 33 35 37 39 41 43 46 48 50 52 54 56 58 60 62 64 66 69 71 73 75 77 79 81 83 85 87 89 92 94 96 98 100 102 104 106 108 110 112 115 117 119 121 123 125 127 129 131 133 135 138 140 142 144 146 148 150 152 154 156 158 161 163 165 167 169 171 173 175 177 179 ...

result:

ok good!

Test #102:

score: 0
Accepted
time: 0ms
memory: 35164kb

input:

2751
250 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

250
12 1 251 501 751 1001 1251 1501 1751 2001 2251 2501 2751 
12 1 250 500 750 1000 1250 1500 1750 2000 2250 2500 2750 
12 1 249 499 749 999 1249 1499 1749 1999 2249 2499 2749 
12 1 248 498 748 998 1248 1498 1748 1998 2248 2498 2748 
12 1 247 497 747 997 1247 1497 1747 1997 2247 2497 2747 
12 1 246 ...

result:

ok good!

Test #103:

score: 0
Accepted
time: 4ms
memory: 30308kb

input:

2924
77 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

77
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 ...

result:

ok good!

Test #104:

score: 0
Accepted
time: 5ms
memory: 11864kb

input:

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

output:

76
19 1 3 4 5 6 7 8 9 11 12 14 15 17 19 21 23 26 29 37 
19 1 2 4 5 6 7 8 9 11 12 14 15 17 19 21 23 26 29 36 
19 1 2 4 5 6 7 8 9 11 12 14 15 17 19 21 23 26 29 36 
19 1 2 3 5 6 7 8 9 11 12 14 15 17 19 21 23 26 29 35 
19 1 2 3 5 6 7 8 9 11 12 13 15 17 19 21 23 25 29 35 
19 1 2 3 5 6 7 8 9 11 12 13 15 1...

result:

ok good!

Test #105:

score: 0
Accepted
time: 0ms
memory: 16460kb

input:

1500
1 2 2 2 1 1 1 2 1 2 1 1 1 1 1 3 1 2 2 1 1 1 4 1 1 2 2 3 4 2 2 4 4 1 1 1 1 2 2 1 1 2 2 1 1 1 1 2 2 1 1 1 2 4 1 3 3 1 1 1 3 1 1 1 1 2 2 1 2 1 3 1 1 1 4 2 2 1 1 1 1 1 1 2 2 2 6 4 1 1 1 2 2 2 3 1 3 1 4 3 1 1 1 2 1 1 1 2 1 1 1 2 2 1 4 2 2 3 3 7 3 2 1 2 1 3 3 1 3 5 1 2 5 2 3 4 1 3 3 1 1 2 1 2 1 1 3 1...

output:

11
1 1279 
2 558 1279 
4 558 1279 1495 1500 
16 558 718 808 1279 1319 1429 1462 1465 1471 1476 1480 1483 1485 1488 1495 1499 
32 120 163 214 291 558 713 718 774 808 920 1028 1044 1062 1112 1117 1237 1264 1279 1294 1316 1319 1411 1429 1465 1471 1475 1479 1483 1485 1487 1494 1499 
64 87 120 133 163 21...

result:

ok good!

Test #106:

score: 0
Accepted
time: 3ms
memory: 18004kb

input:

2400
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 3 1 2 1 1 2 1 1 1 4 2 1 1 1 2 1 1 3 1 1 1 1 1 1 1 3 3 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 2 3 1 1 2 1 1 1 3 1 1 1 1 3 2 1 3 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 3 2 2 2 1 1 1 3 1 1 1 1 1 1 4 2 3...

output:

9
1 2400 
2 2392 2399 
4 2379 2386 2392 2398 
16 1267 2326 2331 2336 2342 2345 2350 2354 2359 2364 2369 2374 2379 2385 2392 2397 
32 225 1267 1335 1336 2270 2275 2279 2283 2286 2290 2294 2298 2303 2308 2312 2316 2320 2325 2330 2335 2341 2344 2350 2353 2358 2363 2368 2373 2378 2384 2391 2396 
128 46 ...

result:

ok good!

Subtask #6:

score: 15
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #107:

score: 15
Accepted
time: 5ms
memory: 45628kb

input:

40
153 344 238 669 595 304 297 265 438 678 232 354 377 249 297 629 693 559 65 283 407 198 128 290 443 371 667 289 86 601 429 231 266 624 474 12 319 436 364 646
7
1 8 9 12 21 27 28

output:

693
21 4 5 6 9 10 12 15 16 17 19 21 25 26 27 30 31 34 35 38 39 40 
21 4 5 6 9 10 12 15 16 17 19 21 25 26 27 30 31 34 35 38 39 40 
21 4 5 6 9 10 12 15 16 17 19 21 25 26 27 30 31 34 35 38 39 40 
21 4 5 6 9 10 12 15 16 17 19 21 25 26 27 30 31 34 35 38 39 40 
21 4 5 6 9 10 12 15 16 17 19 21 25 26 27 30 ...

result:

ok good!

Test #108:

score: 0
Accepted
time: 1ms
memory: 44808kb

input:

420
51 4 68 8 19 9 42 34 39 31 62 47 46 32 55 42 31 28 37 21 36 44 8 13 56 30 15 4 23 17 56 42 38 25 26 5 39 16 38 46 55 26 23 34 27 36 60 55 35 38 69 31 49 21 28 42 27 21 57 12 47 52 56 10 32 6 33 64 20 44 15 50 45 25 53 30 59 43 47 43 45 36 62 57 16 7 20 17 49 11 18 42 28 24 48 13 45 40 28 19 6 38...

output:

70
162 3 8 11 12 15 18 22 31 32 39 41 47 48 50 51 56 59 62 65 68 72 75 77 79 81 83 89 95 98 104 106 108 110 114 116 118 120 123 125 128 130 131 138 139 143 147 148 155 156 157 159 161 164 167 169 170 171 174 175 176 179 183 185 186 191 194 196 200 203 205 210 215 217 219 222 223 227 231 233 235 238 ...

result:

ok good!

Test #109:

score: 0
Accepted
time: 0ms
memory: 43000kb

input:

3500
4 4 7 4 7 1 6 6 7 1 1 6 1 4 3 2 4 1 5 3 8 1 4 1 3 6 2 7 7 2 3 2 8 2 3 4 1 2 2 4 6 8 1 2 8 7 7 4 4 1 3 5 1 6 7 2 3 4 3 1 7 8 1 6 7 4 5 1 2 2 7 6 5 1 3 1 4 5 5 8 5 6 5 6 1 7 2 1 1 6 3 1 1 2 7 6 8 7 1 7 4 6 8 2 4 5 3 1 6 1 8 4 4 5 3 2 2 2 3 3 2 2 4 2 8 3 6 7 3 2 1 1 2 7 3 5 8 5 1 1 4 6 5 7 1 2 2 2...

output:

8
1214 5 21 28 33 42 45 46 55 62 65 80 86 97 98 103 111 125 128 137 144 155 159 175 190 193 200 203 210 215 216 219 223 231 242 243 253 255 277 283 284 287 293 303 307 312 314 315 322 324 326 330 340 341 347 351 361 376 381 382 392 395 409 411 412 414 417 432 436 441 442 449 455 456 460 465 467 475 ...

result:

ok good!

Test #110:

score: 0
Accepted
time: 8ms
memory: 65020kb

input:

700
70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 69 68 67 66 65 64 64 63 62 61 60 59 59 58 57 56 56 55 54 54 53 52 52 51 51 50 49 49 48 48 47 47 46 46 45...

output:

103
19 71 73 75 77 80 82 85 88 91 95 99 103 107 112 118 126 135 149 700 
19 71 73 75 77 80 82 85 88 91 95 99 103 107 112 118 126 135 148 700 
19 71 73 75 77 80 82 85 88 91 95 98 103 107 112 118 125 135 148 700 
19 71 73 75 77 80 82 85 88 91 95 98 103 107 112 118 125 134 148 700 
60 2 4 5 7 9 10 12 1...

result:

ok good!

Test #111:

score: 0
Accepted
time: 11ms
memory: 47896kb

input:

6250
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5...

output:

6
291 1234 1236 1238 1240 1242 1244 1246 1248 1250 1252 1254 1256 1258 1260 1262 1264 1266 1268 1270 1272 1274 1276 1278 1280 1282 1284 1286 1288 1290 1292 1294 1296 1298 1300 1302 1304 1306 1308 1310 1312 1314 1316 1318 1320 1322 1324 1326 1328 1330 1332 1334 1336 1338 1340 1342 1344 1346 1348 1350...

result:

ok good!

Test #112:

score: 0
Accepted
time: 9ms
memory: 53836kb

input:

2000
14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 1...

output:

28
499 3 5 7 9 11 13 15 17 19 21 23 25 27 30 32 34 36 38 40 42 44 46 48 50 52 54 57 59 61 63 65 67 69 71 73 75 77 79 81 84 86 88 90 92 94 96 98 100 102 104 106 108 111 113 115 117 119 121 123 125 127 129 131 133 135 138 140 142 144 146 148 150 152 154 156 158 160 162 165 167 169 171 173 175 177 179 ...

result:

ok good!

Test #113:

score: 0
Accepted
time: 45ms
memory: 200496kb

input:

13930
1071 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1071
14 1 1078 2149 3220 4291 5362 6433 7504 8575 9646 10717 11788 12859 13930 
14 1 1077 2148 3219 4290 5361 6432 7503 8574 9645 10716 11787 12858 13929 
14 1 1076 2147 3218 4289 5360 6431 7502 8573 9644 10715 11786 12857 13928 
14 1 1075 2146 3217 4288 5359 6430 7501 8572 9643 10714 11785 12856 13...

result:

ok good!

Test #114:

score: 0
Accepted
time: 18ms
memory: 160988kb

input:

14828
173 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

173
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1...

result:

ok good!

Test #115:

score: 0
Accepted
time: 5ms
memory: 45288kb

input:

172
172 171 170 169 168 167 166 165 164 163 162 161 160 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 9...

output:

172
43 1 3 4 5 6 7 8 9 10 11 12 13 15 16 17 18 20 21 22 23 25 26 28 29 31 32 34 35 37 39 41 43 45 47 49 51 54 57 60 63 68 73 85 
43 1 2 4 5 6 7 8 9 10 11 12 13 15 16 17 18 19 21 22 23 25 26 28 29 31 32 34 35 37 39 41 43 45 47 49 51 54 57 60 63 67 73 84 
43 1 2 4 5 6 7 8 9 10 11 12 13 15 16 17 18 19 ...

result:

ok good!

Test #116:

score: 0
Accepted
time: 2ms
memory: 75164kb

input:

5000
3 3 3 2 1 2 1 2 1 1 6 8 1 2 1 1 3 3 1 2 7 2 1 2 4 1 3 5 3 5 3 2 7 2 7 2 1 5 1 1 1 3 7 1 2 4 1 1 2 1 6 1 1 4 2 1 4 1 3 3 5 1 3 3 6 10 9 1 1 1 3 6 6 1 1 3 2 3 8 2 4 4 12 3 3 6 3 2 4 7 4 1 5 1 7 1 4 4 15 5 2 6 6 2 10 5 3 3 7 1 1 1 1 1 1 1 2 2 1 3 2 1 6 1 5 3 2 1 1 3 4 7 2 2 1 3 2 3 5 1 2 7 3 1 1 1...

output:

22
1 5000 
2 1224 2438 
2 1224 2438 
2 1224 2438 
8 1092 1224 1989 2178 2438 4400 4908 5000 
8 1092 1224 1723 2110 2178 2438 4908 5000 
16 783 1092 1224 1395 1623 1723 1989 2110 2178 2352 2388 2438 4135 4303 4477 5000 
16 99 783 1092 1224 1623 1723 1989 2074 2110 2178 2388 2438 3364 4303 4477 4999 
...

result:

ok good!

Test #117:

score: 0
Accepted
time: 9ms
memory: 73136kb

input:

11000
1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 2 2 1 1 3 1 3 1 1 2 2 1 1 1 1 2 1 2 1 1 1 2 1 1 1 1 4 1 1 1 3 2 1 2 1 1 3 1 1 1 1 1 1 1 1 1 1 1 3 2 1 2 2 1 1 2 2 2 2 1 1 1 1 1 2 4 1 2 1 1 1 2 1 1 1 1 1 1 3 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 2 ...

output:

9
1 11000 
2 10992 10999 
4 9052 10604 10992 10998 
16 478 554 726 1326 1427 1489 2700 3901 4683 7060 9052 9592 9653 10348 10648 10997 
128 478 554 630 726 789 954 1326 1427 1489 1499 1520 1641 1654 1834 1868 2094 2319 2333 2700 3416 3437 3901 4348 4418 4488 4508 4683 4815 5111 5342 5356 5397 5481 5...

result:

ok good!

Extra Test:

score: 0
Extra Test Passed