QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#50552#1093. Bookcase Solidity UnitedAutumnKiteWA 3ms3884kbC++171.0kb2022-09-27 10:23:022022-09-27 10:23:09

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-27 10:23:09]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3884kb
  • [2022-09-27 10:23:02]
  • 提交

answer

#include <bits/stdc++.h>

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

  int n;
  std::cin >> n;
  std::vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    std::cin >> a[i];
  }
  int m = *std::max_element(a.begin(), a.end());

  using state = std::pair<int, int>;

  std::vector f(n + 1, std::vector(n + 1, std::vector<state>(2 * m + 1)));
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j <= 2 * m; ++j) {
      f[i][i][j] = state(0, -j);
    }
  }
  for (int l = n - 1; l >= 0; --l) {
    for (int r = l + 1; r <= n; ++r) {
      for (int k = 0; k <= 2 * m; ++k) {
        int v = std::max(k, a[l]);
        f[l][r][k] = state(n * m, 0);
        for (int i = l + 1; i <= r; ++i) {
          auto tmp = f[i][r][v / 2 - f[l + 1][i][0].second];
          tmp.first += v - k + f[l + 1][i][0].first;
          f[l][r][k] = std::min(f[l][r][k], tmp);
        }
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    std::cout << f[0][i][0].first << " \n"[i == n];
  }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3716kb

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

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: 1ms
memory: 3684kb

input:

1
1

output:

1

result:

ok 1 number(s): "1"

Test #4:

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

input:

1
150

output:

150

result:

ok 1 number(s): "150"

Test #5:

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

input:

2
80 82

output:

80 122

result:

ok 2 number(s): "80 122"

Test #6:

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

input:

2
4 76

output:

4 78

result:

ok 2 number(s): "4 78"

Test #7:

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

input:

2
32 124

output:

32 140

result:

ok 2 number(s): "32 140"

Test #8:

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

input:

2
2 119

output:

2 120

result:

ok 2 number(s): "2 120"

Test #9:

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

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

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

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

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

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

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

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

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

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

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

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

input:

9
56 76 105 140 90 25 1 54 80

output:

56 104 171 259 279 279 279 307 355

result:

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