QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#514959#2272. Formica SokobanicaAnotherDayofSun#Compile Error//Rust1.4kb2024-08-11 13:50:262024-08-11 13:50:26

Judging History

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

  • [2024-08-11 13:50:26]
  • 评测
  • [2024-08-11 13:50:26]
  • 提交

answer

#include<bits/stdc++.h>
#define For(i,j,k) for(int i=(j);i<=(k);i++)
#define foR(i,j,k) for(int i=(j);i>=(k);i--) 
#define vi vector<int>
#define pb push_back
#define pii pair<int,int> 
#define mkp make_pair
#define SZ(x) ((int)x.size())
#define int long long
using namespace std;
inline int read() {
	char c;int res=0;bool flag=0;
	while(c=getchar(),c<48)(c=='-')&&(flag=1);
	do res=(res<<3)+(res<<1)+(c^48);
	while(c=getchar(),c>47);
	flag&&(res=-res); return res; 
}
const int MN=1e6+5; 
int vis[MN],m,n,f[MN][2]; 
vi e[MN]; 
void dfs(int u,int fa) {
	int mx=-n-1,sum=0,fl=0; 
	for(auto v:e[u]) {
		if(v==fa) continue;
//		cerr<<u<<' '<<v<<endl;
		dfs(v,u); 
		mx=max(mx,f[v][1]-f[v][0]); sum+=f[v][0]; 
		fl|=!vis[v]; 	
	}
	cerr<<u<<' '<<fl<<endl;
	if(vis[u]) {
		f[u][1]=-n-1; 
		if(fl) f[u][0]=sum+mx+1;
		else f[u][0]=0;  	
	} else {
		if(fl) f[u][1]=sum+mx+1;
		else f[u][1]=0;  
		f[u][0]=sum+1; 	
	}
}

void works() {
	n=read(),m=read(); 
	For(i,2,n) {
		int u=read(),v=read();
		e[u].pb(v),e[v].pb(u); 	
	}
	For(i,1,m) {
		int x=read(); 
		vis[x]=1; 	
	}
	dfs(1,0); 
	For(i,1,n) {
		cerr<<f[i][0]<<' '<<f[i][1]<<endl;	
	}
	cout<<f[1][0]<<endl; 
}
signed main() {
	#ifdef wasa855
		freopen("pro.in","r",stdin); 
		freopen("pro.out","w",stdout); 
	#endif
	int T=1; 
	while(T--) {
		works(); 	
	}
	return 0; 	
}

Details

error: expected one of `!` or `[`, found `include`
 --> answer.code:1:2
  |
1 | #include<bits/stdc++.h>
  |  ^^^^^^^ expected one of `!` or `[`

error: aborting due to previous error