QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#735077#5303. No Bug No GameEMTzWA 3ms151292kbC++201.2kb2024-11-11 17:09:342024-11-11 17:09:35

Judging History

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

  • [2024-11-11 17:09:35]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:151292kb
  • [2024-11-11 17:09:34]
  • 提交

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++)
		{
			if(dp[i-1][j-p[i]]==0&&j-p[i]!=0) continue;
			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) continue;
			if(dp[n][k-j]==0&&k!=j) continue;
			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();
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

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:

28799442

result:

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