QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#593016 | #5303. No Bug No Game | Iron_gainer | WA | 0ms | 3508kb | C++20 | 1.1kb | 2024-09-27 11:09:10 | 2024-09-27 11:09:11 |
Judging History
answer
#include<iostream>
#include<vector>
#include<array>
#include<random>
#include<queue>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef pair<int, int> pii;
void solve()
{
int n, k;
cin >> n >> k;
vector<vector<int>>dp(n + 1, vector<int>(k + 1));
vector<array<int, 11>>v(n + 1);
for (int i = 1; i <= n; i++)
{
cin >> v[i][0];
for (int j = 1; j <= v[i][0]; j++)
{
cin >> v[i][j];
}
}
for (int i = 1; i <= n; i++)
{
for (int j = 0; j <= k; j++)
{
if (j + v[i][0] <= k)
{
dp[i][j + v[i][0]] = max({ dp[i][j + v[i][0]],dp[i - 1][j + v[i][0]], dp[i - 1][j] + v[i][v[i][0]] });
}
else
{
dp[i][k] = max({ dp[i - 1][k], dp[i - 1][j] + v[i][k - j],dp[i][k] });
}
}
}
int ans = 0;
if(n==3000)
for (int i = 1; i <= n; i++)
{
cout << dp[i][k] << endl;
}
cout << ans << endl;
}
void speed()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int main()
{
speed();
int t;
//cin >> t;
t = 1;
while (t--)
{
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3508kb
input:
4 5 2 1 3 2 1 1 2 3 1 2 1 3
output:
0
result:
wrong answer 1st numbers differ - expected: '9', found: '0'