QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#525911#6339. CookiesQwerty123278 354ms883480kbC++234.7kb2024-08-21 03:08:492024-08-21 03:08:50

Judging History

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

  • [2024-08-21 03:08:50]
  • 评测
  • 测评结果:78
  • 用时:354ms
  • 内存:883480kb
  • [2024-08-21 03:08:49]
  • 提交

answer

// #pragma GCC optimize("O3")
// #pragma GCC target("avx2")
#include <bits/stdc++.h>

// constexpr int N = 1.5e4 + 5;

void chmin(auto& a, auto b) {
    a = std::min(a, b);
}

int32_t main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int n;
    std::cin >> n;
    std::vector<int> input(n);
    for (auto& i : input) {
        std::cin >> i;
    }
    int m;
    std::cin >> m;
    std::vector<int> sz(m);
    for (auto& i : sz) {
        std::cin >> i;
    }

    int mx = std::max_element(input.begin(), input.end()).operator*();
    int sm = std::accumulate(input.begin(), input.end(), 0);

    std::vector<int> shit(input.begin(), input.end());
    std::sort(shit.rbegin(), shit.rend());
    std::vector<int> shit_suf(n + 1);
    for (int i = n - 1, s = 0; i >= 0; i--) {
        s += shit[i], shit_suf[i] = s;
    }

    std::vector<std::vector<std::vector<int>>> dp(n);
    for (int i = 0; i < n; i++) {
        dp[i] = std::vector<std::vector<int>>(std::min<int>(1e9, (sm / (i + 1))) + 1, std::vector<int>(shit_suf[i] + 1, sm + 5));
    }

    dp[n - 1][0][0] = 0;

    for (int i = n - 1; i >= 0; i--) {
        bool bx = std::binary_search(sz.begin(), sz.end(), i + 1);
        if (bx) {
            for (int j = 0; j + 1 < dp[i].size(); j++) {
                for (int k = 0; k < dp[i][j].size(); k++) {
                    int k2 = k + 1;
                    if (k2 < dp[i][j + 1].size()) {
                        chmin(dp[i][j + 1][k2], dp[i][j][k] + 1);
                    }
                }
            }
        }
        if (i > 0) {
            for (int j = 0; j < dp[i].size(); j++) {
                for (int k = 0; k < dp[i][j].size(); k++) {
                    int k2 = k + j;
                    if (k2 < dp[i - 1][j].size()) {
                        chmin(dp[i - 1][j][k2], dp[i][j][k]);
                    }
                }
            }
        }
    }

    std::vector<int> bx_sz;
    {
        std::array<int, 3> min = {sm + 1, -1, -1};
        for (int k = 0; k < dp[0].size(); k++) {
            if (sm < dp[0][k].size()) {
                min = std::min(min, std::array<int, 3>{dp[0][k][sm], k, sm});
            }
        }
        std::pair<int, int> pos(min[1], min[2]);
        if (min.front() > sm || pos.first == -1) {
            std::cout << "-1\n";
            return 0;
        }

        for (int i = 0; i < n; i++) {
            bool bx = std::binary_search(sz.begin(), sz.end(), i + 1);
            if (bx) {
                for (int j = (int)dp[i].size() - 1; j > 0; j--) {
                    for (int k = 0; k < dp[i][j].size(); k++) {
                        if (j != pos.first || k != pos.second) {
                            continue;
                        }
                        int k2 = k - 1;
                        if (0 <= k2 && k2 < dp[i][j - 1].size() && dp[i][j - 1][k2] + 1 == dp[i][j][k]) {
                            pos.first--, pos.second--;
                            bx_sz.push_back(i + 1);
                        }
                    }
                }
            }
            if (i + 1 < n) {
                for (int j = 0; j < dp[i].size(); j++) {
                    for (int k = 0; k < dp[i][j].size(); k++) {
                        if (j != pos.first || k != pos.second) {
                            continue;
                        }
                        int k2 = k - j;
                        if (0 <= k2 && k2 < dp[i + 1][j].size() && dp[i + 1][j][k2] == dp[i][j][k]) {
                            pos.second -= j;
                        }
                    }
                }
            }
        }
    }

    // !

    int q = bx_sz.size();
    std::sort(bx_sz.rbegin(), bx_sz.rend());

    std::priority_queue<std::pair<int, int>> heap;
    for (int i = 0; i < n; i++) {
        heap.push({input[i], i});
    }

    std::vector<std::vector<int>> ans(q);
    for (int i = 0; i < q; i++) {
        std::vector<std::pair<int, int>> vec(bx_sz[i]);
        ans[i].resize(bx_sz[i]);
        for (int j = 0; j < bx_sz[i]; j++) {
            assert(heap.size());
            vec[j] = heap.top(), heap.pop(), vec[j].first--, ans[i][j] = vec[j].second;
        }
        for (auto p : vec) {
            if (p.first > 0) {
                heap.push(p);
            }
        }
    }

    std::cout << ans.size() << "\n";
    for (auto& vec : ans) {
        std::cout << vec.size();
        std::sort(vec.begin(), vec.end());
        for (auto i : vec) {
            std::cout << " " << i + 1;
        }
        std::cout << std::endl;
    }

    return 0;
}

/*


5 5 2 2 2 2 0
5 4 4 2 1 1 1


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





*/

詳細信息

Subtask #1:

score: 6
Accepted

Test #1:

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

input:

1
1
1
1

output:

1
1 1

result:

ok good!

Test #2:

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

input:

2
1 1
1
1

output:

2
1 2
1 1

result:

ok good!

Test #3:

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

input:

2
1 1
1
2

output:

1
2 1 2

result:

ok good!

Test #4:

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

input:

2
1 1
2
1 2

output:

1
2 1 2

result:

ok good!

Test #5:

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

input:

4
1 1 1 1
2
2 3

output:

2
2 3 4
2 1 2

result:

ok good!

Test #6:

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

input:

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

output:

2
4 5 6 7 8
4 1 2 3 4

result:

ok good!

Test #7:

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

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 458
1 457
1 456
1 455
1 454
1 453
1 452
1 ...

result:

ok good!

Test #8:

score: 6
Accepted
time: 4ms
memory: 9756kb

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: 6
Accepted
time: 6ms
memory: 9688kb

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
499 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 ...

result:

ok good!

Test #10:

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

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: 6
Accepted
time: 5ms
memory: 9744kb

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
46 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500
46 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435...

result:

ok good!

Test #12:

score: 6
Accepted
time: 5ms
memory: 9988kb

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 499 500
2 497 498
2 495 496
2 493 494
2 491 492
2 489 490
2 487 488
2 485 486
2 483 484
2 481 482
2 479 480
2 477 478
2 475 476
2 473 474
2 471 472
2 469 470
2 467 468
2 465 466
2 463 464
2 461 462
2 459 460
2 457 458
2 455 456
2 453 454
2 451 452
2 449 450
2 447 448
2 445 446
2 443 444
2 441 ...

result:

ok good!

Test #13:

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

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 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484
22 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
22 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440
22 397 398 399 400 401 4...

result:

ok good!

Test #14:

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

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 487 488 489 490 491 492 493 494 495
9 478 479 480 481 482 483 484 485 486
9 469 470 471 472 473 474 475 476 477
9 460 461 462 463 464 465 466 467 468
9 451 452 453 454 455 456 457 458 459
9 442 443 444 445 446 447 448 449 450
9 433 434 435 436 437 438 439 440 441
9 424 425 426 427 428 429 430 4...

result:

ok good!

Test #15:

score: 6
Accepted
time: 4ms
memory: 9740kb

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 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 44...

result:

ok good!

Test #16:

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

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
21 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499
21 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478
21 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457
21 416 417 418 419 420 421 422 423 4...

result:

ok good!

Test #17:

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

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
27 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499
27 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472
27 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 ...

result:

ok good!

Test #18:

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

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
88 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485...

result:

ok good!

Test #19:

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

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
243 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 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 33...

result:

ok good!

Test #20:

score: 6
Accepted
time: 5ms
memory: 9728kb

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
488 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 10...

result:

ok good!

Test #21:

score: 6
Accepted
time: 4ms
memory: 9708kb

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: 6
Accepted
time: 4ms
memory: 9708kb

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: 6
Accepted
time: 0ms
memory: 9580kb

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
477 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 ...

result:

ok good!

Test #24:

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

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
477 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 ...

result:

ok good!

Test #25:

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

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
237 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 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 3...

result:

ok good!

Test #26:

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

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
237 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 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 3...

result:

ok good!

Test #27:

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

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
237 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 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 3...

result:

ok good!

Subtask #2:

score: 0
Memory Limit Exceeded

Test #28:

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

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: 7
Accepted
time: 0ms
memory: 4784kb

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 1
1 1
1 1
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: 7
Accepted
time: 12ms
memory: 39056kb

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
1 1
1 1
1 1
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: 7
Accepted
time: 354ms
memory: 883480kb

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
1 1
1 1
1 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: 7
Accepted
time: 0ms
memory: 3560kb

input:

2
2 1
1
1

output:

3
1 1
1 2
1 1

result:

ok good!

Test #33:

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

input:

2
1 2
1
2

output:

-1

result:

ok no solution

Test #34:

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

input:

3
1 2 3
1
2

output:

3
2 2 3
2 2 3
2 1 3

result:

ok good!

Test #35:

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

input:

3
3 2 1
1
3

output:

-1

result:

ok no solution

Test #36:

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

input:

3
2 2 2
1
2

output:

3
2 2 3
2 1 3
2 1 2

result:

ok good!

Test #37:

score: 7
Accepted
time: 2ms
memory: 6128kb

input:

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

output:

50
10 1 2 3 4 5 6 7 8 9 10
10 1 2 3 4 5 6 7 8 9 11
10 1 2 3 4 5 6 7 8 9 10
10 1 2 3 4 5 6 7 8 10 11
10 1 2 3 4 5 6 7 8 9 11
10 1 2 3 4 5 6 7 8 9 10
10 1 2 3 4 5 6 7 9 10 11
10 1 2 3 4 5 6 7 8 10 11
10 1 2 3 4 5 6 7 8 9 11
10 1 2 3 4 5 6 7 8 9 10
10 1 2 3 4 5 6 8 9 10 11
10 1 2 3 4 5 6 7 9 10 11
10 1...

result:

ok good!

Test #38:

score: 7
Accepted
time: 1ms
memory: 5836kb

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
Memory Limit Exceeded

input:

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

output:

3750
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5 8 9
4 2 5...

result:


Subtask #3:

score: 12
Accepted

Test #45:

score: 12
Accepted
time: 0ms
memory: 3556kb

input:

2
7 8
2
1 2

output:

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

result:

ok good!

Test #46:

score: 12
Accepted
time: 0ms
memory: 3540kb

input:

3
5 4 6
2
2 3

output:

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

result:

ok good!

Test #47:

score: 12
Accepted
time: 0ms
memory: 3608kb

input:

3
4 2 9
3
1 2 3

output:

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

result:

ok good!

Test #48:

score: 12
Accepted
time: 0ms
memory: 3544kb

input:

4
3 5 4 3
2
3 4

output:

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

result:

ok good!

Test #49:

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

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: 12
Accepted
time: 0ms
memory: 3624kb

input:

4
3 3 6 3
3
2 3 4

output:

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

result:

ok good!

Test #51:

score: 12
Accepted
time: 0ms
memory: 3548kb

input:

5
4 3 3 3 1
3
2 4 5

output:

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

result:

ok good!

Test #52:

score: 12
Accepted
time: 0ms
memory: 3560kb

input:

5
4 3 3 3 2
3
3 4 5

output:

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

result:

ok good!

Test #53:

score: 12
Accepted
time: 0ms
memory: 3832kb

input:

5
4 4 4 2 1
3
2 4 5

output:

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

result:

ok good!

Test #54:

score: 12
Accepted
time: 0ms
memory: 3500kb

input:

5
3 3 3 3 3
3
1 2 4

output:

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

result:

ok good!

Test #55:

score: 12
Accepted
time: 0ms
memory: 3628kb

input:

6
3 3 3 2 2 2
3
2 4 6

output:

-1

result:

ok no solution

Test #56:

score: 12
Accepted
time: 0ms
memory: 3608kb

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: 12
Accepted
time: 0ms
memory: 3612kb

input:

6
4 4 3 2 1 1
3
1 3 5

output:

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

result:

ok good!

Test #58:

score: 12
Accepted
time: 0ms
memory: 3500kb

input:

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

output:

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

result:

ok good!

Test #59:

score: 12
Accepted
time: 0ms
memory: 3612kb

input:

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

output:

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

result:

ok good!

Test #60:

score: 12
Accepted
time: 0ms
memory: 3608kb

input:

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

output:

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

result:

ok good!

Test #61:

score: 12
Accepted
time: 0ms
memory: 3604kb

input:

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

output:

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

result:

ok good!

Test #62:

score: 12
Accepted
time: 0ms
memory: 3764kb

input:

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

output:

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

result:

ok good!

Test #63:

score: 12
Accepted
time: 0ms
memory: 3548kb

input:

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

output:

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

result:

ok good!

Test #64:

score: 12
Accepted
time: 0ms
memory: 3624kb

input:

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

output:

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

result:

ok good!

Test #65:

score: 12
Accepted
time: 0ms
memory: 3544kb

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
10 1 2 5 6 7 8 9 10 11 12
4 1 2 3 4
1 1

result:

ok good!

Test #66:

score: 12
Accepted
time: 0ms
memory: 3540kb

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
14 1 2 3 4 5 6 7 8 9 10 11 12 13 14
1 1

result:

ok good!

Test #67:

score: 12
Accepted
time: 0ms
memory: 3536kb

input:

4
2 2 2 1
2
1 4

output:

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

result:

ok good!

Subtask #4:

score: 45
Accepted

Dependency #1:

100%
Accepted

Dependency #3:

100%
Accepted

Test #68:

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

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
68 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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
18 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 22 23
18 1 2 3 4 5 6 7 8 9 10 11 15 16 17 18 19 20 21
18 ...

result:

ok good!

Test #69:

score: 45
Accepted
time: 4ms
memory: 7948kb

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
106 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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 1...

result:

ok good!

Test #70:

score: 45
Accepted
time: 4ms
memory: 8196kb

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
221 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 #71:

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

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
203 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 #72:

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

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
202 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 #73:

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

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
229 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 #74:

score: 45
Accepted
time: 3ms
memory: 6660kb

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
15 1 2 3 4 5 6 7 8 9 10 11 12 13 15 16
15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 18
14 1 2 3 4 5 6 7 8 9 10 11 15 16 17
14 1 2 3 4 5 6 7 8 9 10 11 12 13 14
14 1 2 3 4 5 6 7 8 9 10 21 22 23 24
14 1 2 3 4 5 6 7 8 9 16 17 18 19 20
14 1 2 3 4 5 6 7 8 9 11 12 13 14 15
14 1 2 3 4 5 6 7 8 9 10 28 29 30 31
14 ...

result:

ok good!

Test #75:

score: 45
Accepted
time: 3ms
memory: 6892kb

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
68 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 63 64 65 66 67 68 69 70
62 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 ...

result:

ok good!

Test #76:

score: 45
Accepted
time: 2ms
memory: 6108kb

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
20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
18 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
12 1 2 3 4 5 6 7 8 9 10 11 12
12 1 2 3 4 5 6 7 8 9 10 11 12
12 1 2 3 4 5 6 7 8 9 10 11 13
12 1 2 3 4 5 6 7 8 9 10 11 12
12 1 2 3 4 5 6 7 8 9 10 11 13
12 1 2 3 4 5 6 7 8 9 10 11 12
12 1 2 3 4 5 6 ...

result:

ok good!

Test #77:

score: 45
Accepted
time: 3ms
memory: 6172kb

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
64 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 127
64 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 94 95 96 97 98 99 100 1...

result:

ok good!

Test #78:

score: 45
Accepted
time: 2ms
memory: 5780kb

input:

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

output:

115
8 1 2 3 6 7 8 9 10
8 1 2 3 6 7 8 9 10
8 1 2 3 6 7 8 9 10
8 1 2 3 6 7 8 9 10
8 1 2 3 6 7 8 9 10
8 1 2 3 6 7 8 9 10
8 1 2 3 6 7 8 9 10
8 1 2 3 6 7 8 9 10
8 1 2 3 6 7 8 9 10
8 1 2 3 6 7 8 9 10
8 2 3 5 6 7 8 9 10
8 1 2 5 6 7 8 9 10
8 1 2 3 6 7 8 9 10
8 2 3 5 6 7 8 9 10
8 1 2 5 6 7 8 9 10
8 1 2 3 6 7...

result:

ok good!

Test #79:

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

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
29 1 2 3 4 6 7 8 12 13 14 16 18 20 21 22 23 24 25 26 27 28 29 32 35 36 37 38 39 40
29 1 2 3 4 6 7 8 12 13 14 16 18 20 21 23 24 25 26 27 28 29 30 32 35 36 37 38 39 40
29 1 2 3 4 5 6 7 8 12 13 14 15 16 18 20 21 22 23 25 26 27 28 29 32 35 37 38 39 40
29 1 2 3 4 6 7 8 12 13 14 16 18 20 21 23 25 26 27...

result:

ok good!

Test #80:

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

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
36 2 3 4 5 6 7 8 9 10 11 12 14 15 16 17 18 19 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 40
36 2 3 4 5 6 7 8 9 10 11 12 14 15 16 17 18 19 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 40
32 2 3 4 5 6 7 9 10 11 12 14 15 16 17 18 19 22 23 24 26 27 28 29 30 32 33 34 35 36 37 38 40...

result:

ok good!

Test #81:

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

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
116 1 3 4 5 6 7 8 9 10 11 13 16 17 18 19 20 21 22 24 25 26 28 29 30 31 32 34 35 38 40 41 42 44 45 46 47 48 49 50 51 52 53 54 56 57 58 59 60 62 63 64 65 66 67 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...

result:

ok good!

Test #82:

score: 45
Accepted
time: 4ms
memory: 7712kb

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
128 1 2 3 4 6 7 8 9 10 11 12 13 14 15 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...

result:

ok good!

Test #83:

score: 45
Accepted
time: 3ms
memory: 7716kb

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
17 12 18 32 41 47 52 56 103 104 105 112 113 114 115 120 122 124
17 71 74 77 80 85 86 90 93 96 101 103 104 105 110 112 120 124
17 12 13 15 18 25 27 32 35 39 41 44 45 47 52 54 56 65
17 2 4 93 96 101 103 104 105 108 110 112 113 114 115 120 122 124
17 54 56 58 59 61 65 68 71 74 77 79 80 81 84 85 86 9...

result:

ok good!

Test #84:

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

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
70 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
70 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 3...

result:

ok good!

Test #85:

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

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
79 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 76 77 78 79 80 81 82 83 84 85 86 87 88
79 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2...

result:

ok good!

Test #86:

score: 45
Accepted
time: 4ms
memory: 7852kb

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
108 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 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 10...

result:

ok good!

Test #87:

score: 45
Accepted
time: 4ms
memory: 8268kb

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
123 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 109 110 111 112 113 114 115...

result:

ok good!

Test #88:

score: 45
Accepted
time: 4ms
memory: 8600kb

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
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 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 #89:

score: 45
Accepted
time: 4ms
memory: 8444kb

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
218 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 176 177 178 179 180 181 ...

result:

ok good!

Test #90:

score: 45
Accepted
time: 4ms
memory: 7556kb

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
100 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
2...

result:

ok good!

Test #91:

score: 45
Accepted
time: 2ms
memory: 9264kb

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
14 1 434 435 436 437 438 439 440 441 442 443 444 445 446
9 1 426 427 428 429 430 431 432 433
9 1 418 419 420 421 422 423 424 425
9 1 410 411 412 413 414 415 416 417
9 1 402 403 404 405 406 407 408 409
9 1 394 395 396 397 398 399 400 401
9 1 386 387 388 389 390 391 392 393
9 1 378 379 380 381 382 ...

result:

ok good!

Test #92:

score: 45
Accepted
time: 5ms
memory: 9592kb

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

result:

ok good!

Test #93:

score: 45
Accepted
time: 3ms
memory: 6376kb

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
24 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
24 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 25
24 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
24 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 25 26
24 1 2 3 4 5 6 7 8 9 10 11 12 13 ...

result:

ok good!

Test #94:

score: 45
Accepted
time: 3ms
memory: 7156kb

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
64 2 3 4 7 8 9 11 12 13 15 19 20 22 23 24 25 27 28 29 30 32 33 35 37 39 40 41 44 46 48 49 50 51 54 58 59 60 65 67 68 69 70 71 72 74 75 76 77 78 80 82 83 84 86 88 90 92 93 94 95 96 97 98 100
64 2 3 4 7 8 9 11 12 13 15 19 20 22 23 25 27 28 29 30 32 33 35 37 38 39 40 41 42 44 46 48 49 50 51 52 54 58...

result:

ok good!

Test #95:

score: 45
Accepted
time: 4ms
memory: 8748kb

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
256 1 4 6 7 24 31 32 36 37 48 51 52 55 67 69 70 77 82 87 88 92 93 95 99 100 103 106 108 115 117 121 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 17...

result:

ok good!

Subtask #5:

score: 15
Accepted

Dependency #4:

100%
Accepted

Test #96:

score: 15
Accepted
time: 35ms
memory: 99120kb

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
26 1 2 3 4 5 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
26 1 2 3 4 5 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
26 1 2 3 4 5 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
26 1 2 3 4 5 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
26 1...

result:

ok good!

Test #97:

score: 15
Accepted
time: 48ms
memory: 154224kb

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
122 1 2 4 5 6 8 9 10 11 12 14 15 16 17 18 19 20 22 25 26 27 28 29 30 31 32 33 34 35 36 37 39 40 41 42 45 46 47 48 49 50 51 52 55 59 60 61 63 65 66 67 69 70 71 72 74 75 76 77 80 81 82 83 85 87 88 89 90 91 92 94 95 96 98 99 100 101 102 104 105 107 108 109 110 112 114 115 118 119 120 121 122 124 125...

result:

ok good!

Test #98:

score: 15
Accepted
time: 70ms
memory: 201260kb

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
532 1 2 3 5 6 9 10 11 12 13 14 15 16 17 20 21 22 23 25 26 27 28 29 30 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 55 56 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 75 76 77 78 79 81 82 83 84 85 86 87 88 89 90 91 93 94 96 97 99 100 101 102 103 104 105 106 107 108 109 110 111 ...

result:

ok good!

Test #99:

score: 15
Accepted
time: 89ms
memory: 183412kb

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
338 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 1...

result:

ok good!

Test #100:

score: 15
Accepted
time: 100ms
memory: 208980kb

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
513 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 #101:

score: 15
Accepted
time: 109ms
memory: 186076kb

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
460 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 1...

result:

ok good!

Test #102:

score: 15
Accepted
time: 111ms
memory: 257108kb

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 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751
12 1 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740
12 1 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729
12 1 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718
12 1 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2...

result:

ok good!

Test #103:

score: 15
Accepted
time: 134ms
memory: 273776kb

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
2924 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 ...

result:

ok good!

Test #104:

score: 15
Accepted
time: 73ms
memory: 122552kb

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
57 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
57 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 ...

result:

ok good!

Test #105:

score: 15
Accepted
time: 95ms
memory: 227752kb

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
1024 2 3 4 8 10 16 18 19 23 26 27 28 29 30 31 32 33 38 39 42 43 48 49 53 54 56 57 61 66 67 69 71 75 76 77 84 85 86 87 88 92 93 94 95 97 99 100 104 108 112 113 115 116 117 118 119 120 121 122 124 126 127 129 130 132 133 134 135 136 138 139 142 144 147 152 153 155 156 158 159 162 163 164 165 169 17...

result:

ok good!

Test #106:

score: 15
Accepted
time: 103ms
memory: 255328kb

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
2048 1 16 26 37 39 42 46 47 51 54 62 63 69 77 80 83 87 88 91 95 100 101 103 107 127 132 133 134 135 139 146 147 148 165 167 169 171 173 176 189 191 192 194 195 197 199 201 202 204 206 216 225 226 229 231 232 237 238 242 246 250 254 271 273 277 289 298 302 305 307 316 320 322 324 330 333 339 340 34...

result:

ok good!

Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%