# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1122195 | Luvidi | Werewolf (IOI18_werewolf) | C++17 | 4057 ms | 33524 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 "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn=2e5;
vector<int> adj[maxn];
bool v1[maxn],v2[maxn];
void dfs1(int v,int l){
v1[v]=1;
for(int u:adj[v])if(u>=l&&!v1[u])dfs1(u,l);
}
void dfs2(int v,int r){
v2[v]=1;
for(int u:adj[v])if(u<=r&&!v2[u])dfs2(u,r);
}
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) {
for(int i=0;i<x.size();i++){
adj[x[i]].push_back(y[i]);
adj[y[i]].push_back(x[i]);
}
vector<int> ans;
for(int i=0;i<S.size();i++){
int s=S[i],e=E[i],l=L[i],r=R[i];
for(int j=0;j<n;j++)v1[j]=v2[j]=0;
dfs1(s,l);
dfs2(e,r);
bool b=0;
for(int j=0;j<n;j++)b|=v1[j]&&v2[j];
ans.push_back(b);
}
return ans;
}
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... |