Submission #1289699

#TimeUsernameProblemLanguageResultExecution timeMemory
1289699hasandasDango Maker (JOI18_dango_maker)C++20
13 / 100
1 ms576 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); long long n,m; cin >> n >> m; vector<string> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; } vector<vector<bool>> a(n, vector<bool>(m, false)); int ans = 0; for (int i = 0;i<n;i++) { for (int j = 0;j<m;j++) { if ((i+j) % 2 == 0) { if (j<m-2 && v[i][j] == 'R' && v[i][j+1] == 'G' && v[i][j+2] == 'W') { if (!a[i][j] && !a[i][j+1] && !a[i][j+2]) { a[i][j] = true; a[i][j+1] = true; a[i][j+2] = true; ans++; continue; } } if (i<n-2 && v[i][j] == 'R' && v[i+1][j] == 'G' && v[i+2][j] == 'W') { if (!a[i][j] && !a[i+1][j] && !a[i+2][j]) { a[i][j] = true; a[i+1][j] = true; a[i+2][j] = true; ans++; } } } else { if (i<n-2 && v[i][j] == 'R' && v[i+1][j] == 'G' && v[i+2][j] == 'W') { if (!a[i][j] && !a[i+1][j] && !a[i+2][j]) { a[i][j] = true; a[i+1][j] = true; a[i+2][j] = true; ans++; continue; } } if (j<m-2 && v[i][j] == 'R' && v[i][j+1] == 'G' && v[i][j+2] == 'W') { if (!a[i][j] && !a[i][j+1] && !a[i][j+2]) { a[i][j] = true; a[i][j+1] = true; a[i][j+2] = true; ans++; } } } } } cout << ans << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...