Submission #945071

#TimeUsernameProblemLanguageResultExecution timeMemory
945071TitanicXDzzBitaro the Brave (JOI19_ho_t1)C++14
20 / 100
9 ms15600 KiB
#include<bits/stdc++.h> using namespace std; string s[3010]; int oo[3010][3010]; int ii[3010][3010]; int main(){ int n; int m; int sumi=0; cin>>n>>m; for(int i=0;i<n;i++){ cin>>s[i]; } for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ if(i==0) ii[i][j]=0; if(j==0) oo[i][j]=0; if(s[i][j]=='O') oo[i][j]=oo[i][j-1]+1; else oo[i][j]=oo[i][j-1]; if(s[i][j]=='I') ii[i][j]=ii[i-1][j]+1; else ii[i][j]=ii[i-1][j]; } } for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ if(s[i][j]=='J'){ sumi+=(ii[n-1][j]-ii[i][j])*(oo[i][m-1]-oo[i][j]); } } } cout<<sumi; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...