이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "aliens.h"
#include <bits/stdc++.h>
#ifdef local
#define debug(x...) qqbx(#x, x)
#define pary(x...) danb(#x, x)
#define safe std::cerr<<__PRETTY_FUNCTION__<<" line "<<__LINE__<<" safe\n"
template <typename ...T> void qqbx(const char *s, T ...a) {
int cnt = sizeof...(T);
((std::cerr << "\e[1;32m(" << s << ") = ("), ..., (std::cerr << a << (--cnt ? ", " : ")\e[0m\n")));
}
template <typename T> void danb(const char *s, T L, T R) {
std::cerr << "\e[1;32m[ " << s << " ] = [ ";
for (int f = 0; L != R; ++L)
std::cerr << (f++ ? ", " : "") << *L;
std::cerr << " ]\e[0m\n";
}
#else
#define debug(...) ((void)0)
#define pary(...) ((void)0)
#define safe ((void)0)
#endif // local
#define all(v) begin(v),end(v)
using namespace std;
using ll = long long;
const ll INF = 1e18;
const int maxn = 1025;
int pre[maxn][maxn];
long long take_photos(int n, int m, int k, std::vector<int> row, std::vector<int> col) {
for (int i = 0; i < n; i++) {
int l = row[i], r = col[i];
if (l > r) swap(l, r);
++r;
pre[l][l] += 1;
pre[l][r] -= 1;
pre[r][l] -= 1;
pre[r][r] += 1;
}
for (int i = 0; i < m; i++) {
for (int j = 0; j < m; j++) {
if (i) pre[i][j] += pre[i-1][j];
if (j) pre[i][j] += pre[i][j-1];
if (i && j) pre[i][j] -= pre[i-1][j-1];
}
}
int ans = 0;
for (int i = 0; i < m; i++) {
for (int j = 0; j < m; j++) {
if (pre[i][j])
++ans;
}
}
return ans;
}
# | 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... |