제출 #1289632

#제출 시각아이디문제언어결과실행 시간메모리
1289632omer_faruk_tuzunDango Maker (JOI18_dango_maker)C++20
13 / 100
1 ms584 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n,m,count1=0,count2=0; cin>>n>>m;//n satır sayısı m sütun sayısı char a[n][m], b[n][m]; for(int i=0;i<n;++i) { for(int j=0;j<m;++j) { cin>>a[i][j]; b[j][i]=a[i][j]; } } for(int i=0;i<n;++i) { for(int j=0;j<m-2;++j) { if (a[i][j]=='R'&&a[i][j+1]=='G'&&a[i][j+2]=='W') { ++count1; a[i][j]=' '; a[i][j+1]=' '; a[i][j+2]=' '; // ++j; // ++j; } } } for(int j=0;j<m;++j) { for (int i=0;i<n-2;++i) { if(a[i][j]=='R'&&a[i+1][j]=='G'&&a[i+2][j]=='W') { ++count1; // ++i; // ++i; } } } for(int i=0;i<n;++i) { for(int j=0;j<m-2;++j) { if (b[i][j]=='R'&&b[i][j+1]=='G'&&b[i][j+2]=='W') { ++count2; b[i][j]=' '; b[i][j+1]=' '; b[i][j+2]=' '; // ++j; // ++j; } } } for(int j=0;j<m;++j) { for (int i=0;i<n-2;++i) { if(b[i][j]=='R'&&b[i+1][j]=='G'&&b[i+2][j]=='W') { ++count2; // ++i; // ++i; } } } if (count1>count2) cout<<count1<<"\n"; else cout<<count2<<"\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...