Submission #742813

# Submission time Handle Problem Language Result Execution time Memory
742813 2023-05-17T02:51:43 Z riodsa Collecting Mushrooms (NOI18_collectmushrooms) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define pii pair<ll,ll>
ll r,c,d,w;
const int N = 5e5+1;
char b[N][N];
ll qs[N][N];
vector<pii> mush;

int main()
{
    cin >> r >> c >> d >> w;
    for(int i=1;i<=r;++i)
    {
        for(int j=1;j<=c;++j)
        {
            cin >> b[i][j];
            if(b[i][j] == 'S') qs[i][j] = 1;
            if(b[i][j] == 'M') mush.push_back({i,j});
        }
    }
    for(int i=1;i<=r;++i)
    {
        for(int j=1;j<=c;++j)
        {
            qs[i][j] += qs[i-1][j]+qs[i][j-1]-qs[i-1][j-1];
        }
    }
    ll cnt = 0;
    for(pii xy : mush)
    {
        ll x,y;
        tie(x,y) = xy;
        ll mx = min(r,x+d),mnx = max((ll)1,x-d);
        ll my = min(c,y+d),mny = max((ll)1,y-d);
        ll spring = qs[mx][my]-qs[mx][mny-1]-qs[mnx-1][my]+qs[mnx-1][mny-1];
        if(spring >= w) ++cnt;
    }
    cout << cnt;
    return 0;
}

Compilation message

/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status