제출 #950658

#제출 시각아이디문제언어결과실행 시간메모리
950658ace5Dango Maker (JOI18_dango_maker)C++17
100 / 100
107 ms53600 KiB
#include <bits/stdc++.h> using namespace std; vector<vector<char>> a; vector<vector<int>> used; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n,m; cin >> n >> m; a.resize(n); used.resize(n); for(int i = 0;i < n;++i) { a[i].resize(m); used[i].resize(m); string s; cin >> s; for(int j = 0;j < m;++j) { a[i][j] = s[j]; } } int ans = 0; for(int i = 0;i < n;++i) { for(int j = 0;j < m;++j) { if(a[i][j] != 'R' || used[i][j]) continue; if(j < m-2 && a[i][j+1] == 'G' && a[i][j+2] == 'W' && used[i][j+1]+used[i][j+2] == 0) { used[i][j] = 1; used[i][j+1] = 1; used[i][j+2] = 1; ans++; } else if(i < n-2 && a[i+1][j] == 'G' && a[i+2][j] == 'W' && used[i+1][j]+used[i+2][j] == 0) { if(j > 0 && j < m-1 && a[i+1][j-1] == 'R' && a[i+1][j+1] == 'W' && used[i+1][j-1]+used[i+1][j+1] == 0) { used[i][j] = 1; used[i+1][j] = 1; used[i+1][j+1] = 1; } else { used[i][j] = 1; used[i+1][j] = 1; used[i+2][j] = 1; } ans++; } } } cout << ans << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...