제출 #634632

#제출 시각아이디문제언어결과실행 시간메모리
634632colossal_pepeDango Maker (JOI18_dango_maker)C++17
13 / 100
1 ms340 KiB
#include <iostream> using namespace std; int n, m; string g[1001]; int solve(int is, int js) { int ret = 0; int i = is, j = js; 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] = '.'; } i++, j--; } i = is, j = js; 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] = '.'; } i++, 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...