Submission #1021260

# Submission time Handle Problem Language Result Execution time Memory
1021260 2024-07-12T16:29:19 Z lamagril Collecting Mushrooms (NOI18_collectmushrooms) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#deine int long long

using namespace std;

int32_t main(){
    cin.tie(NULL)->sync_with_stdio(false);
    int n,m,d,k; cin >> n >> m >> d >> k;
    char mp[n+5][m+5];
    int v[n+5][m+5],qs[n+5][m+5];
    for(int i=0 ; i<=n ; i++){
        for(int j=0 ; j<=m ; j++){
            v[i][j]=0;
            qs[i][j]=0;
        }
    }
    int ans=0;
    for(int i=1 ; i<=n ; i++){
        for(int j=1 ; j<=m ; j++){
            cin >> mp[i][j];
        }
    }
    for(int i=1 ; i<=n ; i++){
        for(int j=1 ; j<=m ; j++){
            if(mp[i][j]=='S'){
                v[max(1,i-d)][max(1,j-d)]++;
                if(j+d+1<=n) v[max(1,i-d)][j+d+1]--;
                if(i+d+1<=n) v[i+d+1][max(1,j-d)]--;
                if(i+d+1<=n && j+d+1<=n) v[i+d+1][j+d+1]++;
            }
        }
    }
    for(int i=1 ; i<=n ; i++){
        for(int j=1 ; j<=m ; j++){
            qs[i][j]=qs[i-1][j]+qs[i][j-1]-qs[i-1][j-1]+v[i][j];
        }
    }
    for(int i=1 ; i<=n ; i++){
        for(int j=1 ; j<=m ; j++){
            if(mp[i][j]=='M'){
                if(qs[i][j]>=k) ans++;
            }
        }
    }
    cout << ans << '\n';
}

Compilation message

mushrooms.cpp:2:2: error: invalid preprocessing directive #deine; did you mean #define?
    2 | #deine int long long
      |  ^~~~~
      |  define