#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 |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
1 ms |
336 KB |
Output is correct |
21 |
Correct |
1 ms |
336 KB |
Output is correct |
22 |
Correct |
1 ms |
336 KB |
Output is correct |
23 |
Correct |
1 ms |
336 KB |
Output is correct |
24 |
Correct |
1 ms |
336 KB |
Output is correct |
25 |
Correct |
1 ms |
336 KB |
Output is correct |
26 |
Correct |
1 ms |
336 KB |
Output is correct |
27 |
Correct |
1 ms |
504 KB |
Output is correct |
28 |
Correct |
1 ms |
336 KB |
Output is correct |
29 |
Correct |
1 ms |
336 KB |
Output is correct |
30 |
Correct |
1 ms |
512 KB |
Output is correct |
31 |
Correct |
1 ms |
336 KB |
Output is correct |
32 |
Correct |
1 ms |
504 KB |
Output is correct |
33 |
Correct |
1 ms |
336 KB |
Output is correct |
34 |
Correct |
1 ms |
384 KB |
Output is correct |
35 |
Correct |
1 ms |
336 KB |
Output is correct |
36 |
Correct |
1 ms |
336 KB |
Output is correct |
37 |
Correct |
1 ms |
336 KB |
Output is correct |
38 |
Correct |
1 ms |
336 KB |
Output is correct |
39 |
Correct |
1 ms |
336 KB |
Output is correct |
40 |
Correct |
1 ms |
336 KB |
Output is correct |
41 |
Correct |
1 ms |
336 KB |
Output is correct |
42 |
Correct |
1 ms |
592 KB |
Output is correct |
43 |
Correct |
1 ms |
336 KB |
Output is correct |
44 |
Correct |
1 ms |
336 KB |
Output is correct |
45 |
Correct |
1 ms |
336 KB |
Output is correct |
46 |
Correct |
1 ms |
336 KB |
Output is correct |
47 |
Correct |
1 ms |
336 KB |
Output is correct |
48 |
Correct |
1 ms |
336 KB |
Output is correct |
49 |
Correct |
1 ms |
336 KB |
Output is correct |
50 |
Correct |
1 ms |
336 KB |
Output is correct |
51 |
Correct |
1 ms |
336 KB |
Output is correct |
52 |
Correct |
1 ms |
336 KB |
Output is correct |
53 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
1 ms |
336 KB |
Output is correct |
21 |
Correct |
1 ms |
336 KB |
Output is correct |
22 |
Correct |
1 ms |
336 KB |
Output is correct |
23 |
Correct |
1 ms |
336 KB |
Output is correct |
24 |
Correct |
1 ms |
336 KB |
Output is correct |
25 |
Correct |
1 ms |
336 KB |
Output is correct |
26 |
Correct |
1 ms |
336 KB |
Output is correct |
27 |
Correct |
1 ms |
504 KB |
Output is correct |
28 |
Correct |
1 ms |
336 KB |
Output is correct |
29 |
Correct |
1 ms |
336 KB |
Output is correct |
30 |
Correct |
1 ms |
512 KB |
Output is correct |
31 |
Correct |
1 ms |
336 KB |
Output is correct |
32 |
Correct |
1 ms |
504 KB |
Output is correct |
33 |
Correct |
1 ms |
336 KB |
Output is correct |
34 |
Correct |
1 ms |
384 KB |
Output is correct |
35 |
Correct |
1 ms |
336 KB |
Output is correct |
36 |
Correct |
1 ms |
336 KB |
Output is correct |
37 |
Correct |
1 ms |
336 KB |
Output is correct |
38 |
Correct |
1 ms |
336 KB |
Output is correct |
39 |
Correct |
1 ms |
336 KB |
Output is correct |
40 |
Correct |
1 ms |
336 KB |
Output is correct |
41 |
Correct |
1 ms |
336 KB |
Output is correct |
42 |
Correct |
1 ms |
592 KB |
Output is correct |
43 |
Correct |
1 ms |
336 KB |
Output is correct |
44 |
Correct |
1 ms |
336 KB |
Output is correct |
45 |
Correct |
1 ms |
336 KB |
Output is correct |
46 |
Correct |
1 ms |
336 KB |
Output is correct |
47 |
Correct |
1 ms |
336 KB |
Output is correct |
48 |
Correct |
1 ms |
336 KB |
Output is correct |
49 |
Correct |
1 ms |
336 KB |
Output is correct |
50 |
Correct |
1 ms |
336 KB |
Output is correct |
51 |
Correct |
1 ms |
336 KB |
Output is correct |
52 |
Correct |
1 ms |
336 KB |
Output is correct |
53 |
Correct |
1 ms |
336 KB |
Output is correct |
54 |
Correct |
1 ms |
336 KB |
Output is correct |
55 |
Correct |
6 ms |
35408 KB |
Output is correct |
56 |
Correct |
2 ms |
504 KB |
Output is correct |
57 |
Correct |
4 ms |
25168 KB |
Output is correct |
58 |
Correct |
29 ms |
12876 KB |
Output is correct |
59 |
Correct |
268 ms |
35656 KB |
Output is correct |
60 |
Correct |
255 ms |
35656 KB |
Output is correct |
61 |
Correct |
250 ms |
40228 KB |
Output is correct |
62 |
Correct |
1 ms |
336 KB |
Output is correct |
63 |
Correct |
229 ms |
35656 KB |
Output is correct |
64 |
Correct |
97 ms |
35468 KB |
Output is correct |
65 |
Correct |
94 ms |
35656 KB |
Output is correct |
66 |
Correct |
97 ms |
35468 KB |
Output is correct |
67 |
Correct |
121 ms |
40504 KB |
Output is correct |
68 |
Correct |
90 ms |
35656 KB |
Output is correct |
69 |
Correct |
106 ms |
40112 KB |
Output is correct |
70 |
Correct |
15 ms |
13532 KB |
Output is correct |
71 |
Correct |
12 ms |
12880 KB |
Output is correct |
72 |
Correct |
13 ms |
12880 KB |
Output is correct |
73 |
Correct |
14 ms |
13648 KB |
Output is correct |
74 |
Correct |
12 ms |
12880 KB |
Output is correct |
75 |
Correct |
15 ms |
13648 KB |
Output is correct |
76 |
Correct |
13 ms |
13648 KB |
Output is correct |
77 |
Correct |
13 ms |
12880 KB |
Output is correct |
78 |
Correct |
12 ms |
13072 KB |
Output is correct |
79 |
Correct |
16 ms |
12880 KB |
Output is correct |
80 |
Correct |
12 ms |
12880 KB |
Output is correct |
81 |
Correct |
13 ms |
13648 KB |
Output is correct |
82 |
Correct |
11 ms |
12880 KB |
Output is correct |
83 |
Correct |
14 ms |
12880 KB |
Output is correct |
84 |
Correct |
15 ms |
13648 KB |
Output is correct |
85 |
Correct |
11 ms |
12892 KB |
Output is correct |
86 |
Correct |
12 ms |
12880 KB |
Output is correct |
87 |
Correct |
19 ms |
13648 KB |
Output is correct |
88 |
Correct |
14 ms |
13648 KB |
Output is correct |
89 |
Correct |
17 ms |
12880 KB |
Output is correct |
90 |
Correct |
13 ms |
13524 KB |
Output is correct |