QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#760005#2785. Boxes with souvenirs_8_8_#35 1ms5972kbC++20830b2024-11-18 13:59:592024-11-18 13:59:59

Judging History

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

  • [2024-11-18 13:59:59]
  • 评测
  • 测评结果:35
  • 用时:1ms
  • 内存:5972kb
  • [2024-11-18 13:59:59]
  • 提交

answer

#include "boxes.h"
#include <bits/stdc++.h>

typedef long long ll;
const int N = (int)1e7 + 2;
int n, k, l;
ll dp[N], pd[N];
ll delivery(int nn, int kk, int LL, int p[]) {
    n = nn;k = kk;l = LL;

    for(int i = 0; i < n; i++) {
        ll pr = (i - k >= 0 ? dp[i - k] : 0);
        dp[i] = pr + p[i] + p[i];
    }
    ll res = dp[n - 1];
    ll v = dp[n - 1] - p[n - 1];
    for(int i = 0; i < n; i++) {
        p[i] = l - p[i];
    }
    res = std::min(res, v + p[n - 1]);
    for(int i = n - 1; i >= 0; i--) {
        ll pr = (i + k <= n - 1 ? pd[i + k] : 0);
        pd[i] = pr + p[i] + p[i];
    }
    res = std::min(res, pd[0] - p[0] + (l - p[0]));
    res = std::min(res, pd[0]);
    for(int i = 0; i < n - 1; i++) {
        res = std::min(res, dp[i] + pd[i + 1]);
    }
    return res;
}

詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 1ms
memory: 5896kb

input:

1 1 1000000000
210758687

output:

421517374

result:

ok single line: '421517374'

Test #2:

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

input:

1000 1 1000000000
1808509 2182084 3015527 4447494 7769779 8792029 9883237 12829051 12902231 13338930 16688684 16992515 17866419 19063417 20124997 20125047 20514891 20917910 24004241 25917774 30411202 34419407 34944244 36371532 36402573 39271076 39612282 40912226 41119528 41176691 42741034 42801382 4...

output:

511681980406

result:

ok single line: '511681980406'

Test #3:

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

input:

1000 1 1000
2 3 4 4 4 7 7 8 10 12 12 13 14 15 16 16 17 17 18 21 22 23 24 24 25 28 30 30 30 30 32 32 34 34 34 34 35 35 35 35 35 36 36 36 37 39 41 42 42 43 43 44 44 44 45 46 46 46 47 48 49 51 52 53 55 56 58 60 61 61 62 63 64 68 69 70 72 74 75 76 76 76 78 78 80 81 83 83 84 84 85 85 86 86 88 88 90 92 92...

output:

511638

result:

ok single line: '511638'

Test #4:

score: 10
Accepted
time: 1ms
memory: 5900kb

input:

1000 1 5
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

2322

result:

ok single line: '2322'

Test #5:

score: 10
Accepted
time: 1ms
memory: 5784kb

input:

1000 1 1000000000
447532220 447532220 447532220 447532220 447532220 447532220 447532220 447532220 447532220 447532220 447532220 447532220 447532220 447532220 447532220 447532220 447532220 447532220 447532220 447532220 447532220 447532220 447532220 447532220 447532220 447532220 447532220 447532220 44...

output:

895064440000

result:

ok single line: '895064440000'

Test #6:

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

input:

1000 1 1000000000
18457857 18457857 18457857 18457857 18457857 18457857 18457857 18457857 18457857 18457857 18457857 18457857 18457857 18457857 18457857 18457857 18457857 18457857 18457857 18457857 18457857 61895049 61895049 61895049 61895049 61895049 61895049 61895049 61895049 61895049 61895049 618...

output:

619577021140

result:

ok single line: '619577021140'

Test #7:

score: 10
Accepted
time: 1ms
memory: 5908kb

input:

1000 1 1000000000
159227065 159227065 159227065 159227065 159227065 159227065 159227065 159227065 159227065 159227065 159227065 159227065 159227065 159227065 159227065 159227065 159227065 159227065 159227065 159227065 159227065 159227065 159227065 159227065 159227065 159227065 159227065 159227065 15...

output:

294049546692

result:

ok single line: '294049546692'

Subtask #2:

score: 10
Accepted

Test #8:

score: 10
Accepted
time: 1ms
memory: 5856kb

input:

1000 1000 1000
0 0 1 2 3 3 4 5 5 6 6 7 8 8 8 9 10 11 11 11 12 13 13 13 14 14 15 16 17 17 17 18 20 20 21 21 24 25 25 26 30 31 34 34 35 38 40 43 44 46 46 46 47 47 51 52 52 52 55 56 58 62 64 65 67 68 69 72 73 75 76 77 78 79 79 80 83 84 85 85 86 86 87 88 88 88 92 92 92 95 95 96 98 98 99 99 100 100 101 1...

output:

1000

result:

ok single line: '1000'

Test #9:

score: 10
Accepted
time: 1ms
memory: 5764kb

input:

1000 1000 5
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

5

result:

ok single line: '5'

Test #10:

score: 10
Accepted
time: 1ms
memory: 5792kb

input:

1000 1000 1000000000
154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846...

output:

308753692

result:

ok single line: '308753692'

Test #11:

score: 10
Accepted
time: 1ms
memory: 5968kb

input:

1000 1000 1000000000
198812287 198812287 198812287 198812287 198812287 198812287 198812287 198812287 198812287 198812287 198812287 198812287 198812287 198812287 198812287 198812287 198812287 198812287 198812287 198812287 198812287 198812287 198812287 198812287 198812287 198812287 198812287 198812287...

output:

1000000000

result:

ok single line: '1000000000'

Test #12:

score: 10
Accepted
time: 1ms
memory: 5896kb

input:

1000 1000 1000000000
84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 84700188 ...

output:

665477708

result:

ok single line: '665477708'

Test #13:

score: 10
Accepted
time: 1ms
memory: 5972kb

input:

1000 1000 1000000000
999000464 999001671 999001764 999002621 999002638 999003276 999003514 999005294 999005677 999005939 999006089 999008721 999009077 999012938 999014321 999015139 999015321 999015639 999016078 999016400 999016872 999017560 999017819 999018653 999019793 999019959 999021115 999021456...

output:

1999072

result:

ok single line: '1999072'

Test #14:

score: 10
Accepted
time: 1ms
memory: 5824kb

input:

1000 1000 1000
800 800 800 800 800 800 800 800 800 800 800 800 801 801 801 801 801 801 802 802 802 802 802 802 803 803 803 803 804 804 805 805 805 805 806 806 806 806 806 806 806 807 807 807 807 807 807 807 807 807 807 808 808 808 808 808 808 809 809 809 809 809 810 810 810 810 811 811 811 811 812 8...

output:

400

result:

ok single line: '400'

Subtask #3:

score: 15
Accepted

Test #15:

score: 15
Accepted
time: 0ms
memory: 5772kb

input:

10 5 5
0 0 0 0 0 1 3 3 3 4

output:

5

result:

ok single line: '5'

Test #16:

score: 15
Accepted
time: 1ms
memory: 5776kb

input:

10 5 1000000000
334882664 334882664 334882664 334882664 334882664 334882664 334882664 334882664 334882664 334882664

output:

1339530656

result:

ok single line: '1339530656'

Test #17:

score: 15
Accepted
time: 1ms
memory: 5824kb

input:

10 2 1000000000
85975415 85975415 85975415 85975415 85975415 85975415 85975415 85975415 85975415 105352579

output:

898508478

result:

ok single line: '898508478'

Test #18:

score: 15
Accepted
time: 1ms
memory: 5824kb

input:

10 2 1000000000
450369670 450369670 450369670 450369670 450369670 450369670 450369670 450369670 973255696 973255696

output:

3656445968

result:

ok single line: '3656445968'

Test #19:

score: 15
Accepted
time: 0ms
memory: 5820kb

input:

10 10 1000000000
20859 165911 251492 256622 477740 805842 835605 999196078 999415731 999776268

output:

3279054

result:

ok single line: '3279054'

Test #20:

score: 15
Accepted
time: 1ms
memory: 5840kb

input:

10 5 1000
7 63 166 821 853 857 930 934 989 995

output:

712

result:

ok single line: '712'

Test #21:

score: 15
Accepted
time: 1ms
memory: 5960kb

input:

10 3 1000000000
999047045 999128015 999188976 999210145 999404712 999486411 999527465 999770649 999830703 999904465

output:

4621760

result:

ok single line: '4621760'

Test #22:

score: 15
Accepted
time: 0ms
memory: 5804kb

input:

10 4 1000
810 820 883 904 912 924 940 943 991 999

output:

574

result:

ok single line: '574'

Subtask #4:

score: 0
Wrong Answer

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #23:

score: 15
Accepted
time: 1ms
memory: 5784kb

input:

1000 1000 1000000000
325942 1204336 1612183 2893660 5229507 5594519 6900231 8529570 10109022 11952220 14385840 15224378 15427006 15460653 16267558 18182056 19024727 19448694 21171021 21976036 22199267 23683490 24156493 24169712 28958155 29308895 30228647 32068074 32363555 33028799 34696392 37439068 ...

output:

1000000000

result:

ok single line: '1000000000'

Test #24:

score: 15
Accepted
time: 0ms
memory: 5820kb

input:

1000 500 5
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

8

result:

ok single line: '8'

Test #25:

score: 15
Accepted
time: 1ms
memory: 5784kb

input:

1000 4 5
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

584

result:

ok single line: '584'

Test #26:

score: 15
Accepted
time: 1ms
memory: 5780kb

input:

1000 500 1000000000
834798641 834798641 834798641 834798641 834798641 834798641 834798641 834798641 834798641 834798641 834798641 834798641 834798641 834798641 834798641 834798641 834798641 834798641 834798641 834798641 834798641 834798641 834798641 834798641 834798641 834798641 834798641 834798641 ...

output:

660805436

result:

ok single line: '660805436'

Test #27:

score: 0
Wrong Answer
time: 1ms
memory: 5844kb

input:

1000 200 1000000000
133968427 182543342 220610806 220610806 220610806 220610806 220610806 220610806 220610806 220610806 220610806 220610806 220610806 220610806 220610806 220610806 220610806 220610806 220610806 220610806 220610806 220610806 220610806 220610806 220610806 220610806 220610806 220610806 ...

output:

3251387752

result:

wrong answer 1st lines differ - expected: '3073193500', found: '3251387752'

Subtask #5:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

0%