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 "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pi;
typedef vector<pi> pii;
typedef tuple<int,int,int> tii;
#define REP(i,a,b) for(int i=a;i<b;i++)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define LSOne(s) ((s)&(-s))
ll INF=1e18+10;
int inf=1e9+10;
ll M=1e9+7;
vii a;vi vis;
int bfs(int x,int y,int l,int r,bool k){
if(vis[x])return 0;
vis[x]=1;
if(x==y)return 1;
if(k&&x<l)return 0;
if(x>r)k=1;
bool flag=0;
for(auto u:a[x])flag|=bfs(u,y,l,r,k);
return flag;
}
std::vector<int> check_validity(int N, std::vector<int> X, std::vector<int> Y,
std::vector<int> S, std::vector<int> E,
std::vector<int> L, std::vector<int> R) {
int Q = S.size();
int m=X.size();
a.resize(N);
REP(i,0,m){
a[X[i]].PB(Y[i]);
a[Y[i]].PB(X[i]);
}
vi ans(Q);
REP(i,0,Q){
vis.clear();
vis.resize(N);
ans[i]=bfs(S[i],E[i],L[i],R[i],0);
}
return ans;
}
# | 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... |