# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
600597 | jack715 | Werewolf (IOI18_werewolf) | C++14 | 4098 ms | 22772 KiB |
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>
#define ll long long
#define pb push_back
#define pp pop_back
#define mp make_pair
#define bb back
#define ff first
#define ss second
using namespace std;
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 Q = s.size();
vector<int> A(Q);
vector<int> path[n];
for (int i = 0; i < x.size(); i++) {
path[x[i]].pb(y[i]);
path[y[i]].pb(x[i]);
}
queue<int> bfs;
for (int i = 0; i < Q; i++) {
vector<int> used(n, 0);
bfs.push(s[i]), used[s[i]] = 1;
while (!bfs.empty()) {
int now = bfs.front();
bfs.pop();
for (int next : path[now]) {
if (used[next] || next < l[i]) continue;
used[next] = 1;
bfs.push(next);
}
}
for (int j = l[i]; j <= r[i]; j++) {
if (used[j]) bfs.push(j);
}
// cout << "WAY\n";
while (!bfs.empty()) {
int now = bfs.front();
bfs.pop();
for (int next : path[now]) {
if (used[next] || next > r[i]) continue;
used[next] = 1;
bfs.push(next);
}
}
// cout << "WUT\n";
if (used[e[i]] && e[i] <= r[i]) A[i] = 1;
}
return A;
}
/*
6 6 3
5 1
1 2
1 3
3 4
3 0
5 2
4 2 1 2
4 2 2 2
5 4 3 4
*/
Compilation message (stderr)
# | 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... |