Submission #77957

# Submission time Handle Problem Language Result Execution time Memory
77957 2018-10-01T12:41:38 Z win11905 Dango Maker (JOI18_dango_maker) C++11
13 / 100
3 ms 1168 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 3e3+5;

int n, m;

char A[N][N];
vector<bool> V[2][N<<1];

int main() {
    scanf("%d %d", &n, &m);
    for(int i = 1; i <= n; ++i) scanf("%s", A[i]+1);
    for(int i = 2; i <= n*m; ++i) V[0][i].resize(2), V[1][i].resize(2);
    for(int i = 1; i <= n; ++i) for(int j = 1; j <= m; ++j) {
        bool st = false, st2 = false;
        if(A[i][j] == 'G' and A[i-1][j] == 'R' and A[i+1][j] == 'W') st = true;
        if(A[i][j] == 'G' and A[i][j-1] == 'R' and A[i][j+1] == 'W') st2 = true;
        V[0][i+j].emplace_back(st);
        V[1][i+j].emplace_back(st2);
    }
    int sum = 0;
    for(int i = 2; i <= n*m; ++i) {
        vector<int> dp[2];
        dp[0].resize(V[0][i].size());
        dp[1].resize(V[1][i].size());
        for(int j = 2; j < V[0][i].size(); ++j) {
            dp[0][j] = max(dp[0][j-1], V[0][i][j] + max(dp[0][j-1], dp[1][j-2]));
            dp[1][j] = max(dp[1][j-1], V[1][i][j] + max(dp[1][j-2], dp[0][j-2]));
        }
        sum += max(dp[0].back(), dp[1].back());
    }
    printf("%d\n", sum);
}

Compilation message

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:27:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j = 2; j < V[0][i].size(); ++j) {
                        ~~^~~~~~~~~~~~~~~~
dango_maker.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~~
dango_maker.cpp:13:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1; i <= n; ++i) scanf("%s", A[i]+1);
                                 ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 760 KB Output is correct
2 Correct 2 ms 1016 KB Output is correct
3 Correct 2 ms 1016 KB Output is correct
4 Correct 3 ms 1016 KB Output is correct
5 Correct 2 ms 1048 KB Output is correct
6 Correct 2 ms 1048 KB Output is correct
7 Correct 3 ms 1092 KB Output is correct
8 Correct 2 ms 1092 KB Output is correct
9 Correct 3 ms 1092 KB Output is correct
10 Correct 2 ms 1092 KB Output is correct
11 Correct 2 ms 1092 KB Output is correct
12 Correct 2 ms 1092 KB Output is correct
13 Correct 2 ms 1092 KB Output is correct
14 Correct 2 ms 1092 KB Output is correct
15 Correct 2 ms 1092 KB Output is correct
16 Correct 2 ms 1092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 760 KB Output is correct
2 Correct 2 ms 1016 KB Output is correct
3 Correct 2 ms 1016 KB Output is correct
4 Correct 3 ms 1016 KB Output is correct
5 Correct 2 ms 1048 KB Output is correct
6 Correct 2 ms 1048 KB Output is correct
7 Correct 3 ms 1092 KB Output is correct
8 Correct 2 ms 1092 KB Output is correct
9 Correct 3 ms 1092 KB Output is correct
10 Correct 2 ms 1092 KB Output is correct
11 Correct 2 ms 1092 KB Output is correct
12 Correct 2 ms 1092 KB Output is correct
13 Correct 2 ms 1092 KB Output is correct
14 Correct 2 ms 1092 KB Output is correct
15 Correct 2 ms 1092 KB Output is correct
16 Correct 2 ms 1092 KB Output is correct
17 Correct 3 ms 1092 KB Output is correct
18 Incorrect 3 ms 1168 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 760 KB Output is correct
2 Correct 2 ms 1016 KB Output is correct
3 Correct 2 ms 1016 KB Output is correct
4 Correct 3 ms 1016 KB Output is correct
5 Correct 2 ms 1048 KB Output is correct
6 Correct 2 ms 1048 KB Output is correct
7 Correct 3 ms 1092 KB Output is correct
8 Correct 2 ms 1092 KB Output is correct
9 Correct 3 ms 1092 KB Output is correct
10 Correct 2 ms 1092 KB Output is correct
11 Correct 2 ms 1092 KB Output is correct
12 Correct 2 ms 1092 KB Output is correct
13 Correct 2 ms 1092 KB Output is correct
14 Correct 2 ms 1092 KB Output is correct
15 Correct 2 ms 1092 KB Output is correct
16 Correct 2 ms 1092 KB Output is correct
17 Correct 3 ms 1092 KB Output is correct
18 Incorrect 3 ms 1168 KB Output isn't correct
19 Halted 0 ms 0 KB -