Submission #704489

#TimeUsernameProblemLanguageResultExecution timeMemory
704489GrandTiger1729Dango Maker (JOI18_dango_maker)C++17
13 / 100
1 ms324 KiB
#include <iostream> using namespace std; int main(){ cin.tie(0)->sync_with_stdio(0); int n, m; cin >> n >> m; string g[n]; for (int i = 0; i < n; i++) cin >> g[i]; bool vis[n][m]{}; int ans = 0; for (int i = 0; i < n; i++){ for (int j = 0; j < m; j++){ if (g[i][j] != 'W' || vis[i][j]) continue; if (i - 1 >= 0 && !vis[i - 1][j] && g[i - 1][j] == 'G' && \ i - 2 >= 0 && !vis[i - 2][j] && g[i - 2][j] == 'R'){ vis[i][j] = vis[i - 1][j] = vis[i - 2][j] = 1; ans++; } } for (int j = 0; j < m; j++){ if (g[i][j] != 'W' || vis[i][j]) continue; if (j - 1 >= 0 && !vis[i][j - 1] && g[i][j - 1] == 'G' && \ j - 2 >= 0 && !vis[i][j - 2] && g[i][j - 2] == 'R'){ vis[i][j] = vis[i][j - 1] = vis[i][j - 2] = 1; ans++; } } } cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...