QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#361977#7988. 史莱姆工厂DoqeWA 1ms3620kbC++14876b2024-03-23 13:48:392024-03-23 13:48:39

Judging History

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

  • [2024-03-23 13:48:39]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3620kb
  • [2024-03-23 13:48:39]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=510;
int p[N];
int c[N],m[N];
long long G[N][12],F[N][N];
int n,k,w;
long long ask(long long w1,int m)
{
	int r=max(k-m,0);m+=r,w1-=r*w;
	return w1+p[m];
}
void ckmax(long long&A,long long B){(A<B)&&(A=B);}
int main()
{
	cin>>n>>k>>w;
	for(int i=1;i<=n;++i)cin>>c[i];
	for(int i=1;i<=n;++i)cin>>m[i];
	for(int i=k;i<=k*2-2;++i)cin>>p[i];
	for(int d=1;d<=n;++d)
		for(int l=1,r=d;r<=n;++l,++r)
		{
			memset(G,-0x3f,sizeof G);
			G[l][m[l]]=0;
			long long ans=ask(F[l+1][r],m[l]);
			for(int t=l+1;t<=r;++t)if(c[t]==c[l])
				for(int p=l;p<t;++p)if(c[p]==c[l])
					for(int s=1;s<k;++s)
					{
						ckmax(ans,
		ask(G[p][s]+F[p+1][t-1]+F[t+1][r],s+m[t]));
						if(s+m[t]<k)
							ckmax(G[t][s+m[t]],
						G[p][s]+F[p+1][t-1]);
					}
			F[l][r]=ans;
		}
	cout<<F[1][n]<<endl;
}

詳細信息

Test #1:

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

input:

4 5 6
2 1 2 3
3 3 3 4
5 7 9 11

output:

-1

result:

ok single line: '-1'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3620kb

input:

5 7 500
2 3 2 3 2
5 6 6 6 4
1000 900 800 400 200 50

output:

2300

result:

wrong answer 1st lines differ - expected: '1400', found: '2300'