Submission #390701

#TimeUsernameProblemLanguageResultExecution timeMemory
390701wildturtleBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
623 ms185600 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; ll a,b,c,d,i,e,f,g,n,m,k,l,ans; ll A[5003][5003],B[5003][5003]; string s[5003]; int main() { cin>>n>>m; for(ll i=1;i<=n;i++) { cin>>s[i]; a=0; for(ll j=m-1;j>=0;j--) { if(s[i][j]=='O') { a++; } A[i][j]=a; } } for(ll i=0;i<m;i++) { a=0; for(ll j=n;j>=1;j--) { if(s[j][i]=='I') a++; B[j][i]=a; } } for(ll i=1;i<=n;i++) { for(ll j=0;j<m;j++) { if(s[i][j]=='J') { ans+=A[i][j]*B[i][j]; } } } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...