QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#164891#7120. SoccerCrysflyCompile Error//C++171.7kb2023-09-05 14:27:442024-04-28 07:29:15

Judging History

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

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

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(rt,l,r);
		}
	}
	return res;
}

详细

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]);
      |                                           ^~~
answer.code: In function ‘int biggest_stadium(int, std::vector<std::vector<int> >)’:
answer.code:57:28: error: no match for call to ‘(biggest_stadium(int, std::vector<std::vector<int> >)::<lambda(auto:28, int, int, int)>) (int&, int&, int&)’
   57 |                         dfs(rt,l,r);
      |                         ~~~^~~~~~~~
answer.code:48:34: note: candidate: ‘template<class auto:28> biggest_stadium(int, std::vector<std::vector<int> >)::<lambda(auto:28, int, int, int)>’
   48 |                         auto dfs=[&](auto self,int u,int l,int r){
      |                                  ^
answer.code:48:34: note:   template argument deduction/substitution failed:
answer.code:57:28: note:   candidate expects 4 arguments, 3 provided
   57 |                         dfs(rt,l,r);
      |                         ~~~^~~~~~~~