# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
299661 | TMJN | Werewolf (IOI18_werewolf) | C++17 | 4042 ms | 21880 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;
vector<int>V[200000];
bool vis1[200000],vis2[200000];
vector<int>check_validity(int N,vector<int>X,vector<int>Y,vector<int>S,vector<int>E,vector<int>L,vector<int>R){
int Q=S.size();
for(int i=0;i<X.size();i++){
V[X[i]].push_back(Y[i]);
V[Y[i]].push_back(X[i]);
}
vector<int>res(Q,0);
for(int i=0;i<Q;i++){
for(int j=0;j<N;j++){
vis1[j]=vis2[j]=false;
}
queue<int>que;
que.push(S[i]);
while(!que.empty()){
int x=que.front();
que.pop();
if(vis1[x]||x<L[i])continue;
vis1[x]=true;
for(int j:V[x]){
que.push(j);
}
}
que.push(E[i]);
while(!que.empty()){
int x=que.front();
que.pop();
if(vis2[x]||x>R[i])continue;
vis2[x]=true;
for(int j:V[x]){
que.push(j);
}
}
for(int j=0;j<N;j++){
if(vis1[j]&&vis2[j])res[i]=1;
}
}
return res;
}
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... |