This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
using namespace std;
const int MAXN = 3001;
int n, m;
int tablica[MAXN][MAXN];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
char p1;
for (int i = 0; n > i; i++) {
for (int j = 0; m > j; j++) {
cin >> p1;
if (p1 == 'R') {
tablica[i][j] = 1;
} else if (p1 == 'G') {
tablica[i][j] = 2;
} else {
tablica[i][j] = 3;
}
}
}
int wynik = 0;
for (int i = 0; n > i; i++) {
for (int j = 0; m > j; j++) {
//czy poziomo
if (((j + 2) < m) && tablica[i][j] == 1 && tablica[i][j + 1] == 2 && tablica[i][j + 2] == 3) {
if ((i > 0) && ((i + 1) < n) && tablica[i - 1][j + 1] == 1 && tablica[i][j + 1] == 2 && tablica[i + 1][j + 1] == 3) {
//cout << "problemy poziom " << i << " " << j << "\n";
wynik++;
tablica[i - 1][j + 1] = 0;
tablica[i][j + 1] = 0;
tablica[i][j + 2] = 0;
} else {
//cout << "ess poziomo " << i << " " << j << "\n";
wynik++;
tablica[i][j] = 0;
tablica[i][j + 1] = 0;
tablica[i][j + 2] = 0;
}
}
if ((i > 0) && (i + 1) < n && tablica[i - 1][j] == 1 && tablica[i][j] == 2 && tablica[i + 1][j] == 3) {
//cout << "ess pionowo " << i << " " << j << "\n";
wynik++;
tablica[i - 1][j] = 0;
tablica[i][j] = 0;
tablica[i + 1][j] = 0;
}
//czy pionowo
}
}
cout << wynik;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |