# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
968815 | 2024-04-24T06:36:53 Z | duckindog | Werewolf (IOI18_werewolf) | C++17 | 106 ms | 27976 KB |
#include <bits/stdc++.h> #include "werewolf.h" using namespace std; const int N = 3'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; if (mk[s[i]] == 1) f[s[i]][1] = 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] || f[u][0] && mk[v] == 1); if (f[v][0] || f[v][1]) que.push(v); } } answer.push_back(f[e[i]][1]); } return answer; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 106 ms | 27976 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |