QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#164895#7120. SoccerCrysflyCompile Error//C++171.7kb2023-09-05 14:28:132023-09-05 14:28:14

Judging History

你现在查看的是测评时间为 2023-09-05 14:28:14 的历史记录

  • [2024-04-28 07:29:24]
  • 管理员手动重测本题所有提交记录
  • [2023-09-05 14:28:14]
  • 评测
  • [2023-09-05 14:28:13]
  • 提交

answer

// what is matter? never mind. 
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2")
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
//#define int long long
#define ull unsigned long long
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

#define N 2005
#define inf 0x3f3f3f3f

int n,a[N][N];
int up[N][N],dw[N][N];

int f[N][N],len[N][N];
int ls[N],rs[N],st[N],tp,rt;

int biggest_stadium(int nn,vector<vector<int>>MP){
	n=nn; For(i,1,n)For(j,1,n)a[i][j]=MP[i-1][j-1];
	For(i,1,n)For(j,1,n)up[i][j]=(a[i][j]?0:up[i-1][j]+1);
	Rep(i,n,1)For(j,1,n)dw[i][j]=(a[i][j]?0:dw[i+1][j]+1);
//	For(i,1,n)For(j,1,n)cout<<up[i][j]<<" \n"[j==n];
	int res=0;
	For(i,1,n){
		int l=1,r;
		For(j,1,n)f[i][j]=-inf,ls[j]=rs[j]=0;
		for(;l<=n;l=r+1){
			r=l;
			while(r<n && a[i][r+1]==a[i][l])++r;
			if(a[i][l])continue;
			tp=0;
			For(j,l,r){
				while(tp&&dw[i][st[tp]]>dw[i][j]) ls[j]=st[tp--];
				if(tp) rs[st[tp]]=j; st[++tp]=j;
			}
			rt=st[1];
			auto dfs=[&](auto self,int u,int l,int r){
				assert(l<=r);
				f[i][u]=dw[i][u]*(r-l+1);
				len[i][u]=r-l+1;
				if(ls[u]) dfs(self,ls[u],l,u-1),f[i][u]=max(f[i][u],f[i][ls[u]]+(r-u+1)*dw[i][u]);
				if(rs[u]) dfs(self,rs[u],u+1,r),f[i][u]=max(f[i][u],f[i][rs[u]]+(u-l+1)*dw[i][u]);
				if(f[i-1][u]>=0) f[i][u]=max(f[i][u],f[i-1][u]+(len[i][u]-len[i-1][u])*dw[i][u]);
				res=max(res,f[i][u]);
			};
			dfs(dfs,rt,l,r);
		}
	}
	return res;
}

Details

answer.code: In lambda function:
answer.code:52:43: error: use of ‘dfs’ before deduction of ‘auto’
   52 |                                 if(ls[u]) dfs(self,ls[u],l,u-1),f[i][u]=max(f[i][u],f[i][ls[u]]+(r-u+1)*dw[i][u]);
      |                                           ^~~
answer.code:53:43: error: use of ‘dfs’ before deduction of ‘auto’
   53 |                                 if(rs[u]) dfs(self,rs[u],u+1,r),f[i][u]=max(f[i][u],f[i][rs[u]]+(u-l+1)*dw[i][u]);
      |                                           ^~~