Submission #634631

#TimeUsernameProblemLanguageResultExecution timeMemory
634631colossal_pepeDango Maker (JOI18_dango_maker)C++17
0 / 100
2070 ms340 KiB
#include <iostream> using namespace std; int n, m; string g[1001]; int solve(int i, int j) { int ret = 0; while (i < n and j > -1) { if (j + 2 < m and g[i][j] == 'R' and g[i][j + 1] == 'G' and g[i][j + 2] == 'W') { ret++; g[i][j] = g[i][j + 1] = g[i][j + 2] = '.'; } } while (i < n and j > -1) { if (i + 2 < n and g[i][j] == 'R' and g[i + 1][j] == 'G' and g[i + 2][j] == 'W') { ret++; g[i][j] = g[i + 1][j] = g[i + 2][j] = '.'; } } return ret; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> m; for (int i = 0; i < n; i++) { cin >> g[i]; } int ans = 0; for (int i = 0; i < m; i++) { ans += solve(0, i); } for (int i = 1; i < n; i++) { ans += solve(i, m - 1); } cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...