Submission #1115543

#TimeUsernameProblemLanguageResultExecution timeMemory
1115543staszic_ojuzDango Maker (JOI18_dango_maker)C++17
100 / 100
201 ms21856 KiB
#include <iostream> #include <vector> using namespace std; int main(){ int n, m; cin>>n>>m; vector<string> vect(n); for (int i=0;i<n;i++) cin>>vect[i]; vector<vector<bool>> used(n); for (int i=0;i<n;i++) used[i].resize(m); int out=0; for (int i=0;i<n;i++){ for (int j=0;j<m;j++){ if (used[i][j]) continue; if (j>=2){ if (vect[i][j]=='W'&&vect[i][j-1]=='G'&&vect[i][j-2]=='R'&&!used[i][j-1]&&!used[i][j-2]){ out++; used[i][j]=true; used[i][j-1]=true; used[i][j-2]=true; continue; } } if (i>0&&i<n-1){ if (vect[i][j]=='G'&&vect[i-1][j]=='R'&&vect[i+1][j]=='W'&&!used[i-1][j]&&!used[i+1][j]){ if (j>0&&vect[i][j-1]=='R'&&vect[i][j+1]=='W'&&!used[i][j-1]&&!used[i][j+1]){ out++; used[i][j]=true; used[i-1][j]=true; used[i][j+1]=true; continue; } out++; used[i][j]=true; used[i-1][j]=true; used[i+1][j]=true; } } } } cout<<out<<'\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...