#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define x first
#define y second
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
ll n,m;
cin>>n>>m;
char cad[n+5][m+5];
for(int i=2; i<n+2; i++)
for(int j=2; j<m+2; j++)
cin>>cad[i][j];
vector<pair<ll,ll>> asd;
for(int i=2; i<n+2; i++)
asd.push_back({i,2});
for(int i=3; i<m+2; i++)
asd.push_back({n+1,i});
ll cont=0;
for(int z=0; z<asd.size(); z++)
{
ll bs=0;
map<ll,ll> dp[2];
pair<ll,ll> p=asd[z];
ll i=0;
while(p.x>=2&&p.y<m+2)
{
dp[0][i]=max(dp[0][i-1],dp[1][i-2])+(cad[p.x-1][p.y]=='R'&&cad[p.x][p.y]=='G'&&cad[p.x+1][p.y]=='W');
dp[1][i]=max(dp[1][i-1],dp[0][i-2])+(cad[p.x][p.y-1]=='R'&&cad[p.x][p.y]=='G'&&cad[p.x][p.y+1]=='W');
p.x--;p.y++;i++;
}
cont+=max(dp[0][i-1],dp[1][i-1]);
}
cout<<cont;
return 0;
}
Compilation message
dango_maker.cpp: In function 'int main()':
dango_maker.cpp:22:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
22 | for(int z=0; z<asd.size(); z++)
| ~^~~~~~~~~~~
dango_maker.cpp:24:12: warning: unused variable 'bs' [-Wunused-variable]
24 | ll bs=0;
| ^~
# |
결과 |
실행 시간 |
메모리 |
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 |
460 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
460 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 |
508 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 |
456 KB |
Output is correct |
26 |
Correct |
1 ms |
504 KB |
Output is correct |
27 |
Correct |
1 ms |
336 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 |
336 KB |
Output is correct |
31 |
Correct |
1 ms |
336 KB |
Output is correct |
32 |
Correct |
1 ms |
336 KB |
Output is correct |
33 |
Correct |
1 ms |
464 KB |
Output is correct |
34 |
Correct |
2 ms |
336 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 |
2 ms |
508 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 |
464 KB |
Output is correct |
46 |
Correct |
1 ms |
504 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 |
464 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 |
# |
결과 |
실행 시간 |
메모리 |
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 |
460 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 |
508 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 |
456 KB |
Output is correct |
26 |
Correct |
1 ms |
504 KB |
Output is correct |
27 |
Correct |
1 ms |
336 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 |
336 KB |
Output is correct |
31 |
Correct |
1 ms |
336 KB |
Output is correct |
32 |
Correct |
1 ms |
336 KB |
Output is correct |
33 |
Correct |
1 ms |
464 KB |
Output is correct |
34 |
Correct |
2 ms |
336 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 |
2 ms |
508 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 |
464 KB |
Output is correct |
46 |
Correct |
1 ms |
504 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 |
464 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 |
2 ms |
592 KB |
Output is correct |
55 |
Correct |
2 ms |
592 KB |
Output is correct |
56 |
Correct |
2 ms |
592 KB |
Output is correct |
57 |
Correct |
3 ms |
336 KB |
Output is correct |
58 |
Correct |
147 ms |
2384 KB |
Output is correct |
59 |
Correct |
1600 ms |
18572 KB |
Output is correct |
60 |
Correct |
1614 ms |
18360 KB |
Output is correct |
61 |
Correct |
1607 ms |
18572 KB |
Output is correct |
62 |
Correct |
2 ms |
592 KB |
Output is correct |
63 |
Correct |
1568 ms |
17736 KB |
Output is correct |
64 |
Correct |
1552 ms |
18408 KB |
Output is correct |
65 |
Correct |
1588 ms |
18564 KB |
Output is correct |
66 |
Correct |
1575 ms |
18356 KB |
Output is correct |
67 |
Correct |
1635 ms |
18504 KB |
Output is correct |
68 |
Correct |
1585 ms |
18452 KB |
Output is correct |
69 |
Correct |
1612 ms |
18508 KB |
Output is correct |
70 |
Correct |
144 ms |
2384 KB |
Output is correct |
71 |
Correct |
145 ms |
2508 KB |
Output is correct |
72 |
Correct |
151 ms |
2384 KB |
Output is correct |
73 |
Correct |
181 ms |
2516 KB |
Output is correct |
74 |
Correct |
166 ms |
2384 KB |
Output is correct |
75 |
Correct |
148 ms |
2384 KB |
Output is correct |
76 |
Correct |
147 ms |
2576 KB |
Output is correct |
77 |
Correct |
161 ms |
2384 KB |
Output is correct |
78 |
Correct |
146 ms |
2384 KB |
Output is correct |
79 |
Correct |
137 ms |
2540 KB |
Output is correct |
80 |
Correct |
144 ms |
2540 KB |
Output is correct |
81 |
Correct |
146 ms |
2568 KB |
Output is correct |
82 |
Correct |
154 ms |
2384 KB |
Output is correct |
83 |
Correct |
143 ms |
2384 KB |
Output is correct |
84 |
Correct |
143 ms |
2384 KB |
Output is correct |
85 |
Correct |
142 ms |
2384 KB |
Output is correct |
86 |
Correct |
135 ms |
2384 KB |
Output is correct |
87 |
Correct |
137 ms |
2384 KB |
Output is correct |
88 |
Correct |
141 ms |
2384 KB |
Output is correct |
89 |
Correct |
147 ms |
2492 KB |
Output is correct |
90 |
Correct |
165 ms |
2540 KB |
Output is correct |