# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
741099 | almothana05 | Werewolf (IOI18_werewolf) | C++14 | 4067 ms | 26972 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;
int vis[2][300000];
vector<int>kinder[300000] , erg;
priority_queue<pair<int ,int> >q;
int bfs(int x , int en , int l , int r){
if(x >= l){
q.push({0 , x});
}
if(x <= r){
q.push({-1 , x});
}
while(q.size()){
int jet = q.top().second , cmp = q.top().first;
q.pop();
for(int i = 0 ; i < kinder[jet].size() ; i++){
int kind = kinder[jet][i];
if(cmp == -1){
if(kind <= r && vis[1][kind] == 0){
vis[1][kind] = 1;
q.push({-1 , kind});
}
}
else{
if(kind <= r && vis[1][kind] == 0 && (kind >= l || jet <= r)){
vis[1][kind] = 1;
q.push({-1 , kind});
}
if(kind >= l && vis[0][kind] == 0){
vis[0][kind] = 1;
q.push({0 , kind});
}
}
}
}
return vis[1][en] == 1;
}
vector<int> check_validity(int menge, vector<int> x, vector<int> y,
vector<int> s, vector<int> e,
vector<int> l, vector<int> r) {
if(x.size() == menge - 1){
}
for(int i = 0 ; i < menge ; i++){
kinder[x[i]].push_back(y[i]);
kinder[y[i]].push_back(x[i]);
}
for(int i = 0 ; i < s.size() ; i++){
for(int i = 0 ; i < menge ; i++){
vis[0][i] = 0;
vis[1][i] = 0;
}
int x = bfs(s[i] , e[i] , l[i] , r[i]);
erg.push_back(x);
}
return erg;
}
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... |