# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
101734 | 2019-03-19T16:40:55 Z | DystoriaX | Collecting Mushrooms (NOI18_collectmushrooms) | C++14 | 58 ms | 8316 KB |
#include <bits/stdc++.h> using namespace std; int r, c, d, k; vector<vector<int> > pref; vector<vector<char> > mp; int main(){ scanf("%d%d%d%d", &r, &c, &d, &k); pref.resize(r + 2); mp.resize(r + 2); for(int i = 0; i <= r + 1; i++) pref[i].assign(c + 2, 0), mp[i].resize(c + 2); for(int i = 1; i <= r; i++){ for(int j = 1; j <= c; j++){ scanf(" %c", &mp[i][j]); if(mp[i][j] == 'S'){ int i1, i2, j1, j2; i1 = max(1, i - d); j1 = max(1, j - d); i2 = min(r + 1, i + d + 1); j2 = min(c + 1, j + d + 1); pref[i1][j1]++; pref[i1][j2]--; pref[i2][j1]--; pref[i2][j2]++; } } } int ans = 0; for(int i = 1; i <= r; i++){ for(int j = 1; j <= c; j++){ pref[i][j] += pref[i - 1][j] + pref[i][j - 1] - pref[i - 1][j - 1]; if(mp[i][j] == 'M') if(pref[i][j] >= k) ans++; } } printf("%d\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 4 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 384 KB | Output is correct |
10 | 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 | 3 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 | 14 ms | 1536 KB | Output is correct |
2 | Correct | 15 ms | 1536 KB | Output is correct |
3 | Correct | 17 ms | 1792 KB | Output is correct |
4 | Correct | 16 ms | 1584 KB | Output is correct |
5 | Correct | 21 ms | 1656 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 58 ms | 8284 KB | Output is correct |
2 | Correct | 36 ms | 8228 KB | Output is correct |
3 | Correct | 51 ms | 8184 KB | Output is correct |
4 | Correct | 40 ms | 8316 KB | Output is correct |
5 | Correct | 43 ms | 8292 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 4 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 3 ms | 384 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 3 ms | 384 KB | Output is correct |
14 | Correct | 3 ms | 384 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 14 ms | 1536 KB | Output is correct |
17 | Correct | 15 ms | 1536 KB | Output is correct |
18 | Correct | 17 ms | 1792 KB | Output is correct |
19 | Correct | 16 ms | 1584 KB | Output is correct |
20 | Correct | 21 ms | 1656 KB | Output is correct |
21 | Correct | 58 ms | 8284 KB | Output is correct |
22 | Correct | 36 ms | 8228 KB | Output is correct |
23 | Correct | 51 ms | 8184 KB | Output is correct |
24 | Correct | 40 ms | 8316 KB | Output is correct |
25 | Correct | 43 ms | 8292 KB | Output is correct |
26 | Correct | 38 ms | 4980 KB | Output is correct |
27 | Correct | 35 ms | 3328 KB | Output is correct |
28 | Correct | 55 ms | 3320 KB | Output is correct |
29 | Correct | 37 ms | 3320 KB | Output is correct |
30 | Correct | 46 ms | 4472 KB | Output is correct |