Submission #1158628

#TimeUsernameProblemLanguageResultExecution timeMemory
1158628rdabaDango Maker (JOI18_dango_maker)C++17
13 / 100
0 ms396 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define f first #define s second int main() { ios::sync_with_stdio(0); cin.tie(0); ll n,m,cnt=0; cin >> n >> m; char c[n+1][m+1]; for (int i=1; i<=n; i++) { for (int j=1; j<=m; j++) cin >> c[i][j]; } if (n<3 && m<3) return cout << 0,0; if (n>=3 && m<3) { for (int i=1; i<=n; i++) { for (int j=1; j<=m; j++) { if (c[i][j]=='R' && c[i+1][j]=='G' && c[i+2][j]=='W') cnt++,c[i][j]='0',c[i+1][j]='0',c[i+2][j]='0'; } } } if (n<3 && m>=3) { for (int i=1; i<=n; i++) { for (int j=1; j<=m; j++) { if (c[i][j]=='R' && c[i][j+1]=='G' && c[i][j+2]=='W') cnt++,c[i][j]='0',c[i][j+1]='0',c[i][j+2]='0'; } } } else { for (int i=1; i<=n; i++) { for (int j=1; j<=m; j++) { if (c[i][j]=='R' && c[i][j+1]=='G' && c[i][j+2]=='W') cnt++,c[i][j]='0',c[i][j+1]='0',c[i][j+2]='0'; } } for (int i=1; i<=n; i++) { for (int j=1; j<=m; j++) { if (c[i][j]=='R' && c[i+1][j]=='G' && c[i+2][j]=='W') cnt++,c[i][j]='0',c[i+1][j]='0',c[i+2][j]='0'; } } } cout << cnt; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...