제출 #899785

#제출 시각아이디문제언어결과실행 시간메모리
899785ForgottenDestinyDango Maker (JOI18_dango_maker)C++17
13 / 100
1 ms348 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n,m; cin>>n>>m; vector<string> graph(n); vector<vector<bool>> visited(n,vector<bool>(m)); for (int i=0;i<n;i++){ cin>>graph[i]; } long long res=0; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ if(j>0&&j<m-1&&graph[i][j]=='G'&&graph[i][j-1]=='R'&&graph[i][j+1]=='W'&&!visited[i][j-1]&&!visited[i][j]&&!visited[i][j+1]) { res++; visited[i][j]=true; visited[i][j-1]=true; visited[i][j+1]=true; } else if (i>0&&i<n-1&&graph[i][j]=='G'&&graph[i-1][j]=='R'&&graph[i+1][j]=='W'&&!visited[i-1][j]&&!visited[i][j]&&!visited[i+1][j]){ res++; visited[i][j]=true; visited[i-1][j]=true; visited[i+1][j]=true; } } } cout<<res<<"\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...