Submission #1095930

# Submission time Handle Problem Language Result Execution time Memory
1095930 2024-10-03T12:07:42 Z Lakshya108 Dango Maker (JOI18_dango_maker) C++14
13 / 100
1 ms 600 KB
    #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 time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 392 KB Output is correct
10 Correct 0 ms 600 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 392 KB Output is correct
10 Correct 0 ms 600 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Incorrect 0 ms 348 KB Output isn't correct
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 392 KB Output is correct
10 Correct 0 ms 600 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Incorrect 0 ms 348 KB Output isn't correct
21 Halted 0 ms 0 KB -