QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#353550#7988. 史莱姆工厂alpha1022WA 2ms6148kbC++141.2kb2024-03-14 11:05:092024-03-14 11:05:09

Judging History

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

  • [2024-03-14 11:05:09]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:6148kb
  • [2024-03-14 11:05:09]
  • 提交

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) f[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]);
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 6148kb

input:

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

output:

-4485090715960753727

result:

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