이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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]) {
//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... |