QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#360412#1093. Bookcase Solidity UnitedSolitaryDream#WA 4ms9916kbC++171.2kb2024-03-21 19:06:082024-03-21 19:06:08

Judging History

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

  • [2024-03-21 19:06:08]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:9916kb
  • [2024-03-21 19:06:08]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 72;
const int M = 305;
int n, a[N];
int f[N][N][M];
inline void UpdMin(int &x, int y) {
    x = min(x, y);
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    // n = 70;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        // a[i] = 150;
    }
    memset(f, 0x3f, sizeof f);
    for (int i = n; i; --i) {
        for (int k = a[i] / 2, val = a[i]; k < M; ++k, ++val) f[i][i][k] = val;
        for (int j = i + 1; j <= n; ++j) 
            for (int k = a[j] / 2; k < M; ++k) {
                UpdMin(f[i][j][k], f[i][j][k - 1] + 1);
                int p = 2 * k;
                if (p < M && p >= a[j]) UpdMin(f[i][j][k], f[i][j - 1][p]);
                p += 1;
                if (p < M && p >= a[j]) UpdMin(f[i][j][k], f[i][j - 1][p]);
                for (int ni = i; ni < j; ++ni)
                    for (int nk = a[ni] / 2; nk < k; ++nk) 
                        UpdMin(f[i][j][k], f[i][ni][nk] + f[ni + 1][j][k - nk]); 
            } 
    }
    for (int i = 1; i <= n; ++i) {
        cout << *min_element(f[1][i], f[1][i] + M) << ' ';
    }
    cout << endl;
    return 0;

}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 9792kb

input:

3
8 1 2

output:

8 8 8 

result:

ok 3 number(s): "8 8 8"

Test #2:

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

input:

5
10 3 3 8 4

output:

10 10 11 17 17 

result:

ok 5 number(s): "10 10 11 17 17"

Test #3:

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

input:

1
1

output:

1 

result:

ok 1 number(s): "1"

Test #4:

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

input:

1
150

output:

150 

result:

ok 1 number(s): "150"

Test #5:

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

input:

2
80 82

output:

80 122 

result:

ok 2 number(s): "80 122"

Test #6:

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

input:

2
4 76

output:

4 78 

result:

ok 2 number(s): "4 78"

Test #7:

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

input:

2
32 124

output:

32 140 

result:

ok 2 number(s): "32 140"

Test #8:

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

input:

2
2 119

output:

2 120 

result:

ok 2 number(s): "2 120"

Test #9:

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

input:

5
4 82 94 39 20

output:

4 84 137 137 137 

result:

ok 5 number(s): "4 84 137 137 137"

Test #10:

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

input:

7
85 49 150 12 50 94 113

output:

85 92 218 218 230 274 337 

result:

ok 7 numbers

Test #11:

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

input:

8
105 33 66 143 120 43 62 47

output:

105 105 138 246 295 295 327 343 

result:

ok 8 numbers

Test #12:

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

input:

9
43 123 72 93 32 65 43 71 81

output:

43 145 156 213 213 248 259 309 355 

result:

ok 9 numbers

Test #13:

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

input:

9
20 77 41 80 120 75 75 69 120

output:

20 87 90 150 230 245 283 315 401 

result:

ok 9 numbers

Test #14:

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

input:

9
148 134 18 2 12 130 107 12 122

output:

148 208 208 208 208 287 329 329 404 

result:

ok 9 numbers

Test #15:

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

input:

9
117 96 145 139 146 36 140 2 12

output:

117 155 252 319 396 396 481 481 481 

result:

ok 9 numbers

Test #16:

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

input:

9
49 95 10 14 38 45 22 141 109

output:

49 120 120 120 139 157 157 279 318 

result:

ok 9 numbers

Test #17:

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

input:

9
27 57 136 48 126 100 54 131 149

output:

27 71 179 179 261 298 302 406 490 

result:

ok 9 numbers

Test #18:

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

input:

9
108 10 9 81 64 110 86 121 47

output:

108 108 108 145 169 247 278 356 356 

result:

ok 9 numbers

Test #19:

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

input:

9
86 114 128 106 2 15 119 64 40

output:

86 157 228 270 270 270 345 350 358 

result:

ok 9 numbers

Test #20:

score: -100
Wrong Answer
time: 3ms
memory: 9788kb

input:

9
56 76 105 140 90 25 1 54 80

output:

56 104 171 259 279 279 279 306 355 

result:

wrong answer 8th numbers differ - expected: '305', found: '306'