QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#525903#6339. CookiesQwerty1232#6 5ms9936kbC++234.6kb2024-08-21 03:00:352024-08-21 03:00:35

Judging History

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

  • [2024-08-21 03:00:35]
  • 评测
  • 测评结果:6
  • 用时:5ms
  • 内存:9936kb
  • [2024-08-21 03:00:35]
  • 提交

answer

#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>>((sm / (i + 1)) + 1, std::vector<int>(shit_suf[i] + 1, n + 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 = {n + 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() > n || 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





*/

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 6
Accepted

Test #1:

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

input:

1
1
1
1

output:

1
1 1

result:

ok good!

Test #2:

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

input:

2
1 1
1
1

output:

2
1 2
1 1

result:

ok good!

Test #3:

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

input:

2
1 1
1
2

output:

1
2 1 2

result:

ok good!

Test #4:

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

input:

2
1 1
2
1 2

output:

1
2 1 2

result:

ok good!

Test #5:

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

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: 3824kb

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: 5ms
memory: 9928kb

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: 0ms
memory: 9772kb

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: 3ms
memory: 9680kb

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: 2ms
memory: 9696kb

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: 9908kb

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

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: 4ms
memory: 9528kb

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: 4ms
memory: 9572kb

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: 9764kb

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: 4ms
memory: 9664kb

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: 5ms
memory: 9640kb

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: 4ms
memory: 9736kb

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: 5ms
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:

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: 0ms
memory: 9904kb

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: 9700kb

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: 2ms
memory: 9936kb

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: 5ms
memory: 9496kb

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: 5ms
memory: 9500kb

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: 4ms
memory: 9488kb

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: 4ms
memory: 9744kb

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: 4ms
memory: 9780kb

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
Wrong Answer

Test #28:

score: 0
Wrong Answer
time: 0ms
memory: 3764kb

input:

1
15
1
1

output:

-1

result:

wrong answer you didn't find a solution but jury did

Subtask #3:

score: 0
Wrong Answer

Test #45:

score: 0
Wrong Answer
time: 0ms
memory: 3552kb

input:

2
7 8
2
1 2

output:

-1

result:

wrong answer you didn't find a solution but jury did

Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%