Submission #60771

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
607712018-07-24 16:26:41gusfringDango Maker (JOI18_dango_maker)C++14
100 / 100
1223 ms238604 KiB
#include <bits/stdc++.h>
using namespace std;
const int N = 3005;
int n, m, d[N][N][4], r;
char a[N][N];
int v(int x, int y, int d){
return
a[x][y] == 'R' &&
a[x + d][y + !d] == 'G' &&
a[x + 2 * d][y + 2 * !d] == 'W';
}
int main(){
cin >> n >> m;
for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) cin >> a[i][j];
for(int t = 2; t <= n + m; t++){
int cm = 0;
for(int i = t - 1, j; i >= 1; i--){
j = t - i;
if(j < 1 || j > m || i < 1 || i > n) continue;
int *c = d[i][j], *p = d[i + 1][j - 1];
c[0] = max(p[0] + v(i, j, 1), p[1]);
c[1] = max(p[2], p[3]);
if(v(i, j, 0)){
c[2] = max(p[0], p[1]) + 1;
c[3] = max(p[2], p[3]) + 1;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...