#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 |
1 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 4 |
2 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 4 |
3 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 4 |
4 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 12 |
5 |
Correct |
0 ms |
332 KB |
Correct answer: answer = 52 |
6 |
Correct |
1 ms |
296 KB |
Correct answer: answer = 210 |
7 |
Correct |
1 ms |
296 KB |
Correct answer: answer = 88 |
8 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 7696 |
9 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 1 |
10 |
Correct |
1 ms |
460 KB |
Correct answer: answer = 2374 |
11 |
Correct |
1 ms |
688 KB |
Correct answer: answer = 9502 |
12 |
Correct |
1 ms |
304 KB |
Correct answer: answer = 49 |
13 |
Correct |
1 ms |
460 KB |
Correct answer: answer = 151 |
14 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 7550 |
15 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 7220 |
16 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 7550 |
17 |
Correct |
1 ms |
676 KB |
Correct answer: answer = 10000 |
18 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 10000 |
19 |
Correct |
1 ms |
684 KB |
Correct answer: answer = 624 |
20 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 10000 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 1 |
2 |
Incorrect |
0 ms |
204 KB |
Wrong answer: output = 2, expected = 4 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 4 |
2 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 4 |
3 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 4 |
4 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 12 |
5 |
Correct |
0 ms |
332 KB |
Correct answer: answer = 52 |
6 |
Correct |
1 ms |
296 KB |
Correct answer: answer = 210 |
7 |
Correct |
1 ms |
296 KB |
Correct answer: answer = 88 |
8 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 7696 |
9 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 1 |
10 |
Correct |
1 ms |
460 KB |
Correct answer: answer = 2374 |
11 |
Correct |
1 ms |
688 KB |
Correct answer: answer = 9502 |
12 |
Correct |
1 ms |
304 KB |
Correct answer: answer = 49 |
13 |
Correct |
1 ms |
460 KB |
Correct answer: answer = 151 |
14 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 7550 |
15 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 7220 |
16 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 7550 |
17 |
Correct |
1 ms |
676 KB |
Correct answer: answer = 10000 |
18 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 10000 |
19 |
Correct |
1 ms |
684 KB |
Correct answer: answer = 624 |
20 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 10000 |
21 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 1 |
22 |
Incorrect |
0 ms |
204 KB |
Wrong answer: output = 2, expected = 4 |
23 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 4 |
2 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 4 |
3 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 4 |
4 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 12 |
5 |
Correct |
0 ms |
332 KB |
Correct answer: answer = 52 |
6 |
Correct |
1 ms |
296 KB |
Correct answer: answer = 210 |
7 |
Correct |
1 ms |
296 KB |
Correct answer: answer = 88 |
8 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 7696 |
9 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 1 |
10 |
Correct |
1 ms |
460 KB |
Correct answer: answer = 2374 |
11 |
Correct |
1 ms |
688 KB |
Correct answer: answer = 9502 |
12 |
Correct |
1 ms |
304 KB |
Correct answer: answer = 49 |
13 |
Correct |
1 ms |
460 KB |
Correct answer: answer = 151 |
14 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 7550 |
15 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 7220 |
16 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 7550 |
17 |
Correct |
1 ms |
676 KB |
Correct answer: answer = 10000 |
18 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 10000 |
19 |
Correct |
1 ms |
684 KB |
Correct answer: answer = 624 |
20 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 10000 |
21 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 1 |
22 |
Incorrect |
0 ms |
204 KB |
Wrong answer: output = 2, expected = 4 |
23 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 4 |
2 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 4 |
3 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 4 |
4 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 12 |
5 |
Correct |
0 ms |
332 KB |
Correct answer: answer = 52 |
6 |
Correct |
1 ms |
296 KB |
Correct answer: answer = 210 |
7 |
Correct |
1 ms |
296 KB |
Correct answer: answer = 88 |
8 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 7696 |
9 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 1 |
10 |
Correct |
1 ms |
460 KB |
Correct answer: answer = 2374 |
11 |
Correct |
1 ms |
688 KB |
Correct answer: answer = 9502 |
12 |
Correct |
1 ms |
304 KB |
Correct answer: answer = 49 |
13 |
Correct |
1 ms |
460 KB |
Correct answer: answer = 151 |
14 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 7550 |
15 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 7220 |
16 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 7550 |
17 |
Correct |
1 ms |
676 KB |
Correct answer: answer = 10000 |
18 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 10000 |
19 |
Correct |
1 ms |
684 KB |
Correct answer: answer = 624 |
20 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 10000 |
21 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 1 |
22 |
Incorrect |
0 ms |
204 KB |
Wrong answer: output = 2, expected = 4 |
23 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 4 |
2 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 4 |
3 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 4 |
4 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 12 |
5 |
Correct |
0 ms |
332 KB |
Correct answer: answer = 52 |
6 |
Correct |
1 ms |
296 KB |
Correct answer: answer = 210 |
7 |
Correct |
1 ms |
296 KB |
Correct answer: answer = 88 |
8 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 7696 |
9 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 1 |
10 |
Correct |
1 ms |
460 KB |
Correct answer: answer = 2374 |
11 |
Correct |
1 ms |
688 KB |
Correct answer: answer = 9502 |
12 |
Correct |
1 ms |
304 KB |
Correct answer: answer = 49 |
13 |
Correct |
1 ms |
460 KB |
Correct answer: answer = 151 |
14 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 7550 |
15 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 7220 |
16 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 7550 |
17 |
Correct |
1 ms |
676 KB |
Correct answer: answer = 10000 |
18 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 10000 |
19 |
Correct |
1 ms |
684 KB |
Correct answer: answer = 624 |
20 |
Correct |
1 ms |
588 KB |
Correct answer: answer = 10000 |
21 |
Correct |
1 ms |
204 KB |
Correct answer: answer = 1 |
22 |
Incorrect |
0 ms |
204 KB |
Wrong answer: output = 2, expected = 4 |
23 |
Halted |
0 ms |
0 KB |
- |