# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
938134 | PagodePaiva | Werewolf (IOI18_werewolf) | C++17 | 231 ms | 19800 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>
#define N 3010
using namespace std;
int lt, rt;
int mark[N][2];
vector <int> g[N];
void dfs(int node, int typ){
if(mark[node][typ]) return;
mark[node][typ] = 1;
if(lt <= node and node <= rt and typ == 0) dfs(node, 1);
for(auto x : g[node]){
if(typ == 0){
if(x < lt) continue;
dfs(x, typ);
}
else{
if(x > rt) continue;
dfs(x, typ);
}
}
return;
}
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) {
for(int i = 0;i < x.size();i++){
int a = ++x[i], b = ++y[i];
g[a].push_back(b);
g[b].push_back(a);
}
vector <int> res;
for(int i = 0;i < s.size();i++){
int st = ++s[i], ed = ++e[i]; lt = ++l[i]; rt = ++ r[i];
memset(mark, 0, sizeof mark);
dfs(st, 0);
res.push_back(mark[ed][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... |