Submission #572690

#TimeUsernameProblemLanguageResultExecution timeMemory
572690DevigoCollecting Mushrooms (NOI18_collectmushrooms)C++14
60 / 100
2080 ms5352 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair const int siz = 0; const int mod = 0; int main() { ios::sync_with_stdio(0); cin.tie(0); int r, c, d, k; cin >> r >> c >> d >> k; vector<string> v(r); for(int i=0; i<r; i++) { cin >> v[i]; } //for(int i=0; i<r; i++) { // for(int j=0; j<c; j++) { // cout << v[i][j] << " "; // } // cout << "\n"; //} vector<vector<int>> cnt(r,vector<int>(c,0)); for(int i=0; i<r; i++) { for(int j=0; j<c; j++) { if(v[i][j] == 'S') { int x,y,z,e; //cout << "c\n"; x = max(0,i-d); y = max(0,j-d); z = min(r-1,i+d); e = min(c-1,j+d); for(int sp=x; sp<=z; sp++) { for(int ep=y; ep<=e; ep++) { cnt[sp][ep]++; } } } } } //for(int i=0; i<r; i++) { // for(int j=0; j<c; j++) { // cout << cnt[i][j] << " "; // } // cout << endl; //} int cn = 0; for(int i=0; i<r; i++) { for(int j=0; j<c; j++) { if(v[i][j] == 'M' && cnt[i][j] >= k) cn++; } } cout << cn << "\n"; 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...