Submission #303136

# Submission time Handle Problem Language Result Execution time Memory
303136 2020-09-19T22:58:43 Z jainbot27 Dango Maker (JOI18_dango_maker) C++17
0 / 100
1 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

const int mxN = 3001;
int n, m, ans = 0, dp[mxN][3]; bool g[mxN][mxN]; string s[mxN];
string c = "RGW";
inline bool okay(int x, int y, char k){
    return (x >= 0 && y >= 0 && x < n && y < m && s[x][y] == k);
}
int32_t main(){
    cin >> n >> m;
    for(int i=0; i < n; i++){
        cin >> s[i];
    }
    for(int k = 0; k < n + m; k++){
        for(int i = 0; i <= k && i < n; i++){
            int j=k-i;
            dp[i+1][0] = max({dp[i][0], dp[i][1], dp[i][2]});
            dp[i+1][1] = max(dp[i][1], dp[i][0]) + (okay(i, j, 'G') && okay(i-1, j, 'R') && okay(i+1, j, 'W'));
            dp[i+1][2] = max(dp[i][2], dp[i][0]) + (okay(i, j, 'G') && okay(i, j-1, 'R') && okay(i, j+1, 'W'));
        }
        ans +=max({dp[k+1][0], dp[k+1][1], dp[k+2][2]});
    }
    cout << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Incorrect 0 ms 384 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Incorrect 0 ms 384 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Incorrect 0 ms 384 KB Output isn't correct
7 Halted 0 ms 0 KB -