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;
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) {
int n = N, m = X.size(), q = S.size();
vector<vector<int>> v(n, vector<int>());
for (int i = 0; i < m; i++) v[X[i]].emplace_back(Y[i]), v[Y[i]].emplace_back(X[i]);
vector<int> ans(q);
for (int i = 0; i < q; i++) {
int cs = S[i], ce = E[i], cl = L[i], cr = R[i];
vector<int> fh(n), fw(n);
function<void(int, int)> dfs = [&] (int cur, int par) {
if (fh[cur] || cur < cl) return; fh[cur] = 1;
for (auto &e: v[cur]) dfs(e, cur);
};
function<void(int, int)> dfs2 = [&] (int cur, int par) {
if (fw[cur] || cur > cr) return; fw[cur] = 1;
for (auto &e: v[cur]) dfs2(e, cur);
};
dfs(cs, 0); dfs2(ce, 0);
for (int j = 0; j < n; j++) ans[i] |= (fh[j] & fw[j]);
}
return ans;
}
Compilation message (stderr)
werewolf.cpp: In lambda function:
werewolf.cpp:17:7: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
17 | if (fh[cur] || cur < cl) return; fh[cur] = 1;
| ^~
werewolf.cpp:17:40: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
17 | if (fh[cur] || cur < cl) return; fh[cur] = 1;
| ^~
werewolf.cpp: In lambda function:
werewolf.cpp:21:7: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
21 | if (fw[cur] || cur > cr) return; fw[cur] = 1;
| ^~
werewolf.cpp:21:40: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
21 | if (fw[cur] || cur > cr) return; fw[cur] = 1;
| ^~
# | 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... |