Submission #66853

# Submission time Handle Problem Language Result Execution time Memory
66853 2018-08-12T16:05:18 Z yusufake Dango Maker (JOI18_dango_maker) C++
33 / 100
1490 ms 263168 KB
#include<bits/stdc++.h> 
using namespace std; 
 
#define mp make_pair 
#define pb push_back 
#define st first 
#define nd second 
 
typedef long long ll; 
typedef pair < int , int > pp; 
const int mod = 1e9 + 7; 
const int N   = 3e3 + 3; 
 
int M[N][N][2][2],H[N][N],m,n,i,j,ans;
char A[N][N];
 
int f(int x, int y, int a, int b){
    if(A[x][y] != 'G') return 0;
    H[x][y] = 1;
    int &r = M[x][y][a][b];
    if(r != -1) return r;
    if(a && A[x][y-1] == 'R') r = max(r , f(x+1,y-1,A[x+1][y]=='W',0)+1);
    if(b && A[x+1][y] == 'W') r = max(r , f(x+1,y-1,0,A[x][y-1]=='R')+1);
    return r = max(r , f(x+1,y-1,A[x+1][y]=='W',A[x][y-1]=='R'));   
}
 
int main(){
    scanf("%d%d",&m,&n);
    for(i=1;i<=m;i++)
        for(j=1;j<=n;j++)
            scanf(" %c", &A[i][j]);
            
    memset(M , -1 , sizeof M);
    for(i=1;i<=m;i++)
        for(j=n; j ;j--)
            if(A[i][j] == 'G' && !H[i][j])
                ans += f(i,j,A[i][j+1]=='W',A[i-1][j]=='R');

    printf("%d",ans);
    return 0;
}

Compilation message

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:28:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&m,&n);
     ~~~~~^~~~~~~~~~~~~~
dango_maker.cpp:31:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf(" %c", &A[i][j]);
             ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 115 ms 141560 KB Output is correct
2 Correct 116 ms 141560 KB Output is correct
3 Correct 119 ms 141724 KB Output is correct
4 Correct 110 ms 141724 KB Output is correct
5 Correct 108 ms 141724 KB Output is correct
6 Correct 127 ms 141724 KB Output is correct
7 Correct 126 ms 141752 KB Output is correct
8 Correct 107 ms 141752 KB Output is correct
9 Correct 118 ms 141784 KB Output is correct
10 Correct 126 ms 141844 KB Output is correct
11 Correct 134 ms 141844 KB Output is correct
12 Correct 119 ms 141844 KB Output is correct
13 Correct 118 ms 141844 KB Output is correct
14 Correct 118 ms 141924 KB Output is correct
15 Correct 115 ms 141924 KB Output is correct
16 Correct 125 ms 141924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 115 ms 141560 KB Output is correct
2 Correct 116 ms 141560 KB Output is correct
3 Correct 119 ms 141724 KB Output is correct
4 Correct 110 ms 141724 KB Output is correct
5 Correct 108 ms 141724 KB Output is correct
6 Correct 127 ms 141724 KB Output is correct
7 Correct 126 ms 141752 KB Output is correct
8 Correct 107 ms 141752 KB Output is correct
9 Correct 118 ms 141784 KB Output is correct
10 Correct 126 ms 141844 KB Output is correct
11 Correct 134 ms 141844 KB Output is correct
12 Correct 119 ms 141844 KB Output is correct
13 Correct 118 ms 141844 KB Output is correct
14 Correct 118 ms 141924 KB Output is correct
15 Correct 115 ms 141924 KB Output is correct
16 Correct 125 ms 141924 KB Output is correct
17 Correct 112 ms 141924 KB Output is correct
18 Correct 111 ms 141924 KB Output is correct
19 Correct 111 ms 141924 KB Output is correct
20 Correct 118 ms 141924 KB Output is correct
21 Correct 110 ms 141924 KB Output is correct
22 Correct 114 ms 141924 KB Output is correct
23 Correct 118 ms 141924 KB Output is correct
24 Correct 116 ms 141924 KB Output is correct
25 Correct 114 ms 141924 KB Output is correct
26 Correct 110 ms 142068 KB Output is correct
27 Correct 125 ms 142068 KB Output is correct
28 Correct 108 ms 142068 KB Output is correct
29 Correct 116 ms 142068 KB Output is correct
30 Correct 126 ms 142068 KB Output is correct
31 Correct 108 ms 142068 KB Output is correct
32 Correct 110 ms 142068 KB Output is correct
33 Correct 117 ms 142068 KB Output is correct
34 Correct 116 ms 142068 KB Output is correct
35 Correct 115 ms 142068 KB Output is correct
36 Correct 106 ms 142068 KB Output is correct
37 Correct 105 ms 142068 KB Output is correct
38 Correct 127 ms 142068 KB Output is correct
39 Correct 109 ms 142068 KB Output is correct
40 Correct 113 ms 142068 KB Output is correct
41 Correct 106 ms 142068 KB Output is correct
42 Correct 114 ms 142068 KB Output is correct
43 Correct 111 ms 142068 KB Output is correct
44 Correct 120 ms 142068 KB Output is correct
45 Correct 106 ms 142068 KB Output is correct
46 Correct 109 ms 142068 KB Output is correct
47 Correct 111 ms 142068 KB Output is correct
48 Correct 123 ms 142068 KB Output is correct
49 Correct 107 ms 142200 KB Output is correct
50 Correct 117 ms 142200 KB Output is correct
51 Correct 120 ms 142200 KB Output is correct
52 Correct 131 ms 142200 KB Output is correct
53 Correct 118 ms 142200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 115 ms 141560 KB Output is correct
2 Correct 116 ms 141560 KB Output is correct
3 Correct 119 ms 141724 KB Output is correct
4 Correct 110 ms 141724 KB Output is correct
5 Correct 108 ms 141724 KB Output is correct
6 Correct 127 ms 141724 KB Output is correct
7 Correct 126 ms 141752 KB Output is correct
8 Correct 107 ms 141752 KB Output is correct
9 Correct 118 ms 141784 KB Output is correct
10 Correct 126 ms 141844 KB Output is correct
11 Correct 134 ms 141844 KB Output is correct
12 Correct 119 ms 141844 KB Output is correct
13 Correct 118 ms 141844 KB Output is correct
14 Correct 118 ms 141924 KB Output is correct
15 Correct 115 ms 141924 KB Output is correct
16 Correct 125 ms 141924 KB Output is correct
17 Correct 112 ms 141924 KB Output is correct
18 Correct 111 ms 141924 KB Output is correct
19 Correct 111 ms 141924 KB Output is correct
20 Correct 118 ms 141924 KB Output is correct
21 Correct 110 ms 141924 KB Output is correct
22 Correct 114 ms 141924 KB Output is correct
23 Correct 118 ms 141924 KB Output is correct
24 Correct 116 ms 141924 KB Output is correct
25 Correct 114 ms 141924 KB Output is correct
26 Correct 110 ms 142068 KB Output is correct
27 Correct 125 ms 142068 KB Output is correct
28 Correct 108 ms 142068 KB Output is correct
29 Correct 116 ms 142068 KB Output is correct
30 Correct 126 ms 142068 KB Output is correct
31 Correct 108 ms 142068 KB Output is correct
32 Correct 110 ms 142068 KB Output is correct
33 Correct 117 ms 142068 KB Output is correct
34 Correct 116 ms 142068 KB Output is correct
35 Correct 115 ms 142068 KB Output is correct
36 Correct 106 ms 142068 KB Output is correct
37 Correct 105 ms 142068 KB Output is correct
38 Correct 127 ms 142068 KB Output is correct
39 Correct 109 ms 142068 KB Output is correct
40 Correct 113 ms 142068 KB Output is correct
41 Correct 106 ms 142068 KB Output is correct
42 Correct 114 ms 142068 KB Output is correct
43 Correct 111 ms 142068 KB Output is correct
44 Correct 120 ms 142068 KB Output is correct
45 Correct 106 ms 142068 KB Output is correct
46 Correct 109 ms 142068 KB Output is correct
47 Correct 111 ms 142068 KB Output is correct
48 Correct 123 ms 142068 KB Output is correct
49 Correct 107 ms 142200 KB Output is correct
50 Correct 117 ms 142200 KB Output is correct
51 Correct 120 ms 142200 KB Output is correct
52 Correct 131 ms 142200 KB Output is correct
53 Correct 118 ms 142200 KB Output is correct
54 Correct 121 ms 142200 KB Output is correct
55 Correct 135 ms 154980 KB Output is correct
56 Correct 109 ms 154980 KB Output is correct
57 Correct 128 ms 155916 KB Output is correct
58 Correct 203 ms 155916 KB Output is correct
59 Correct 1008 ms 195992 KB Output is correct
60 Correct 936 ms 204828 KB Output is correct
61 Correct 971 ms 213296 KB Output is correct
62 Correct 108 ms 213296 KB Output is correct
63 Correct 907 ms 221708 KB Output is correct
64 Correct 1386 ms 230536 KB Output is correct
65 Correct 1358 ms 238876 KB Output is correct
66 Correct 1490 ms 247220 KB Output is correct
67 Correct 744 ms 247220 KB Output is correct
68 Correct 783 ms 260652 KB Output is correct
69 Runtime error 1010 ms 263168 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
70 Halted 0 ms 0 KB -