QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#716907#5303. No Bug No GamewangshengzheWA 0ms3684kbC++141.3kb2024-11-06 16:19:532024-11-06 16:19:53

Judging History

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

  • [2024-11-06 16:19:53]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3684kb
  • [2024-11-06 16:19:53]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<unordered_map>
#include<stack>
using namespace std;
#define int long long
#define scanf scanf_s
typedef pair<int, int> PII;

const double ef = 1e-12;
const int INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
#define rep(i,a, b) for(int i = a;i<=b;i++)
#define pre(i,a, b) for(int i = a;i>=b;i--)

int n, v;
int num[3005];
int p[3005][15];
int dp[3005][2];

signed main()
{
    cin >> n >> v;
    rep(i, 1, n)
    {
        cin >> num[i];
        rep(j, 1, num[i]) cin >> p[i][j];
    }
    memset(dp, -0x3f, sizeof dp);
    dp[0][0] = 0;
    rep(i, 1, n)
    {
        pre(k, v, 0)
        {
            if (k >= num[i])
            {
                dp[k][0] = max(dp[k][0], dp[k - num[i]][0] + p[i][num[i]]);
                dp[k][1] = max(dp[k][1], dp[k - num[i]][1] + p[i][num[i]]);
            }
            rep(j, 1, num[i]) {
                if (k >= j) dp[k][1] = max(dp[k][1], dp[k - j][0] + p[i][j]);
            }
        }
    }
    int ans = 0;
    rep(i, 1, n) 
        rep(k, 0, v) 
            ans = max(ans, dp[i][k]);
    cout << ans << endl;
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3684kb

input:

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

output:

6

result:

wrong answer 1st numbers differ - expected: '9', found: '6'