제출 #1289618

#제출 시각아이디문제언어결과실행 시간메모리
1289618ey00Dango Maker (JOI18_dango_maker)C++20
0 / 100
1 ms584 KiB
#include <bits/stdc++.h> #define int long long using namespace std; char c[3000][3000]; int n,m; signed main(){ ios::sync_with_stdio(false); cin.tie(nullptr); cin>>n>>m; for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin>>c[i][j]; int ans=0; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ if(c[i][j]!='R') continue; if(j+2<m && c[i][j+1]=='G' && c[i][j+2]=='W'){ ans++; c[i][j]=c[i][j+1]=c[i][j+2]='A'; continue; } if(j-2>=0 && c[i][j-1]=='G' && c[i][j-2]=='W'){ ans++; c[i][j]=c[i][j-1]=c[i][j-2]='A'; continue; } if(i+2<n && c[i+1][j]=='G' && c[i+2][j]=='W'){ ans++; c[i][j]=c[i+1][j]=c[i+2][j]='A'; continue; } if(i-2>=0 && c[i-1][j]=='G' && c[i-2][j]=='W'){ ans++; c[i][j]=c[i-1][j]=c[i-2][j]='A'; continue; } } } cout<<ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...