# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1045486 | SiliconSquared | Werewolf (IOI18_werewolf) | C++17 | 4014 ms | 33740 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"
using namespace std;
#include <vector>
struct node{
int x;
vector<int> v;
bool g,h;
node(){}
};
vector<node> v;
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) {
v.resize(n);
for (int i=0;i<X.size();i++){
v[X[i]].v.push_back(Y[i]);
v[Y[i]].v.push_back(X[i]);
}
vector<int> q;
vector<int> z;
z.resize(S.size());
int p;
bool f;
for (int _=0;_<S.size();_++){
for (int i=0;i<n;i++){v[i].g=false;v[i].h=false;}
q.clear();
q.push_back(S[_]);
f=false;
while (!q.empty()){
p=q[q.size()-1];
q.pop_back();
if (v[p].g||p<L[_]){continue;}
v[p].g=true;
for (int i:v[p].v){
q.push_back(i);
}
}
q.clear();
q.push_back(E[_]);
while (!q.empty()){
p=q[q.size()-1];
q.pop_back();
if (v[p].h||p>R[_]){continue;}
if (v[p].g){f=true;break;}
v[p].h=true;
for (int i:v[p].v){
q.push_back(i);
}
}
z[_]=f;
}
return z;
}
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... |