제출 #1195081

#제출 시각아이디문제언어결과실행 시간메모리
1195081Hamed_GhaffariDango Maker (JOI18_dango_maker)C++20
100 / 100
117 ms18036 KiB
#include <bits/stdc++.h> using namespace std; const int MXN = 3001; int n, m, ans; char a[MXN][MXN]; bool mark[MXN][MXN]; int32_t main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); cin >> n >> m; for(int i=0; i<n; i++) for(int j=0; j<m; j++) cin >> a[i][j]; for(int i=0; i<n; i++) for(int j=0; j<m; j++) if(a[i][j]=='R') { if(j+2<m && a[i][j+1]=='G' && a[i][j+2]=='W' && !mark[i][j+1] && !mark[i][j+2]) ans++; else if(i+2<n && a[i+1][j]=='G' && a[i+2][j]=='W') { if(0<=j-1 && j+1<m && a[i+1][j-1]=='R' && a[i+1][j+1]=='W' && !mark[i+1][j+1]) mark[i+1][j] = 1; else mark[i+2][j] = 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...