# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
777123 | welleyth | Werewolf (IOI18_werewolf) | C++17 | 4075 ms | 29852 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;
constexpr int N = (int)2e5+11;
vector<int> g[N];
vector<int> check_validity(int N,vector<int> X,vector<int> Y,vector<int> S,vector<int> E,vector<int> L,vector<int> R){
for(int i = 0; i < X.size(); i++){
g[X[i]].push_back(Y[i]);
g[Y[i]].push_back(X[i]);
}
int q = S.size();
int n = N;
bool can[2][n+1];
vector<int> ans;
for(int i = 0; i < q; i++){
memset(can,0,sizeof can);
queue<int> q;
q.push(S[i]);
can[0][S[i]] = 1;
while(!q.empty()){
int v = q.front();
q.pop();
for(auto& to : g[v]){
if(!can[0][to] && to >= L[i]){
can[0][to] = 1;
q.push(to);
}
}
}
q.push(E[i]);
can[1][E[i]] = 1;
while(!q.empty()){
int v = q.front();
q.pop();
for(auto& to : g[v]){
if(!can[1][to] && to <= R[i]){
can[1][to] = 1;
q.push(to);
}
}
}
bool ok = false;
for(int j = L[i]; j <= R[i]; j++)
ok |= can[0][j] && can[1][j];
ans.push_back(ok);
}
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... |