#include <bits/stdc++.h>
using namespace std;
vector<vector<char>> dp;
int n, m, k;
int check(int l, int r) {
vector<int> mas(m + 1, 0);
for (int j = 1; j <= m; j++) {
for (int i = l; i <= r; i++) {
mas[j] |= dp[i][j];
}
}
return (count(mas.begin(), mas.end(), 0) == 1 ? 1 : 0);
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m >> k;
dp = vector<vector<char>> (1 + n, vector<char>(1 + m, 0));
for (int i = 0; i < k; i++) {
int a, b;
cin >> a >> b;
dp[a][b] = 1;
}
int ans = 0;
for (int l = 1; l <= n; l++) {
for (int r = l + m - 1; r <= n; r++) {
if (check(l, r)) {
ans ++;
}
}
}
cout << ans << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
312 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
288 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
312 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
308 KB |
Output isn't correct |
16 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
17 |
Correct |
1 ms |
320 KB |
Output is correct |
18 |
Correct |
0 ms |
204 KB |
Output is correct |
19 |
Correct |
4 ms |
316 KB |
Output is correct |
20 |
Correct |
4 ms |
308 KB |
Output is correct |
21 |
Correct |
4 ms |
204 KB |
Output is correct |
22 |
Incorrect |
4 ms |
204 KB |
Output isn't correct |
23 |
Correct |
6 ms |
204 KB |
Output is correct |
24 |
Correct |
4 ms |
204 KB |
Output is correct |
25 |
Execution timed out |
1579 ms |
332 KB |
Time limit exceeded |
26 |
Execution timed out |
1580 ms |
380 KB |
Time limit exceeded |
27 |
Execution timed out |
1560 ms |
364 KB |
Time limit exceeded |
28 |
Execution timed out |
1564 ms |
360 KB |
Time limit exceeded |
29 |
Execution timed out |
1554 ms |
428 KB |
Time limit exceeded |
30 |
Execution timed out |
1595 ms |
332 KB |
Time limit exceeded |
31 |
Execution timed out |
1572 ms |
1100 KB |
Time limit exceeded |
32 |
Execution timed out |
1584 ms |
844 KB |
Time limit exceeded |
33 |
Execution timed out |
1593 ms |
716 KB |
Time limit exceeded |
34 |
Execution timed out |
1590 ms |
716 KB |
Time limit exceeded |
35 |
Execution timed out |
1566 ms |
1476 KB |
Time limit exceeded |
36 |
Execution timed out |
1554 ms |
1348 KB |
Time limit exceeded |
37 |
Execution timed out |
1566 ms |
3276 KB |
Time limit exceeded |
38 |
Execution timed out |
1552 ms |
3620 KB |
Time limit exceeded |
39 |
Execution timed out |
1579 ms |
20288 KB |
Time limit exceeded |
40 |
Execution timed out |
1559 ms |
20288 KB |
Time limit exceeded |
41 |
Execution timed out |
1571 ms |
20420 KB |
Time limit exceeded |
42 |
Execution timed out |
1577 ms |
15940 KB |
Time limit exceeded |
43 |
Execution timed out |
1578 ms |
16068 KB |
Time limit exceeded |
44 |
Execution timed out |
1567 ms |
31044 KB |
Time limit exceeded |
45 |
Execution timed out |
1525 ms |
60396 KB |
Time limit exceeded |
46 |
Execution timed out |
1560 ms |
61204 KB |
Time limit exceeded |
47 |
Execution timed out |
1565 ms |
61184 KB |
Time limit exceeded |
48 |
Execution timed out |
1588 ms |
60956 KB |
Time limit exceeded |
49 |
Execution timed out |
1551 ms |
61088 KB |
Time limit exceeded |
50 |
Execution timed out |
1571 ms |
60244 KB |
Time limit exceeded |