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>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#include "werewolf.h"
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 m = size(x), q = size(s);
vector<vector<int>> adj(n);
REP(i, m) {
adj[x[i]].emplace_back(y[i]);
adj[y[i]].emplace_back(x[i]);
}
vector<int> ans(q);
REP(i, q) {
vector<int> vis(n);
function<void(int, int, int, int)> dfs;
dfs = [&](int v, int a, int b, int t) {
for(int u : adj[v])
if(a <= u && u <= b && (vis[u] & t) == 0)
dfs(u, a, b, t);
};
dfs(s[i], l[i], n, 1);
dfs(s[i], 0, r[i], 2);
REP(j, n)
ans[i] |= vis[j] == 3;
}
return ans;
}
# | 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... |