# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
223648 | DedMaxim | Aliens (IOI16_aliens) | 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.
long long take_photos(int n, int m, int k, const std::vector<int>& r, const std::vector<int>& c) {
std::vector<std::vector<bool>> used(m, std::vector<bool>(m, false));
for (int i = 0; i < n; ++i) {
int left = r[i], right = c[i];
if (left > right)
std::swap(left, right);
for (int x = left; x <= right; ++x) {
for (int y = left; y <= right; ++y) {
used[x][y] = true;
}
}
}
long long result = 0;
for (int x = 0; x != m; ++x) {
for (int y = 0; y != m; ++y) {
result += used[x][y];
}
}
return result;
}