QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#587500#5303. No Bug No GamexiaofangerWA 37ms3932kbC++171.1kb2024-09-24 20:19:262024-09-24 20:19:28

Judging History

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

  • [2024-09-24 20:19:28]
  • 评测
  • 测评结果:WA
  • 用时:37ms
  • 内存:3932kb
  • [2024-09-24 20:19:26]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
inline int read(){
	int x=0,f=1; char s;
	while((s=getchar())<'0'||s>'9') if(s=='-') f=-1;
	while(s>='0'&&s<='9') x=(x<<3)+(x<<1)+(s^'0'),s=getchar();
	return x*f;
}
const int N=30005;
int n,k,p[N],w[N][15];
int f[N][2];
signed main(){
//	freopen("data.in","r",stdin);
//	freopen("ans.out","w",stdout);
	n=read(),k=read();
	int sum=0;
	for(int i=1;i<=n;++i){
		p[i]=read();
		sum+=p[i];
		for(int j=1;j<=p[i];++j){
			w[i][j]=read();
		}
	}
//	cout<<sum<<endl;
	//memset(f,-0x3f,sizeof(f));
	f[0][0]=0;
	for(int i=1;i<=n;++i){
		for(int j=0;j<=k;j++){
			if(j+p[i]<=k){
				f[j + p[i]][0]=max(f[j + p[i]][0],f[j][0]+w[i][p[i]]);
				f[j + p[i]][1]=max(f[j + p[i]][1],f[j][1]+w[i][p[i]]);
			}
			for(int o=p[i]-1;o>=1;--o){
				if(j + o<=k) f[j + o][1]=max(f[j+o][1],f[j+o][0]+w[i][o]);	
			}
		}
//		for(int j=1;j<=k;++j){
//			cout<<j<<' '<<f[j][0]<<' '<<f[j][1]<<endl;
//		}
	}
	int ans = 0;
	for(int i = 0 ; i <= k ; i++){
		ans = max({ans , f[i][0] , f[i][1]});
	}
	cout << ans << '\n';
	return 0;
}

详细

Test #1:

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

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: 3932kb

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:

299167000

result:

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