QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#396650#7988. 史莱姆工厂zyxawaCompile Error//C++141.4kb2024-04-22 23:01:002024-04-22 23:01:00

Judging History

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

  • [2024-04-22 23:01:00]
  • 评测
  • [2024-04-22 23:01:00]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll N=153,M=13;
ll n,m,w,a[N],b[N],c[N],f[N][N],fl[N][N][M],fr[N][N][M],g[N][N][M];
void Max(ll &x,ll y){if(x<y)x=y;}
int main()
{
	cin>>n>>m>>w;
	for(int i=1;i<=n;i++)cin>>c[i];
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=m;i<=2*m-2;i++)cin>>b[i];
	memset(f,-0x3f,sizeof(f));memset(g,-0x3f,sizeof(g));
	memset(fl,-0x3f,sizeof(fl));memset(fr,-0x3f,sizeof(fr));
	for(int i=1;i<=n;i++)
	    fl[i][i][a[i]]=fr[i][i][a[i]]=f[i][i-1]=0,f[i][i]=b[m]-w*(m-a[i]);
	for(int len=2;len<=n;len++)for(int l=1,r=len;r<=n;l++,r++)
	{
		if(c[l-1]!=c[r])Max(fr[l][r][a[r]],f[l][r-1]);
		for(int k=l;k<r;k++)if(c[k]==c[r]&&c[l-1]!=c[k])
		    for(int p=1;p+a[r]<m;p++)Max(fr[l][r][p+a[r]],fr[l][k][p]+f[k+1][r-1]);
		if(c[l]!=c[r+1])Max(fl[l][r][a[l]],f[l+1][r]);
		for(int k=l+1;k<=r;k++)if(c[k]==c[l]&&c[r+1]!=c[k])
		    for(int p=1;p+a[l]<m;p++)Max(fl[l][r][p+a[l]],fl[k][r][p]+f[l+1][k-1]);
		for(int k=l;k<=r;k++)if(c[k]!=c[l-1]&&c[k]!=c[r+1])
		    for(int p=1;p<m;p++)Max(f[l][r],f[l][k-1]+fl[k][r][p]+b[m]-w*(m-p));
		for(int k=l;k<=r;k++)if(c[k]!=c[l-1]&&c[k]!=c[r+1])
		    for(int p=1;p<m;p++)Max(f[l][r],fr[l][k][p]+f[k+1][r]+b[m]-w*(m-p));
		for(int k=l;k<r;k++){
				for(int i=1;i<m;i++){
					for(int j=1;j<m;j++){
						Max(f[l][r],fl[l][k][i]+fr[k+1][r][j]+p[i+j]);
					}
				}
			}
	}
	cout<<f[1][n];
}

Details

answer.code: In function ‘int main()’:
answer.code:33:87: error: ‘p’ was not declared in this scope
   33 |                                                 Max(f[l][r],fl[l][k][i]+fr[k+1][r][j]+p[i+j]);
      |                                                                                       ^