Submission #1115674

#TimeUsernameProblemLanguageResultExecution timeMemory
1115674staszic_ojuzDango Maker (JOI18_dango_maker)C++17
100 / 100
212 ms18144 KiB
#include <iostream> #include <vector> using namespace std; int main() { int n,m; cin >> n >> m; int wyn=0; vector<string> v(n+2); for (int64_t i=0; i<m+2; i++) v[0]+='#'; for (int64_t i=1; i<n+1; i++){ v[i]+='#'; string akt; cin >> akt; v[i]+=akt; v[i]+='#'; } for (int64_t i=0; i<m+2; i++) v[n+1]+='#'; //for (auto it:v) cout << it << '\n'; //cout << '\n'; for (int i=1; i<n+1; i++){ for (int j=1; j<m+1; j++){ //cout << i << ' ' << j << '\n'; if (v[i][j]=='G' and v[i][j-1]=='R' and v[i][j+1]=='W'){ if (v[i][j]=='G' and v[i-1][j]=='R' and v[i+1][j]=='W'){ v[i][j+1]=v[i-1][j]='#'; wyn++; //cout << i << ' ' << j << '\n'; } else{ //cout << i << ' ' << j << '\n'; v[i][j+1]=v[i][j-1]='#'; wyn++; //cout << i << ' ' << j << '\n'; } } else if (v[i][j]=='G' and v[i-1][j]=='R' and v[i+1][j]=='W'){ //cout << i << ' ' << j << '\n'; v[i][j]=v[i-1][j]=v[i+1][j]='#'; wyn++; //cout << i << ' ' << j << '\n'; } } } cout << wyn; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...