QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#735073#5303. No Bug No GameEMTzWA 7ms151688kbC++201.1kb2024-11-11 17:06:062024-11-11 17:06:06

Judging History

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

  • [2024-11-11 17:06:06]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:151688kb
  • [2024-11-11 17:06:06]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define ull unsigned long long
using namespace std;
typedef pair<int,int>PII;
typedef pair<int,PII>PPI;
typedef array<int,3>ar;
typedef __int128 i28; 
const int N=3000+100;
const int N1=1e9+9;
const int M=998244353;
const ull mask = std::chrono::steady_clock::now().time_since_epoch().count();
mt19937_64 rng(time(0));
const int M1=19260817;
const int base=233;
const int base1=131;
const int INF = 0x3f3f3f3f;
int val[N][N];
int p[N];
int dp[N][N];
void solve()
{
	int n,k;	
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>p[i];
		for(int j=1;j<=p[i];j++)
		{
			cin>>val[i][j];
		}
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=p[i];j<=k;j++)
		{
			dp[i][j]=max(dp[i-1][j],dp[i-1][j-p[i]]+val[i][p[i]]);
		}
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=p[i];j++)
		{
			if(k>=j)dp[n][k]=max(dp[n][k],dp[n][k-j]+val[i][j]);
		}
	}
	cout<<dp[n][k]<<"\n";
}
signed main()
{
	std::ios::sync_with_stdio(false);
	cout.tie(0);cin.tie(0);
	int _=1;
//	cin>>_;
	while(_--)
	{
		solve();
	}
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 5932kb

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: 7ms
memory: 151688kb

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:

68254546

result:

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