QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#582887#5303. No Bug No GamelongyinWA 37ms3896kbC++20948b2024-09-22 17:42:402024-09-22 17:42:44

Judging History

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

  • [2024-09-22 17:42:44]
  • 评测
  • 测评结果:WA
  • 用时:37ms
  • 内存:3896kb
  • [2024-09-22 17:42:40]
  • 提交

answer

#include <bits/stdc++.h>
//#define int long long
#define endl "\n"
using namespace std;

using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int N = 3e3 + 5;

int dp[N][2];
int val[N][20];
int pri[N];

int main() {
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

    int n, k;
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
        cin >> pri[i];
        for (int j = 1; j <= pri[i]; j++) {
            cin >> val[i][j];
        }
    }

    for (int i = 1; i <= n; i++) {
        for (int j = k; j >= pri[i]; j--) {
            dp[j][0] = max(dp[j][0], dp[j - pri[i]][0] + val[i][pri[i]]);
            dp[j][1] = max(dp[j][1], dp[j - pri[i]][0] + val[i][pri[i]]);
            for (int l = j; l >= j - pri[i]; l--) {
                dp[j][1] = max(dp[j][1], dp[j][0] + val[i][j - l]);
            }
        }
    }
    cout << max(dp[k][0], dp[k][1]) << endl;

    return 0;
}

詳細信息

Test #1:

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

input:

4 5
2 1 3
2 1 1
2 3 1
2 1 3

output:

9

result:

ok 1 number(s): "9"

Test #2:

score: -100
Wrong Answer
time: 37ms
memory: 3896kb

input:

3000 3000
10 70562 30723 79371 82224 63977 3362 26909 96449 48163 66159
4 18007 33590 80674 91139
4 10304 31694 70745 50656
10 63090 17226 13187 73881 38137 15237 55750 82751 75854 39658
8 95640 66120 87735 36388 44046 92415 6952 94772
9 60565 27904 98726 87052 35768 25453 14563 34273 92501
10 66332...

output:

68262670

result:

wrong answer 1st numbers differ - expected: '68279788', found: '68262670'