#include <iostream>
#include <vector>
using namespace std;
int main()
{
int n,m;
cin >> n >> m;
int wyn=0;
vector<string> v(n+2);
for (int64_t i=0; i<m+2; i++) v[0]+='#';
for (int64_t i=1; i<n+1; i++){
v[i]+='#';
string akt;
cin >> akt;
v[i]+=akt;
v[i]+='#';
}
for (int64_t i=0; i<m+2; i++) v[n+1]+='#';
//for (auto it:v) cout << it << '\n';
//cout << '\n';
for (int i=1; i<n+1; i++){
for (int j=1; j<m+1; j++){
//cout << i << ' ' << j << '\n';
if (v[i][j]=='G' and v[i][j-1]=='R' and v[i][j+1]=='W'){
if (v[i][j]=='G' and v[i-1][j]=='R' and v[i+1][j]=='W'){
v[i][j+1]=v[i-1][j]='#';
wyn++;
//cout << i << ' ' << j << '\n';
}
else{
//cout << i << ' ' << j << '\n';
v[i][j+1]=v[i][j-1]='#';
wyn++;
//cout << i << ' ' << j << '\n';
}
}
else if (v[i][j]=='G' and v[i-1][j]=='R' and v[i+1][j]=='W'){
//cout << i << ' ' << j << '\n';
v[i][j]=v[i-1][j]=v[i+1][j]='#';
wyn++;
//cout << i << ' ' << j << '\n';
}
}
}
cout << wyn;
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 |
504 KB |
Output is correct |
15 |
Correct |
1 ms |
504 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 |
504 KB |
Output is correct |
15 |
Correct |
1 ms |
504 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 |
352 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 |
512 KB |
Output is correct |
27 |
Correct |
1 ms |
592 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 |
504 KB |
Output is correct |
31 |
Correct |
1 ms |
508 KB |
Output is correct |
32 |
Correct |
1 ms |
336 KB |
Output is correct |
33 |
Correct |
1 ms |
336 KB |
Output is correct |
34 |
Correct |
1 ms |
504 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 |
516 KB |
Output is correct |
39 |
Correct |
1 ms |
504 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 |
336 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 |
356 KB |
Output is correct |
52 |
Correct |
1 ms |
336 KB |
Output is correct |
53 |
Correct |
1 ms |
504 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 |
504 KB |
Output is correct |
15 |
Correct |
1 ms |
504 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 |
352 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 |
512 KB |
Output is correct |
27 |
Correct |
1 ms |
592 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 |
504 KB |
Output is correct |
31 |
Correct |
1 ms |
508 KB |
Output is correct |
32 |
Correct |
1 ms |
336 KB |
Output is correct |
33 |
Correct |
1 ms |
336 KB |
Output is correct |
34 |
Correct |
1 ms |
504 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 |
516 KB |
Output is correct |
39 |
Correct |
1 ms |
504 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 |
336 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 |
356 KB |
Output is correct |
52 |
Correct |
1 ms |
336 KB |
Output is correct |
53 |
Correct |
1 ms |
504 KB |
Output is correct |
54 |
Correct |
1 ms |
504 KB |
Output is correct |
55 |
Correct |
1 ms |
336 KB |
Output is correct |
56 |
Correct |
1 ms |
336 KB |
Output is correct |
57 |
Correct |
1 ms |
336 KB |
Output is correct |
58 |
Correct |
23 ms |
2384 KB |
Output is correct |
59 |
Correct |
192 ms |
18144 KB |
Output is correct |
60 |
Correct |
212 ms |
17992 KB |
Output is correct |
61 |
Correct |
204 ms |
18004 KB |
Output is correct |
62 |
Correct |
1 ms |
336 KB |
Output is correct |
63 |
Correct |
184 ms |
17448 KB |
Output is correct |
64 |
Correct |
154 ms |
18044 KB |
Output is correct |
65 |
Correct |
141 ms |
18088 KB |
Output is correct |
66 |
Correct |
140 ms |
18108 KB |
Output is correct |
67 |
Correct |
143 ms |
17992 KB |
Output is correct |
68 |
Correct |
141 ms |
17992 KB |
Output is correct |
69 |
Correct |
144 ms |
18024 KB |
Output is correct |
70 |
Correct |
17 ms |
2384 KB |
Output is correct |
71 |
Correct |
19 ms |
2384 KB |
Output is correct |
72 |
Correct |
17 ms |
2384 KB |
Output is correct |
73 |
Correct |
17 ms |
2384 KB |
Output is correct |
74 |
Correct |
17 ms |
2384 KB |
Output is correct |
75 |
Correct |
17 ms |
2384 KB |
Output is correct |
76 |
Correct |
17 ms |
2384 KB |
Output is correct |
77 |
Correct |
18 ms |
2384 KB |
Output is correct |
78 |
Correct |
25 ms |
2384 KB |
Output is correct |
79 |
Correct |
17 ms |
2384 KB |
Output is correct |
80 |
Correct |
18 ms |
2384 KB |
Output is correct |
81 |
Correct |
18 ms |
2400 KB |
Output is correct |
82 |
Correct |
17 ms |
2416 KB |
Output is correct |
83 |
Correct |
17 ms |
2384 KB |
Output is correct |
84 |
Correct |
16 ms |
2384 KB |
Output is correct |
85 |
Correct |
17 ms |
2552 KB |
Output is correct |
86 |
Correct |
19 ms |
2384 KB |
Output is correct |
87 |
Correct |
18 ms |
2384 KB |
Output is correct |
88 |
Correct |
18 ms |
2384 KB |
Output is correct |
89 |
Correct |
21 ms |
2384 KB |
Output is correct |
90 |
Correct |
17 ms |
2384 KB |
Output is correct |