#include <bits/stdc++.h>
#include "werewolf.h"
using namespace std;
const int N = 200'000 + 10;
vector<int> ad[N];
bool f[N][2], vt[N];
int mk[N];
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 = x.size(), q = s.size();
for (int i = 0; i < m; ++i) {
int u = x[i], v = y[i];
ad[u].push_back(v);
ad[v].push_back(u);
}
vector<int> answer;
for (int i = 0; i < q; ++i) {
for (int j = 0; j < n; ++j) mk[j] = (j < l[i] ? 0 : j <= r[i] ? 1 : 2);
memset(f, false, sizeof f);
memset(vt, false, sizeof vt);
queue<int> que;
f[s[i]][0] = vt[s[i]] = true;
que.push(s[i]);
while (que.size()) {
auto u = que.front(); que.pop();
for (const auto& v : ad[u]) {
if (vt[v]) continue;
vt[v] = true;
if (mk[v] <= 1) f[v][0] = f[u][0];
if (mk[v] >= 1) f[v][1] = (f[u][1] || mk[v] == 1);
if (f[v][0] || f[v][1]) que.push(v);
}
}
answer.push_back(f[e[i]][1]);
}
return vector(answer.rbegin(), answer.rend());
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
6232 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
6232 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4027 ms |
31116 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
6232 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |