Submission #945075

#TimeUsernameProblemLanguageResultExecution timeMemory
945075TitanicXDzzBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
204 ms162396 KiB
#include<bits/stdc++.h> using namespace std; string s[3010]; long long oo[3010][3010]; long long ii[3010][3010]; int main(){ int n; int m; long long 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...