# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
109133 | 2019-05-04T15:32:41 Z | PeppaPig | Collecting Mushrooms (NOI18_collectmushrooms) | C++14 | 26 ms | 13444 KB |
#include <bits/stdc++.h> #define pii pair<int, int> #define x first #define y second using namespace std; const int N = 1e6+5; int R, C, d, k, ans; vector<pii> mush; int main() { scanf("%d %d %d %d", &R, &C, &d, &k); vector<vector<int> > A(R+2, vector<int>(C+2)); for(int i = 1; i <= R; i++) { char S[N]; scanf(" %s", S+1); for(int j = 1; j <= C; j++) { if(S[j] == 'M') mush.emplace_back(i, j); else if(S[j] == 'S') { int tr = max(i - d, 1), tc = max(j - d, 1); int br = min(i + d + 1, R + 1), bc = min(j + d + 1, C + 1); ++A[tr][tc], --A[tr][bc], --A[br][tc], ++A[br][bc]; } } } for(int i = 1; i <= R; i++) for(int j = 1; j <= C; j++) A[i][j] += A[i-1][j] + A[i][j-1] - A[i-1][j-1]; for(pii m : mush) if(A[m.x][m.y] >= k) ++ans; printf("%d\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 3 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 3 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 3 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 3 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 640 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 3 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1152 KB | Output is correct |
2 | Correct | 4 ms | 1152 KB | Output is correct |
3 | Correct | 7 ms | 1280 KB | Output is correct |
4 | Correct | 4 ms | 1152 KB | Output is correct |
5 | Correct | 5 ms | 1152 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 10076 KB | Output is correct |
2 | Correct | 23 ms | 13396 KB | Output is correct |
3 | Correct | 26 ms | 13444 KB | Output is correct |
4 | Correct | 21 ms | 10844 KB | Output is correct |
5 | Correct | 24 ms | 13404 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 3 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 3 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 3 ms | 640 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 3 ms | 384 KB | Output is correct |
16 | Correct | 4 ms | 1152 KB | Output is correct |
17 | Correct | 4 ms | 1152 KB | Output is correct |
18 | Correct | 7 ms | 1280 KB | Output is correct |
19 | Correct | 4 ms | 1152 KB | Output is correct |
20 | Correct | 5 ms | 1152 KB | Output is correct |
21 | Correct | 19 ms | 10076 KB | Output is correct |
22 | Correct | 23 ms | 13396 KB | Output is correct |
23 | Correct | 26 ms | 13444 KB | Output is correct |
24 | Correct | 21 ms | 10844 KB | Output is correct |
25 | Correct | 24 ms | 13404 KB | Output is correct |
26 | Correct | 19 ms | 4852 KB | Output is correct |
27 | Correct | 13 ms | 4864 KB | Output is correct |
28 | Correct | 12 ms | 3992 KB | Output is correct |
29 | Correct | 22 ms | 4080 KB | Output is correct |
30 | Correct | 15 ms | 5624 KB | Output is correct |