# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
138904 | Hassoony | Werewolf (IOI18_werewolf) | C++17 | 2738 ms | 19836 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"
//#include "grader.cpp"
using namespace std;
const int MX=3009;
int vis[MX][4],n;
vector<int>v[MX];
vector<int> check_validity(int N, vector<int> X, vector<int> Y,
vector<int> S, vector<int> E,
vector<int> L, vector<int> R){
n=N;
for(int i=0;i<X.size();i++){
v[X[i]].push_back(Y[i]);
v[Y[i]].push_back(X[i]);
}
vector<int>ans;
for(int i=0;i<S.size();i++){
for(int j=0;j<n;j++){
for(int k=0;k<2;k++){
vis[j][k]=0;
}
}
int s=S[i],e=E[i],l=L[i],r=R[i];
priority_queue<pair<int,int> >pq;
pq.push({0,s});
while(!pq.empty()){
int x=pq.top().second,type=pq.top().first;pq.pop();
if(type == 0){
if(x < l)continue;
}
if(type == 1){
if(x > r)continue;
}
if(vis[x][type])continue;
vis[x][type]=1;
if(type == 1){
for(auto pp:v[x])
pq.push({type,pp});
}
else{
for(auto pp:v[x]){
pq.push({type,pp});
}
if(x >= l && x <= r){
pq.push({1,x});
}
}
}
if(vis[e][1])ans.push_back(1);
else ans.push_back(0);
}
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... |