제출 #1180358

#제출 시각아이디문제언어결과실행 시간메모리
1180358user736482Dango Maker (JOI18_dango_maker)C++20
33 / 100
7 ms584 KiB
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pb push_back #define ff first #define ss second #define MOD 1000000009 #define INF 1000000019 #define INFL 1000000000000000099LL #define MX 507 ll n,q,s,t,a,b,c,d,ans,bst,k,e,m,pier,h,w; string wej[6007]; int main() { ios_base::sync_with_stdio(0);cin.tie(0); cin>>n>>m; for(ll i=0;i<=m+1;i++){ wej[0].pb('W'); wej[n+1].pb('R'); } for(ll i=0;i<n;i++){ cin>>wej[i+1]; wej[i+1]="W"+wej[i+1]+"R"; } for(ll i=2;i<=n+m;i++){ ll ak[3]; ak[0]=0;//puste ak[1]=0;//z lewej pelne ak[2]=0;//z prawej pelne for(ll j=1;j<i;j++){ ak[0]=max(max(ak[0],ak[1]),ak[2]); if(wej[j][i-j]=='G'){ // cout<< //ll akk=ak[1]; if(wej[j-1][i-j]=='R' && wej[j+1][i-j]=='W') ak[1]=ak[1]+1; if(wej[j][i-j-1]=='R' && wej[j][i-j+1]=='W') ak[2]=ak[2]+1; } ak[1]=max(ak[1],ak[0]); ak[2]=max(ak[2],ak[0]); } ans+=max(ak[1],ak[2]); //cout<<ans<<" "; } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...