# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1111792 | Marco_Escandon | Dango Maker (JOI18_dango_maker) | C++11 | 1635 ms | 18572 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |