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 "aliens.h"
#include <algorithm>
#include <cstring>
using namespace std;
using ll = long long;
struct point{
int r, c;
bool operator<(const point& p) const {
if(r != p.r) return r < p.r;
return c > p.c;
}
};
const int MAXM = 100, MAXN = 50;
bool a[MAXM][MAXM];
point interest[MAXN];
ll take_photos(int n, int m, int k, vector<int> r, vector<int> c) {
memset(a, false, sizeof(a));
for(int i=0; i<n; i++) interest[i] = { r[i], c[i] };
sort(interest, interest+n);
ll ret = 0;
for(point x : interest) {
if(a[x.r][x.c]) continue;
point p1 = { x.r, x.r }, p2 = { x.c, x.c };
if(p1.r > p2.r) { swap(p1.r, p2.r); swap(p1.c, p2.c); }
for(int i = p1.r; i <= p2.r; i++) {
for(int j=p1.c; j <= p2.c; j++) {
if(a[i][j]) continue;
a[i][j] = true;
ret++;
}
}
}
return ret;
}
# | 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... |