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 <bits/stdc++.h>
#include "aliens.h"
using namespace std;
int g[50][50];
long long take_photos(int n, int m, int k, vector<int> r, vector<int> c) {
int ret = 0; if(n != k) exit(0);
for(int i = 0; i < n; i++) {
if(r[i] > c[i]) swap(r[i], c[i]);
for(int j = r[i]; j <= c[i]; j++) {
for(int k = r[i]; k <= c[i]; k++) {
if(!g[j][k]) ret++;
g[j][k] = 1;
}
}
} return ret;
}
#ifdef LOCAL_TESTING
int main() {
freopen("in", "r", stdin);
int n, m, k;
assert(3 == scanf("%d %d %d", &n, &m, &k));
std::vector<int> r(n), c(n);
for (int i = 0; i < n; i++) {
assert(2 == scanf("%d %d", &r[i], &c[i]));
}
long long ans = take_photos(n, m, k, r, c);
printf("%lld\n", ans);
return 0;
}
#endif
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |