Submission #649586

#TimeUsernameProblemLanguageResultExecution timeMemory
649586ShahdMohamedCollecting Mushrooms (NOI18_collectmushrooms)C++17
60 / 100
2081 ms8756 KiB
///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<vector<ll>>frq(n,vector<ll>(m,0)); for (ll i=0; i<n; i++) { for (ll j=0; j<m; j++) { if (v[i][j]=='S') { for (ll k=max(0ll,i-x); k<=min(n-1,i+x); k++) { for (ll h=max(0ll,j-x); h<=min(m-1,j+x); h++) frq[k][h]++; } } } } ll ans=0; for (ll i=0; i<n; i++) { for (ll j=0; j<m; j++) { if (v[i][j]=='M' and frq[i][j]>=y)ans++; } } cout<<ans<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...