| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1329893 | Zone_zonee | Collecting Mushrooms (NOI18_collectmushrooms) | C++20 | 18 ms | 25680 KiB |
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, m, sz, k;
cin >> n >> m >> sz >> k;
queue<pair<int, int>> q;
vector<vector<int>> sweep(n+10, vector<int>(m+10, 0));
for(int i = 1; i <= n; ++i){
for(int j = 1; j <= m; ++j){
char c;
cin >> c;
if(c == 'M') q.push({i, j});
if(c == 'S'){
sweep[max(1, i-sz)][max(1, j-sz)]++;
sweep[min(n+5, i+sz+1)][min(m+5, j+sz+1)]++;
sweep[max(1, i-sz)][min(m+5, j+sz+1)]--;
sweep[min(n+5, i+sz+1)][max(1, j-sz)]--;
}
}
}
for(int i = 1; i <= n; ++i){
for(int j = 1; j <= m; ++j){
sweep[i][j] += sweep[i-1][j] + sweep[i][j-1] - sweep[i-1][j-1];
}
}
int res = 0;
while(!q.empty()){
auto [x, y] = q.front(); q.pop();
if(sweep[x][y] >= k) res++;
}
cout << res << '\n';
}| # | 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... | ||||
