제출 #532527

#제출 시각아이디문제언어결과실행 시간메모리
532527rk42745417Dango Maker (JOI18_dango_maker)C++17
13 / 100
1 ms312 KiB
#include <bits/stdc++.h> using namespace std; #define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(0); using ll = int64_t; using uint = uint32_t; using ull = uint64_t; using ld = long double; const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 7; const double EPS = 1e-8; const ll LINF = ll(4e18) + ll(2e15); static int LamyIsCute = []() { EmiliaMyWife return 48763; }(); signed main() { int n, m; cin >> n >> m; vector<string> arr(n); for(int i = 0; i < n; i++) cin >> arr[i]; vector<vector<bool>> ver(n, vector<bool>(m)); for(int i = 0; i + 2 < n; i++) for(int j = 0; j < m; j++) if(arr[i][j] == 'R' && arr[i + 1][j] == 'G' && arr[i + 2][j] == 'W') ver[i][j] = ver[i + 1][j] = ver[i + 2][j] = true; int ans = 0; vector<vector<bool>> used(n, vector<bool>(m)); for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { if(j + 2 < m && arr[i][j] == 'R' && arr[i][j + 1] == 'G' && arr[i][j + 2] == 'W') { if(ver[i][j] || ver[i][j + 1] || ver[i][j + 2]) continue; used[i][j] = used[i][j + 1] = used[i][j + 2] = true; ans++; } if(i >= 2 && arr[i][j] == 'W' && ver[i][j] && !used[i][j] && !used[i - 1][j] && !used[i - 2][j]) ans++; } } cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...