# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1026156 | mariza | Werewolf (IOI18_werewolf) | C++14 | 4032 ms | 38552 KiB |
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;
typedef long long ll;
vector<ll> g[200000];
ll s, e, l, r;
bool vis[200000][2];
void dfs(ll curr, bool w){
if(vis[curr][w]) return;
vis[curr][w]=true;
bool ans=false;
if(l<=curr && curr<=r && !w) dfs(curr,true);
for(auto nxt:g[curr]){
if(!w && l<=nxt) dfs(nxt,false);
else if(w && nxt<=r) dfs(nxt,true);
}
}
vector<int> check_validity(int N, vector<int> X, vector<int> Y, vector<int> S, vector<int> E, vector<int> L, vector<int> R) {
for(ll i=0; i<X.size(); i++){
g[X[i]].push_back(Y[i]);
g[Y[i]].push_back(X[i]);
}
ll Q = S.size();
vector<int> a;
for(ll i=0; i<Q; i++){
s=S[i];
e=E[i];
l=L[i];
r=R[i];
for(ll j=0; j<N; j++){
vis[j][0]=false;
vis[j][1]=false;
}
dfs(s,false);
a.push_back(vis[e][1]);
}
return a;
}
Compilation message (stderr)
# | 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... |