Submission #77962

# Submission time Handle Problem Language Result Execution time Memory
77962 2018-10-01T12:54:14 Z win11905 Dango Maker (JOI18_dango_maker) C++11
100 / 100
280 ms 15280 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(3), V[1][i].resize(3);
    for(int i = 1; i <= n; ++i) for(int j = 1; j <= m; ++j) {
        bool st = false, st2 = false;
        if(A[i][j] == 'R' and A[i+1][j] == 'G' and A[i+2][j] == 'W') st = true;
        if(A[i][j] == 'R' and A[i][j+1] == 'G' and A[i][j+2] == '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] = V[0][i][j] + max(dp[0][j-1], dp[1][j-1]);
            dp[1][j] = V[1][i][j] + max(dp[1][j-1], dp[0][j-3]);
        }
        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 3 ms 760 KB Output is correct
2 Correct 2 ms 892 KB Output is correct
3 Correct 2 ms 892 KB Output is correct
4 Correct 2 ms 892 KB Output is correct
5 Correct 2 ms 892 KB Output is correct
6 Correct 2 ms 968 KB Output is correct
7 Correct 2 ms 980 KB Output is correct
8 Correct 2 ms 1056 KB Output is correct
9 Correct 2 ms 1056 KB Output is correct
10 Correct 2 ms 1056 KB Output is correct
11 Correct 2 ms 1056 KB Output is correct
12 Correct 2 ms 1056 KB Output is correct
13 Correct 3 ms 1056 KB Output is correct
14 Correct 3 ms 1056 KB Output is correct
15 Correct 2 ms 1056 KB Output is correct
16 Correct 2 ms 1108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 760 KB Output is correct
2 Correct 2 ms 892 KB Output is correct
3 Correct 2 ms 892 KB Output is correct
4 Correct 2 ms 892 KB Output is correct
5 Correct 2 ms 892 KB Output is correct
6 Correct 2 ms 968 KB Output is correct
7 Correct 2 ms 980 KB Output is correct
8 Correct 2 ms 1056 KB Output is correct
9 Correct 2 ms 1056 KB Output is correct
10 Correct 2 ms 1056 KB Output is correct
11 Correct 2 ms 1056 KB Output is correct
12 Correct 2 ms 1056 KB Output is correct
13 Correct 3 ms 1056 KB Output is correct
14 Correct 3 ms 1056 KB Output is correct
15 Correct 2 ms 1056 KB Output is correct
16 Correct 2 ms 1108 KB Output is correct
17 Correct 2 ms 1108 KB Output is correct
18 Correct 2 ms 1108 KB Output is correct
19 Correct 2 ms 1108 KB Output is correct
20 Correct 3 ms 1108 KB Output is correct
21 Correct 2 ms 1108 KB Output is correct
22 Correct 2 ms 1108 KB Output is correct
23 Correct 2 ms 1108 KB Output is correct
24 Correct 2 ms 1108 KB Output is correct
25 Correct 2 ms 1108 KB Output is correct
26 Correct 2 ms 1108 KB Output is correct
27 Correct 2 ms 1108 KB Output is correct
28 Correct 2 ms 1108 KB Output is correct
29 Correct 2 ms 1108 KB Output is correct
30 Correct 2 ms 1108 KB Output is correct
31 Correct 2 ms 1108 KB Output is correct
32 Correct 3 ms 1108 KB Output is correct
33 Correct 3 ms 1108 KB Output is correct
34 Correct 2 ms 1108 KB Output is correct
35 Correct 3 ms 1108 KB Output is correct
36 Correct 2 ms 1108 KB Output is correct
37 Correct 2 ms 1108 KB Output is correct
38 Correct 2 ms 1108 KB Output is correct
39 Correct 3 ms 1108 KB Output is correct
40 Correct 2 ms 1108 KB Output is correct
41 Correct 2 ms 1108 KB Output is correct
42 Correct 2 ms 1108 KB Output is correct
43 Correct 3 ms 1228 KB Output is correct
44 Correct 3 ms 1228 KB Output is correct
45 Correct 2 ms 1228 KB Output is correct
46 Correct 2 ms 1228 KB Output is correct
47 Correct 3 ms 1244 KB Output is correct
48 Correct 2 ms 1244 KB Output is correct
49 Correct 3 ms 1244 KB Output is correct
50 Correct 3 ms 1244 KB Output is correct
51 Correct 2 ms 1244 KB Output is correct
52 Correct 2 ms 1244 KB Output is correct
53 Correct 3 ms 1244 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 760 KB Output is correct
2 Correct 2 ms 892 KB Output is correct
3 Correct 2 ms 892 KB Output is correct
4 Correct 2 ms 892 KB Output is correct
5 Correct 2 ms 892 KB Output is correct
6 Correct 2 ms 968 KB Output is correct
7 Correct 2 ms 980 KB Output is correct
8 Correct 2 ms 1056 KB Output is correct
9 Correct 2 ms 1056 KB Output is correct
10 Correct 2 ms 1056 KB Output is correct
11 Correct 2 ms 1056 KB Output is correct
12 Correct 2 ms 1056 KB Output is correct
13 Correct 3 ms 1056 KB Output is correct
14 Correct 3 ms 1056 KB Output is correct
15 Correct 2 ms 1056 KB Output is correct
16 Correct 2 ms 1108 KB Output is correct
17 Correct 2 ms 1108 KB Output is correct
18 Correct 2 ms 1108 KB Output is correct
19 Correct 2 ms 1108 KB Output is correct
20 Correct 3 ms 1108 KB Output is correct
21 Correct 2 ms 1108 KB Output is correct
22 Correct 2 ms 1108 KB Output is correct
23 Correct 2 ms 1108 KB Output is correct
24 Correct 2 ms 1108 KB Output is correct
25 Correct 2 ms 1108 KB Output is correct
26 Correct 2 ms 1108 KB Output is correct
27 Correct 2 ms 1108 KB Output is correct
28 Correct 2 ms 1108 KB Output is correct
29 Correct 2 ms 1108 KB Output is correct
30 Correct 2 ms 1108 KB Output is correct
31 Correct 2 ms 1108 KB Output is correct
32 Correct 3 ms 1108 KB Output is correct
33 Correct 3 ms 1108 KB Output is correct
34 Correct 2 ms 1108 KB Output is correct
35 Correct 3 ms 1108 KB Output is correct
36 Correct 2 ms 1108 KB Output is correct
37 Correct 2 ms 1108 KB Output is correct
38 Correct 2 ms 1108 KB Output is correct
39 Correct 3 ms 1108 KB Output is correct
40 Correct 2 ms 1108 KB Output is correct
41 Correct 2 ms 1108 KB Output is correct
42 Correct 2 ms 1108 KB Output is correct
43 Correct 3 ms 1228 KB Output is correct
44 Correct 3 ms 1228 KB Output is correct
45 Correct 2 ms 1228 KB Output is correct
46 Correct 2 ms 1228 KB Output is correct
47 Correct 3 ms 1244 KB Output is correct
48 Correct 2 ms 1244 KB Output is correct
49 Correct 3 ms 1244 KB Output is correct
50 Correct 3 ms 1244 KB Output is correct
51 Correct 2 ms 1244 KB Output is correct
52 Correct 2 ms 1244 KB Output is correct
53 Correct 3 ms 1244 KB Output is correct
54 Correct 3 ms 1400 KB Output is correct
55 Correct 10 ms 10236 KB Output is correct
56 Correct 3 ms 10236 KB Output is correct
57 Correct 8 ms 10236 KB Output is correct
58 Correct 31 ms 10236 KB Output is correct
59 Correct 271 ms 15120 KB Output is correct
60 Correct 256 ms 15180 KB Output is correct
61 Correct 250 ms 15180 KB Output is correct
62 Correct 3 ms 15180 KB Output is correct
63 Correct 280 ms 15180 KB Output is correct
64 Correct 247 ms 15280 KB Output is correct
65 Correct 243 ms 15280 KB Output is correct
66 Correct 274 ms 15280 KB Output is correct
67 Correct 250 ms 15280 KB Output is correct
68 Correct 247 ms 15280 KB Output is correct
69 Correct 250 ms 15280 KB Output is correct
70 Correct 37 ms 15280 KB Output is correct
71 Correct 26 ms 15280 KB Output is correct
72 Correct 26 ms 15280 KB Output is correct
73 Correct 27 ms 15280 KB Output is correct
74 Correct 27 ms 15280 KB Output is correct
75 Correct 27 ms 15280 KB Output is correct
76 Correct 27 ms 15280 KB Output is correct
77 Correct 26 ms 15280 KB Output is correct
78 Correct 27 ms 15280 KB Output is correct
79 Correct 27 ms 15280 KB Output is correct
80 Correct 26 ms 15280 KB Output is correct
81 Correct 27 ms 15280 KB Output is correct
82 Correct 31 ms 15280 KB Output is correct
83 Correct 27 ms 15280 KB Output is correct
84 Correct 27 ms 15280 KB Output is correct
85 Correct 28 ms 15280 KB Output is correct
86 Correct 26 ms 15280 KB Output is correct
87 Correct 28 ms 15280 KB Output is correct
88 Correct 26 ms 15280 KB Output is correct
89 Correct 27 ms 15280 KB Output is correct
90 Correct 27 ms 15280 KB Output is correct