QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#296842#7988. 史莱姆工厂Heltion#WA 0ms3852kbC++20959b2024-01-03 18:07:552024-01-03 18:07:55

Judging History

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

  • [2024-01-03 18:07:55]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3852kb
  • [2024-01-03 18:07:55]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#include "debug.h"
#else
#define debug(...) 417
#endif
using i64 = int64_t;
int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  cout << fixed << setprecision(20);
  int n, k, w;
  cin >> n >> k >> w;
  vector<int> m(n), c(n);
  for (int& ci : c) { cin >> ci; }
  for (int& mi : m) { cin >> mi; }
  vector<int> p(2 * k - 1);
  for (int i = k; i <= 2 * k - 2; i += 1) { cin >> p[i]; }
  vector f(n, vector<i64>(n, numeric_limits<i64>::min()));
  for (int j = 0; j < n; j += 1) {
    for (int i = j; i >= 0; i -= 1) {
      if (i == j) {
        f[i][j] = p[k] - w * (k - m[i]);
      } else if (c[i] == c[j]) {
        f[i][j] = p[m[i] + m[j]] + (i + 1 == j ? 0 : f[i + 1][j - 1]);
      }
      for (int k = i; k < j; k += 1) {
        f[i][j] = max(f[i][j], f[i][k] + f[k + 1][j]);
      }
      debug(i, j, f[i][j]);
    }
  }
  cout << f[0][n - 1];
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

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'