#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 3003;
vector<int> g[N];
int query(int u, int v, int l, int r) {
vector<int> used(N, 0);
auto used2 = used;
function<void(int)> dfsh = [&](int x) {
used[x] = true;
for (int e : g[x]) {
if (!used[e] && e >= l) dfsh(e);
}
};
function<void(int)> dfsw = [&](int x) {
used2[x] = true;
for (int e : g[x]) {
if (!used2[e] && e <= r) dfsw(e);
}
};
dfsh(u);
for (int i = l; i <= r; i++) {
if (used[i]) dfsw(i);
}
return used2[v];
}
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 Q = S.size();
std::vector<int> A(Q);
for (int i = 0; i < N; i++) {
g[X[i]].push_back(Y[i]);
g[Y[i]].push_back(X[i]);
}
for (int i = 0; i < Q; i++) {
A[i] = query(S[i], E[i], L[i], R[i]);
}
return A;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
166 ms |
21204 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |