QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#353550 | #7988. 史莱姆工厂 | alpha1022 | WA | 2ms | 6148kb | C++14 | 1.2kb | 2024-03-14 11:05:09 | 2024-03-14 11:05:09 |
Judging History
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'