Submission #136955

#TimeUsernameProblemLanguageResultExecution timeMemory
136955ksmzzang2003스탬프 수집 (JOI16_ho_t2)C++14
0 / 100
2 ms380 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll N; string A; ll pj[100003],rpi[100003]; ll o,ret=0; int main() { cin>>N>>A; for(ll i=0; i<N; i++) pj[i] = ((i>0)?pj[i-1]:0) +(A[i]=='J'); ll maxv = 0; for(ll i=N-1; i>=0; i--) rpi[i] = rpi[i+1]+(A[i]=='I'); for(ll i=0;i<N;i++) if(A[i]=='O') o+=pj[i]*rpi[i],maxv=max(maxv,pj[i]*rpi[i]); o+=maxv; ret = max(ret,o); o=0; for(ll i=0;i<N;i++) if(A[i]=='O') o+=(pj[i]+1)*rpi[i]; ret = max(ret,o); o=0;for(ll i=0;i<N;i++) if(A[i]=='O') o+=pj[i]*(rpi[i]+1); ret = max(ret,o); printf("%lld",ret); }

Compilation message (stderr)

2016_ho_t2.cpp: In function 'int main()':
2016_ho_t2.cpp:13:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for(ll i=0;i<N;i++) if(A[i]=='O') o+=pj[i]*rpi[i],maxv=max(maxv,pj[i]*rpi[i]); o+=maxv; ret = max(ret,o);
     ^~~
2016_ho_t2.cpp:13:84: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
     for(ll i=0;i<N;i++) if(A[i]=='O') o+=pj[i]*rpi[i],maxv=max(maxv,pj[i]*rpi[i]); o+=maxv; ret = max(ret,o);
                                                                                    ^
2016_ho_t2.cpp:15:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for(ll i=0;i<N;i++) if(A[i]=='O') o+=(pj[i]+1)*rpi[i];  ret = max(ret,o);
     ^~~
2016_ho_t2.cpp:15:61: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
     for(ll i=0;i<N;i++) if(A[i]=='O') o+=(pj[i]+1)*rpi[i];  ret = max(ret,o);
                                                             ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...