Submission #1111792

#TimeUsernameProblemLanguageResultExecution timeMemory
1111792Marco_EscandonDango Maker (JOI18_dango_maker)C++11
100 / 100
1635 ms18572 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define x first #define y second int main() { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); ll n,m; cin>>n>>m; char cad[n+5][m+5]; for(int i=2; i<n+2; i++) for(int j=2; j<m+2; j++) cin>>cad[i][j]; vector<pair<ll,ll>> asd; for(int i=2; i<n+2; i++) asd.push_back({i,2}); for(int i=3; i<m+2; i++) asd.push_back({n+1,i}); ll cont=0; for(int z=0; z<asd.size(); z++) { ll bs=0; map<ll,ll> dp[2]; pair<ll,ll> p=asd[z]; ll i=0; while(p.x>=2&&p.y<m+2) { dp[0][i]=max(dp[0][i-1],dp[1][i-2])+(cad[p.x-1][p.y]=='R'&&cad[p.x][p.y]=='G'&&cad[p.x+1][p.y]=='W'); dp[1][i]=max(dp[1][i-1],dp[0][i-2])+(cad[p.x][p.y-1]=='R'&&cad[p.x][p.y]=='G'&&cad[p.x][p.y+1]=='W'); p.x--;p.y++;i++; } cont+=max(dp[0][i-1],dp[1][i-1]); } cout<<cont; return 0; }

Compilation message (stderr)

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:22:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     for(int z=0; z<asd.size(); z++)
      |                  ~^~~~~~~~~~~
dango_maker.cpp:24:12: warning: unused variable 'bs' [-Wunused-variable]
   24 |         ll bs=0;
      |            ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...