QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#829475#8948. 报复社会275307894a#Compile Error//C++141.6kb2024-12-24 10:21:422024-12-24 10:21:44

Judging History

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

  • [2024-12-24 10:21:44]
  • 评测
  • [2024-12-24 10:21:42]
  • 提交

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=5e5+5,M=(1<<20)+5,K=1000+5,mod=998244353,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(28382);
#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){while(*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,p[N],col[N];
int vis[N];
int dfs(int msk){
	if(~vis[msk]) return vis[msk];
	int v=__builtin_popcount(msk);
	if(v==n-1){
		for(int i=1;i<=n;i++) if(~msk>>i-1&1) return col[i];
		return;
	}
	v&=1;
	for(int i=1;i<=n;i++) if(~msk>>i-1&1&&(i==1||msk>>p[i]-1&1)){
		if(dfs(msk|(1<<i))==v) return vis[msk]=v;
	}
	return vis[msk]=v^1;
}
void Solve(){
	scanf("%d",&n);
	for(int i=2;i<=n;i++) scanf("%d",&p[i]);
	for(int i=1;i<=n;i++) scanf("%d",&col[i]);
	fill(vis,vis+(1<<n),-1);
	puts(dfs(0)?"Bob":"Alice");
}
int main(){
	int t=1;
	scanf("%d",&t);
	while(t--) Solve();
	cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}

Details

answer.code: In function ‘int dfs(int)’:
answer.code:34:17: error: return-statement with no value, in function returning ‘int’ [-fpermissive]
   34 |                 return;
      |                 ^~~~~~
answer.code: In function ‘void Solve()’:
answer.code:43:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   43 |         scanf("%d",&n);
      |         ~~~~~^~~~~~~~~
answer.code:44:36: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   44 |         for(int i=2;i<=n;i++) scanf("%d",&p[i]);
      |                               ~~~~~^~~~~~~~~~~~
answer.code:45:36: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   45 |         for(int i=1;i<=n;i++) scanf("%d",&col[i]);
      |                               ~~~~~^~~~~~~~~~~~~~
answer.code: In function ‘int main()’:
answer.code:51:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   51 |         scanf("%d",&t);
      |         ~~~~~^~~~~~~~~