답안 #555002

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
555002 2022-04-29T21:09:32 Z Rafi22 Dango Maker (JOI18_dango_maker) C++14
13 / 100
1 ms 340 KB
#include <bits/stdc++.h>

using namespace std;

#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define ll long long
ll mod=1000000007;
int inf=1000000007;
ll infl=1000000000000000007;

char a[6107][6107];
int DP[6107][2];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,m;
    cin>>n>>m;
    for(int i=4;i<=n+3;i++) for(int j=4;j<=m+3;j++) cin>>a[i][j];
    int ans=0;
    for(int i=1;i<=n+m+6;i++)
    {
        memset(DP,0,sizeof DP);
        for(int c=1;c<=i+3;c++)
        {
            int x=c,y=i-c+1;
           // cout<<x<<" "<<y<<endl;
            DP[c+1][0]=max(DP[c+1][0],DP[c][0]);
            DP[c+1][1]=max(DP[c+1][1],DP[c][1]);
            if(y-2>0&&a[x+2][y-2]=='R'&&a[x+2][y-1]=='G'&&a[x+2][y]=='W')
            {
                DP[c+1][0]=max(DP[c+1][0],DP[c][0]+1);
                DP[c+3][1]=max(DP[c+3][1],DP[c][0]+1);
            }
            if(a[x][y]=='R'&&a[x+1][y]=='G'&&a[x+2][y]=='W')
            {
                DP[c+1][1]=max(DP[c+1][1],DP[c][1]+1);
                DP[c+3][0]=max(DP[c+3][0],DP[c][1]+1);
            }
           // cout<<DP[c][0]<<" "<<DP[c][1]<<endl;
        }
        ans+=max(DP[i+3][0],DP[i+3][1]);
        //cout<<max(DP[i+3][0],DP[i+3][1])<<endl;
    }
    cout<<ans;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 0 ms 340 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 0 ms 340 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 0 ms 340 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 0 ms 340 KB Output is correct
22 Incorrect 0 ms 340 KB Output isn't correct
23 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 0 ms 340 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 0 ms 340 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 0 ms 340 KB Output is correct
22 Incorrect 0 ms 340 KB Output isn't correct
23 Halted 0 ms 0 KB -