Submission #333491

# Submission time Handle Problem Language Result Execution time Memory
333491 2020-12-06T13:40:03 Z fadi57 Collecting Mushrooms (NOI18_collectmushrooms) C++14
0 / 100
3 ms 384 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mx=109;
const int mod= 998244353;
const ll inf=2*1e16+9;
int r,c,d,k;
int a[mx][mx];

ll pref[mx][mx];
int get(int i){


}
int main() {
cin>>r>>c>>d>>k;

    for(int i=1;i<=r;i++){

        for(int j=1;j<=c;j++){
            char x;cin>>x;
            if(x=='.'){
                a[i][j]=0;
            }else if(x=='M'){
            a[i][j]=1;
            }else{

 a[i][j]=2;
            }
        }
    }  for(int i=1;i<=r;i++){

        for(int j=1;j<=c;j++){

          if(a[i][j]==2){

                int uper=max(i-d,1);
          int left=max(j-d,1);
          // cout<<"hi"<<uper<<" "<<left<<endl;
          int right=j+d+1;
          int down=i+d+1;
            pref[uper][left]++;
           pref[uper][right]--;
              pref[down][left]--;
               pref[down][right]++;


          }
        }
    }
     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];
            }
        }int ans=0;
        for(int i=1;i<=r;i++){

        for(int j=1;j<=c;j++){
      //  cout<<pref[i][j]<<" ";
        ans+=(pref[i][j]==k&&a[i][j]==1);
        }
       // cout<<endl;
            }


cout<<ans;
}

Compilation message

mushrooms.cpp: In function 'int get(int)':
mushrooms.cpp:14:1: warning: no return statement in function returning non-void [-Wreturn-type]
   14 | }
      | ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -