QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#533683#9224. Express Evictionucup-team1004Compile Error//C++142.7kb2024-08-26 10:30:152024-08-26 10:30:16

Judging History

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

  • [2024-08-26 10:30:16]
  • 评测
  • [2024-08-26 10:30:15]
  • 提交

answer

#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(),x.end()
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=50+5,M=N*N*10+5,K=1e7+5,mod=998244353,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(263082);
#define Tp template<typename T>
#define Ts template<typename T,typename... Ar>
namespace Debug{
	Tp void _debug(char* f,T t){cerr<<f<<'='<<t<<endl;}
	Ts void _debug(char* f,T x,Ar... y){whXile(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
	#ifdef LOCAL
	#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
	#else 
	#define gdb(...) void()
	#endif
}using namespace Debug;
int n,m,k;char c[N];

struct yyy{int to,w,z;};struct ljb{int head=1,h[M];yyy f[M];void add(int x,int y,int z){f[++head]=(yyy){y,z,h[x]};h[x]=head;}}s;
void con(int x,int y,int z){s.add(x,y,z);s.add(y,x,0);}
int S,T;
namespace Dicnic{
	int d[M],Ns[M];
	int bfs(){
		queue<int> q;Me(d,0x3f);Mc(Ns,s.h);d[S]=0;q.push(S);
		while(!q.empty()){
			int x=q.front();q.pop();yyy tmp;
			for(int i=s.h[x];i;i=tmp.z){
				tmp=s.f[i];if(tmp.w&&d[tmp.to]>d[x]+1) q.push(tmp.to),d[tmp.to]=d[x]+1;
			}
		}
		return d[T]<INF;
	}
	int dfs(int x,int Sum){
		if(x==T) return Sum;yyy tmp;int k,pus=0;
		for(int &i=Ns[x];i;i=tmp.z){
			tmp=s.f[i];if(!tmp.w||d[tmp.to]!=d[x]+1) continue;k=dfs(tmp.to,min(tmp.w,Sum));
			if(!k) d[tmp.to]=INF;s.f[i].w-=k;s.f[i^1].w+=k;pus+=k;Sum-=k;if(!Sum) break;
		}
		return pus;
	}
	int calc(){int ans=0;while(bfs()) ans+=dfs(S,INF);return ans;}
}
int getid(int x,int y){return (x-1)*m+y;}
void Solve(){
	scanf("%d%d",&n,&m);
	S=0,T=n*m*3+1;
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) con(S,getid(i,j),n*m*4),con(getid(i,j),T,n*m*4);
	int cnt=0;
	for(int i=1;i<=n;i++){
		scanf("%s",c+1);
		for(int j=1;j<=m;j++)if(c[j]=='#'){
			cnt++;
			con(S,getid(i,j)+n*m,1);con(getid(i,j)+n*m*2,T,1);
			con(getid(i,j)+n*m,getid(i,j),1);con(getid(i,j),getid(i,j)+n*m*2,1);
			for(int ox:{1,-1}) for(int oy:{1,-1}){
				int x=i+(ox+oy)/2,y=j+(ox-oy)/2;
				int id=getid(x,y);
				if(y<1||x>n) id=T;
				if(x<1||y>m) id=S;
				if(id^S) con(getid(i,j)+n*m,id,1);
				if(id^T) con(id,getid(i,j)+n*m*2,1);
				gdb(i,j,x,y);
			}
		}
	}
	printf("%d\n",Dicnic::calc()-n*m*4*n*m-cnt);
}
int main(){
	int t=1;
	// scanf("%d",&t);
	while(t--) Solve();
	cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}

Details

answer.code: In function ‘void Debug::_debug(char*, T, Ar ...)’:
answer.code:20:45: error: there are no arguments to ‘whXile’ that depend on a template parameter, so a declaration of ‘whXile’ must be available [-fpermissive]
   20 |         Ts void _debug(char* f,T x,Ar... y){whXile(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
      |                                             ^~~~~~
answer.code:20:45: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
answer.code:20:60: error: expected ‘;’ before ‘cerr’
   20 |         Ts void _debug(char* f,T x,Ar... y){whXile(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
      |                                                            ^~~~~
      |                                                            ;
answer.code: In function ‘void Solve()’:
answer.code:56:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   56 |         scanf("%d%d",&n,&m);
      |         ~~~~~^~~~~~~~~~~~~~
answer.code:61:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   61 |                 scanf("%s",c+1);
      |                 ~~~~~^~~~~~~~~~