This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |