Submission #1018340

# Submission time Handle Problem Language Result Execution time Memory
1018340 2024-07-09T19:14:13 Z vjudge1 Werewolf (IOI18_werewolf) C++17
0 / 100
92 ms 9752 KB
#include "werewolf.h"
#include <bits/stdc++.h>
#define pb push_back
#define rep(a,b,c) for(int a=b; a<c; a++)
#define repa(a,b) for(auto a:b)

using namespace std;

vector<int> check_validity(int N, vector<int> X, vector<int> Y, vector<int> S, vector<int> E, vector<int> L, vector<int> R) {
	int Q=S.size();
	if(N>3000 || X.size()>6000 || Q>3000){
		return {};
	}
	vector<int> adj[N], A;
	rep(i,0,N-1){
		adj[X[i]].pb(Y[i]);
		adj[Y[i]].pb(X[i]);
	}
	queue<int> q;
	rep(i,0,Q){
		bool vis[N][2]{};
		q.push(S[i]);
		q.push(0);
		vis[S[i]][0]=true;
		while(q.size()){
			int u=q.front();
			q.pop();
			int z=q.front();
			q.pop();
			repa(v,adj[u]){
				if(!z && v>=L[i] && !vis[v][z]){
					vis[v][z]=true;
					q.push(v);
					q.push(z);
				}
				if(z && v<=R[i] && !vis[v][z]){
					vis[v][z]=true;
					q.push(v);
					q.push(z);
				}
				if(!z && L[i]<=v && R[i]>=v){
					vis[v][1]=true;
					q.push(v);
					q.push(1);
				}
			}
		}
		A.pb(vis[E[i]][1]);
	}
	return A;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 92 ms 9752 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -