QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#353552#7988. 史莱姆工厂alpha1022WA 0ms6080kbC++141.2kb2024-03-14 11:06:242024-03-14 11:06:24

Judging History

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

  • [2024-03-14 11:06:24]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:6080kb
  • [2024-03-14 11:06:24]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

const ll inf = 0x3f3f3f3f3f3f3f3f;

const int N = 150;
const int M = 10;

int n, m, w;
int c[N + 5], a[N + 5], p[M];
ll f[N + 5][N + 5], g[N + 5][N + 5], h[N + 5][N + 5][M];

int main() {
  scanf("%d%d%d", &n, &m, &w);
  for (int i = 1; i <= n; ++i) scanf("%d", c + i);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  for (int i = 0; i < m - 1; ++i) scanf("%d", p + i);
  memset(f, -0x3f, sizeof f), memset(g, -0x3f, sizeof g), memset(h, -0x3f, sizeof h);
  for (int i = 0; i <= n; ++i) g[i + 1][i] = 0;
  for (int l = n; l; --l)
    for (int r = l; r <= n; ++r) {
      h[l][r][a[r]] = g[l][r - 1];
      for (int k = l; k + 1 < r; ++k)
        if (c[k] == c[r])
          for (int i = a[r]; i < m; ++i)
            h[l][r][i] = max(h[l][r][i], h[l][k][i - a[r]] + g[k + 1][r - 1]);
        for (int i = a[r]; i < m; ++i) g[l][r] = max(g[l][r], h[l][r][i] - w * (m - i) + p[0]);
        for (int k = l; k + 1 < r; ++k)
          if (c[k] == c[r])
            for (int i = a[k]; i < m; ++i)
              for (int j = max(a[r], m - i); j < m; ++j)
                g[l][r] = max(g[l][r], h[l][k][i] + h[k + 1][r][j] + p[i + j - m]);
    }
  printf("%lld\n",g[1][n]);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

-1

result:

ok single line: '-1'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 6080kb

input:

5 7 500
2 3 2 3 2
5 6 6 6 4
1000 900 800 400 200 50

output:

2300

result:

wrong answer 1st lines differ - expected: '1400', found: '2300'