Submission #1049965

#TimeUsernameProblemLanguageResultExecution timeMemory
1049965vjudge1Dango Maker (JOI18_dango_maker)C++17
13 / 100
1 ms600 KiB
#include <iostream> #include <algorithm> using namespace std; int a[3000][3000]={-1}; long long ans = 0 ; int main() { int n,m; cin>>n>>m; for(int i = 2 ; i<n+2; i++){ for(int j = 2 ; j<m+2; j++){ char h; cin>>h; if(h=='R'){ a[i][j]=0; } else if(h=='G'){ a[i][j]=1; } else{ a[i][j]=2; } } } for(int i = 2 ; i<n+2; i++){ for(int j = 2 ;j<m+2; j++){ if(a[i][j]==0&&a[i][j+1]==1&&a[i][j+2]==2){ ans++; a[i][j]=-1; a[i][j+1]=-1; a[i][j+2]=-1; } else if(a[i][j]==0&&a[i+1][j]==1&&a[i+2][j]==2){ if(a[i+1][j-1]==0&&a[i+1][j+1]==2&&a[i+2][j-2]==0&&a[i+2][j-1]==1){ a[i+1][j-1]=-1; a[i+1][j+1]=-1; a[i+2][j-2]=-1; a[i+2][j-1]=-1; ans+=2; } else{ a[i][j]=-1; a[i+1][j]=-1; a[i+2][j]=-1; ans+=1; } } } } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...