Submission #48553

#TimeUsernameProblemLanguageResultExecution timeMemory
48553ngkan146Dango Maker (JOI18_dango_maker)C++11
13 / 100
2 ms1048 KiB
#include <bits/stdc++.h> using namespace std; int n,m; string s[3005]; bool choosed[3004][3005]; bool up(int x,int y){ if (x < 3) return 0; if (s[x-2][y] == 'R' && s[x-1][y] == 'G' && s[x][y] == 'W' && !choosed[x-2][y] && !choosed[x-1][y] && !choosed[x][y]){ choosed[x-2][y] = choosed[x-1][y] = choosed[x][y] = 1; return 1; } return 0; } bool right(int x,int y){ if (y >= m-1) return 0; if (s[x][y] == 'R' && s[x][y+1] == 'G' && s[x][y+2] == 'W' && !choosed[x][y] && !choosed[x][y+1] && !choosed[x][y+2]){ choosed[x][y] = choosed[x][y+1] = choosed[x][y+2] = 1; return 1; } return 0; } int main(){ iostream::sync_with_stdio(0); cin >> n >> m; for(int i=1;i<=n;i++) cin >> s[i], s[i] = '0' + s[i]; int ans = 0; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++) ans += up(i,j); for(int j=1;j<=m;j++) ans += right(i,j); } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...