Submission #893769

#TimeUsernameProblemLanguageResultExecution timeMemory
893769AiperiiiDango Maker (JOI18_dango_maker)C++14
100 / 100
495 ms102164 KiB
#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-1;i++){ int dp[ind[i].size()][3]; for(int j=ind[i].size()-1;j>=0;j--){ int x=ind[i][j],y=i-ind[i][j]; dp[j][0]=0;dp[j][1]=0;dp[j][2]=0; if(j+1<ind[i].size())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'){ if(j+1<ind[i].size())dp[j][1]=max(dp[j+1][0],dp[j+1][1]); dp[j][1]++; } if(x+1<n && x-1>=0 && a[x][y]=='G' && a[x+1][y]=='W' && a[x-1][y]=='R'){ if(j+1<ind[i].size())dp[j][2]=max(dp[j+1][0],dp[j+1][2]); dp[j][2]++; } } ans+=max({dp[0][0],dp[0][1],dp[0][2]}); } cout<<ans<<"\n"; }

Compilation message (stderr)

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:29:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |             if(j+1<ind[i].size())dp[j][0]=max({dp[j+1][0],dp[j+1][1],dp[j+1][2]});
      |                ~~~^~~~~~~~~~~~~~
dango_maker.cpp:32:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |                 if(j+1<ind[i].size())dp[j][1]=max(dp[j+1][0],dp[j+1][1]);
      |                    ~~~^~~~~~~~~~~~~~
dango_maker.cpp:36:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |                 if(j+1<ind[i].size())dp[j][2]=max(dp[j+1][0],dp[j+1][2]);
      |                    ~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...