This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
///LW M4 ACC HAZ3L GAMED
///YARAB WALA...I MEAN YARAB ACC
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
const ll mod = (ll) 1e9 + 7;
const ll even = (ll) 1e9 + 2;
const ll oo= (ll) 1e16;
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll n,m,x,y;
cin>>n>>m>>x>>y;
vector<vector<char>>v(n,vector<char>(m));
for (ll i=0; i<n; i++)
{
for (ll j=0; j<m; j++)
cin>>v[i][j];
}
vector<ll>frq(m+1);
for (ll i=0; i<n; i++)
{
for (ll j=0; j<m; j++)
{
if (v[i][j]=='S')
{
frq[max(0ll,j-x)]++;
frq[min(m,j+x+1)]--;
}
}
}
for (ll i=1; i<=m; i++)
frq[i]+=frq[i-1];
ll ans=0;
for (ll i=0; i<n; i++)
{
for (ll j=0; j<m; j++)
{
if (v[i][j]=='M' and frq[j]>=y)ans++;
}
}
cout<<ans<<endl;
return 0;
}
# | 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... |