# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
885382 | eilouvre | Werewolf (IOI18_werewolf) | C++17 | 0 ms | 0 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 <iostream>
#include <vector>
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) {
std::vector<int> A(S.size(), 1); // Initialize with all trips as possible
std::vector<int> low_populated_cities(N + 1, 0);
std::vector<int> high_populated_cities(N + 1, 0);
for (int i = 0; i < L.size(); ++i) {
low_populated_cities[L[i]] += 1;
high_populated_cities[R[i] + 1] += 1;
}
for (int i = 1; i <= N; ++i) {
low_populated_cities[i] += low_populated_cities[i - 1];
high_populated_cities[i] += high_populated_cities[i - 1];
}
for (int i = 0; i < S.size(); ++i) {
int si = S[i];
int ei = E[i];
int low_count = low_populated_cities[ei] - low_populated_cities[si - 1];
int high_count = high_populated_cities[ei] - high_populated_cities[si - 1];
if (low_count > high_count) {
A[i] = 0;
}
}
return A;
}