답안 #893753

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
893753 2023-12-27T11:01:35 Z Aiperiii Dango Maker (JOI18_dango_maker) C++14
100 / 100
839 ms 111364 KB
#include <bits/stdc++.h>
#define int long long
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define pb push_back
using namespace std;
char a[3005][3005];
vector <int> ind[6005];
signed main(){
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>a[i][j];
            ind[i+j].pb(i);
        }
    }
    int ans=0;
    for(int i=0;i<=n+m-2;i++){
        vector <vector <int> > dp(ind[i].size()+1,vector <int> (3,0));
        for(int j=ind[i].size()-1;j>=0;j--){
            int x=ind[i][j],y=i-ind[i][j];
            dp[j][0]=max({dp[j+1][0],dp[j+1][1],dp[j+1][2]});
            if(y+1<m && y-1>=0 && a[x][y]=='G' && a[x][y+1]=='W' && a[x][y-1]=='R')dp[j][1]=max(dp[j+1][0],dp[j+1][1])+1;
            if(x+1<n && x-1>=0 && a[x][y]=='G' && a[x+1][y]=='W' && a[x-1][y]=='R')
                dp[j][2]=max(dp[j+1][0],dp[j+1][2])+1;
        }
        ans+=max({dp[0][0],dp[0][1],dp[0][2]});
    }
    cout<<ans<<"\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 576 KB Output is correct
7 Correct 0 ms 584 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 604 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 580 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 576 KB Output is correct
7 Correct 0 ms 584 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 604 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 580 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 584 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 604 KB Output is correct
19 Correct 1 ms 604 KB Output is correct
20 Correct 0 ms 604 KB Output is correct
21 Correct 0 ms 604 KB Output is correct
22 Correct 0 ms 604 KB Output is correct
23 Correct 0 ms 604 KB Output is correct
24 Correct 1 ms 604 KB Output is correct
25 Correct 0 ms 584 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 604 KB Output is correct
28 Correct 0 ms 604 KB Output is correct
29 Correct 0 ms 604 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 0 ms 604 KB Output is correct
32 Correct 1 ms 604 KB Output is correct
33 Correct 0 ms 604 KB Output is correct
34 Correct 0 ms 604 KB Output is correct
35 Correct 0 ms 604 KB Output is correct
36 Correct 0 ms 604 KB Output is correct
37 Correct 0 ms 604 KB Output is correct
38 Correct 0 ms 600 KB Output is correct
39 Correct 0 ms 604 KB Output is correct
40 Correct 0 ms 604 KB Output is correct
41 Correct 0 ms 604 KB Output is correct
42 Correct 0 ms 604 KB Output is correct
43 Correct 0 ms 604 KB Output is correct
44 Correct 1 ms 604 KB Output is correct
45 Correct 0 ms 604 KB Output is correct
46 Correct 0 ms 604 KB Output is correct
47 Correct 1 ms 604 KB Output is correct
48 Correct 0 ms 604 KB Output is correct
49 Correct 0 ms 604 KB Output is correct
50 Correct 1 ms 600 KB Output is correct
51 Correct 0 ms 604 KB Output is correct
52 Correct 0 ms 604 KB Output is correct
53 Correct 0 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 576 KB Output is correct
7 Correct 0 ms 584 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 604 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 580 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 584 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 604 KB Output is correct
19 Correct 1 ms 604 KB Output is correct
20 Correct 0 ms 604 KB Output is correct
21 Correct 0 ms 604 KB Output is correct
22 Correct 0 ms 604 KB Output is correct
23 Correct 0 ms 604 KB Output is correct
24 Correct 1 ms 604 KB Output is correct
25 Correct 0 ms 584 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 604 KB Output is correct
28 Correct 0 ms 604 KB Output is correct
29 Correct 0 ms 604 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 0 ms 604 KB Output is correct
32 Correct 1 ms 604 KB Output is correct
33 Correct 0 ms 604 KB Output is correct
34 Correct 0 ms 604 KB Output is correct
35 Correct 0 ms 604 KB Output is correct
36 Correct 0 ms 604 KB Output is correct
37 Correct 0 ms 604 KB Output is correct
38 Correct 0 ms 600 KB Output is correct
39 Correct 0 ms 604 KB Output is correct
40 Correct 0 ms 604 KB Output is correct
41 Correct 0 ms 604 KB Output is correct
42 Correct 0 ms 604 KB Output is correct
43 Correct 0 ms 604 KB Output is correct
44 Correct 1 ms 604 KB Output is correct
45 Correct 0 ms 604 KB Output is correct
46 Correct 0 ms 604 KB Output is correct
47 Correct 1 ms 604 KB Output is correct
48 Correct 0 ms 604 KB Output is correct
49 Correct 0 ms 604 KB Output is correct
50 Correct 1 ms 600 KB Output is correct
51 Correct 0 ms 604 KB Output is correct
52 Correct 0 ms 604 KB Output is correct
53 Correct 0 ms 604 KB Output is correct
54 Correct 1 ms 600 KB Output is correct
55 Correct 2 ms 9308 KB Output is correct
56 Correct 2 ms 860 KB Output is correct
57 Correct 3 ms 6748 KB Output is correct
58 Correct 80 ms 16212 KB Output is correct
59 Correct 789 ms 110672 KB Output is correct
60 Correct 839 ms 110932 KB Output is correct
61 Correct 782 ms 110672 KB Output is correct
62 Correct 1 ms 600 KB Output is correct
63 Correct 789 ms 107580 KB Output is correct
64 Correct 788 ms 110900 KB Output is correct
65 Correct 747 ms 111364 KB Output is correct
66 Correct 776 ms 110928 KB Output is correct
67 Correct 749 ms 111128 KB Output is correct
68 Correct 741 ms 110952 KB Output is correct
69 Correct 780 ms 111092 KB Output is correct
70 Correct 74 ms 16208 KB Output is correct
71 Correct 76 ms 16212 KB Output is correct
72 Correct 95 ms 16132 KB Output is correct
73 Correct 75 ms 16212 KB Output is correct
74 Correct 76 ms 16216 KB Output is correct
75 Correct 75 ms 16208 KB Output is correct
76 Correct 79 ms 16208 KB Output is correct
77 Correct 76 ms 16464 KB Output is correct
78 Correct 80 ms 16212 KB Output is correct
79 Correct 75 ms 16212 KB Output is correct
80 Correct 77 ms 16208 KB Output is correct
81 Correct 74 ms 16220 KB Output is correct
82 Correct 79 ms 16136 KB Output is correct
83 Correct 77 ms 16352 KB Output is correct
84 Correct 76 ms 16328 KB Output is correct
85 Correct 76 ms 16216 KB Output is correct
86 Correct 78 ms 16208 KB Output is correct
87 Correct 76 ms 16244 KB Output is correct
88 Correct 77 ms 16208 KB Output is correct
89 Correct 76 ms 16216 KB Output is correct
90 Correct 76 ms 16208 KB Output is correct