#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
using namespace std;
int main(){
ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
int n = 0, m = 0;
cin >> n >> m;
int dizi[n][m];
for(int i = 0; i < n; i++){
string tmp;
cin >> tmp;
for(int j = 0; j < m; j++){
if(tmp[j] == 'R'){
dizi[i][j] = 1;
}
else if(tmp[j] == 'G'){
dizi[i][j] = 2;
}
else{
dizi[i][j] = 3;
}
}
}
int cevap = 0;
for(int i = 0; i < n; i++){
for(int j = 0; j < 2; j++){
if(dizi[i][j] == 1 && dizi[i][j + 1] == 2 && dizi[i][j + 2] == 3){
cevap++;
dizi[i][j] = 0;
dizi[i][j + 1] = 0;
dizi[i][j + 2] = 0;
}
}
}
for(int j = 0; j < m; j++){
for(int i = 0; i < 2; i++){
if(dizi[i][j] == 1 && dizi[i + 1][j] == 2 && dizi[i + 2][j] == 3){
cevap++;
}
}
}
cout << cevap << endl;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |