Submission #222880

# Submission time Handle Problem Language Result Execution time Memory
222880 2020-04-14T09:49:29 Z Autoratch Dango Maker (JOI18_dango_maker) C++14
13 / 100
5 ms 512 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 3001;

int m,n;
char c[N][N];
int v[N][N],h[N][N],vv[N][N],hh[N][N],dp[N][N];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);

    cin >> m >> n;
    for(int i = 1;i <= m;i++) for(int j = 1;j <= n;j++) cin >> c[i][j];
    for(int i = 1;i <= m;i++) for(int j = 1;j <= n;j++) 
    {
        if(i>2 and c[i-2][j]=='R' and c[i-1][j]=='G' and c[i][j]=='W') v[i][j] = 1;
        if(j>2 and c[i][j-2]=='R' and c[i][j-1]=='G' and c[i][j]=='W') h[i][j] = 1;
        vv[i][j] = v[i][j]+vv[i-1][j];
        v[i][j]+=v[i][j-1];
        hh[i][j] = h[i][j]+hh[i][j-1];
        h[i][j]+=h[i-1][j];
        int ver = v[i][j],hor = h[i][j];
        if(i>=3) ver+=dp[i-3][j];
        if(j>=3) hor+=dp[i][j-3];
        ver = max(ver,vv[i][j]+dp[i][j-1]);
        hor = max(hor,hh[i][j]+dp[i-1][j]);
        dp[i][j] = max(ver,hor);
        dp[i][j] = max(dp[i][j],max(dp[i-1][j],dp[i][j-1]));
    }
    cout << dp[m][n];
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 512 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 512 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 4 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 512 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 512 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 4 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Incorrect 5 ms 512 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 512 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 512 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 4 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Incorrect 5 ms 512 KB Output isn't correct
19 Halted 0 ms 0 KB -