# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
131237 | FedericoS | Collecting Mushrooms (NOI18_collectmushrooms) | C++14 | 79 ms | 27640 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <cstring>
using namespace std;
int R,C,D,K;
int ans;
int main(){
cin>>R>>C>>D>>K;
char A[R+10][C+10];
int M[R+10][C+10];
memset(A, 0, sizeof A);
memset(M, 0, sizeof M);
for(int i=1;i<R+1;i++)
for(int j=1;j<C+1;j++)
cin>>A[i][j];
for(int i=1;i<R+2;i++)
for(int j=1;j<C+2;j++)
M[i][j]=(A[i][j]=='S')+M[i-1][j]+M[i][j-1]-M[i-1][j-1];
for(int i=1;i<R+1;i++)
for(int j=1;j<C+1;j++)
if(A[i][j]=='M')
ans+=K<=(M[min(R+1,i+D)][min(C+1,j+D)]-M[max(0,i-D-1)][min(C+1,j+D)]-M[min(R+1,i+D)][max(0,j-D-1)]+M[max(0,i-D-1)][max(0,j-D-1)]);
cout<<ans;
# | 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... |