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[3000];
void dfs(int x, vector<bool> &y, int z, int w){for(auto i:v[x]) if(z<=i&&i<=w&&!y[i]) y[i] = 1, dfs(i, y, z, w);}
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();
vector<int> a(q);
vector<bool> b(n), c(n);
for(int i=0;i<x.size();i++) v[x[i]].push_back(y[i]), v[y[i]].push_back(x[i]);
for(int i=0;i<q;i++)
{
fill(b.begin(), b.end(), 0), fill(c.begin(), c.end(), 0), b[s[i]] = c[e[i]] = 1, dfs(s[i], b, l[i], n-1), dfs(e[i], c, 0, r[i]);
for(int j=0;j<n;j++) a[i]|=b[j]&c[j];
}
return a;
}
Compilation message (stderr)
werewolf.cpp: In function 'std::vector<int> check_validity(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
werewolf.cpp:11:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<x.size();i++) v[x[i]].push_back(y[i]), v[y[i]].push_back(x[i]);
~^~~~~~~~~
# | 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... |