Submission #1095930

#TimeUsernameProblemLanguageResultExecution timeMemory
1095930Lakshya108Dango Maker (JOI18_dango_maker)C++14
13 / 100
1 ms600 KiB
#include <bits/stdc++.h> using namespace std; void solve() { int n, m; cin >> n >> m; vector<string> grid(n); for(int i=0;i<n;i++) cin >> grid[i]; int ans = 0; for(int i=0;i<n;i++) { for(int j=0;j<m;j++) { if(i+5<n && grid[i][j]=='R' && grid[i+1][j] == 'R' && grid[i+2][j] == 'G' && grid[i+3][j]=='W' && grid[i+4][j] == 'G' && grid[i+5][j] == 'W'){ // cout<<99<<endl; grid[i][j] = grid[i+1][j] = grid[i+2][j] = grid[i+3][j] = grid[i+4][j] = grid[i+5][j] = 'P'; ans+=2; } else if(j+5<m && grid[i][j]=='R' && grid[i][j+1] == 'R' && grid[i][j+2] == 'G'&& grid[i][j+3]=='W' && grid[i][j+4] == 'G' && grid[i][j+5] == 'W'){ // cout<<99<<endl; grid[i][j] = grid[i][j+1] = grid[i][j+2] = grid[i][j+3] = grid[i][j+4] = grid[i][j+5] = 'P'; ans+=2; } else if(i + 2 < n && grid[i][j] == 'R' && grid[i+1][j] == 'G' && grid[i+2][j] == 'W') { grid[i][j] = 'P'; grid[i+1][j] = 'P'; grid[i+2][j] = 'P'; ans++; } else if(j + 2 < m && grid[i][j] == 'R' && grid[i][j+1] == 'G' && grid[i][j+2] == 'W') { grid[i][j] = 'P'; grid[i][j+1] = 'P'; grid[i][j+2] = 'P'; ans++; } } } cout << ans; } int main() { solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...