제출 #1029742

#제출 시각아이디문제언어결과실행 시간메모리
1029742parsadox2Werewolf (IOI18_werewolf)C++17
15 / 100
204 ms19796 KiB
#include  <bits/stdc++.h>
#include "werewolf.h"

using namespace std;

const int N = 3e3 + 10;

int n , m , q;
bool st[N] , fn[N];
vector <int> adj[N];

void Dfsst(int v , int L)
{
	st[v] = true;
	for(auto u : adj[v])  if(!st[u] && u >= L)
		Dfsst(u , L);
}

void Dfsfn(int v , int R)
{
	fn[v] = true;
	for(auto u : adj[v])  if(!fn[u] && u <= R)
		Dfsfn(u , R);
}

vector <int> check_validity(int nn , vector <int> X , vector <int> Y , vector <int> S , vector <int> E , vector <int> L , vector <int> R )
{
	vector <int> res;
	n = nn;
	m = X.size();
	q = S.size();
	for(int i = 0 ; i < m ; i++)
	{
		adj[X[i]].push_back(Y[i]);
		adj[Y[i]].push_back(X[i]);
	}
	for(int i = 0 ; i < q ; i++)
	{
		for(int j = 0 ; j < n ; j++)
			st[j] = fn[j] = false;
		Dfsst(S[i] , L[i]);
		Dfsfn(E[i] , R[i]);
		bool flg = false;
		for(int j = L[i] ; j <= R[i] ; j++)  if(st[j] && fn[j])
			flg = true;
		res.push_back(flg);
	}
	return res;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...