Submission #1094959

#TimeUsernameProblemLanguageResultExecution timeMemory
1094959ezzzayDango Maker (JOI18_dango_maker)C++14
0 / 100
1 ms348 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define ff first #define ss second const int N=3005; char a[N][N]; bool vis[N][N]; int cnt=0; int dp[N][N]; signed main(){ int n,m; cin>>n>>m; for(int i=1+3;i<=n+3;i++){ for(int j=1+3;j<=m+3;j++){ cin>>a[i][j]; } } for(int i=1+3;i<=n+3;i++){ for(int j=1+3;j<=m+3;j++){ dp[i][j]=max(dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1],dp[i][j]); if(a[i][j]=='W' and a[i][j-1]=='G' and a[i][j-2]=='R'){ dp[i][j]=max(dp[i][j],dp[i-1][j]+dp[i][j-3]-dp[i-1][j-3]+1); } if(a[i][j]=='W' and a[i-1][j]=='G' and a[i-2][j]=='R'){ dp[i][j]=max(dp[i][j],dp[i][j-1]+dp[i-3][j]-dp[i-3][j-1]+1); } } } cout<<dp[n+3][m+3]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...