Submission #947615

#TimeUsernameProblemLanguageResultExecution timeMemory
947615packmaniMecho (IOI09_mecho)C++14
5 / 100
19 ms28508 KiB
#include<bits/stdc++.h> using namespace std; #define int long long int int n,m; string s[3005]; int suff_o[3005][3005]; int suff_i[3005][3005]; int sum; int32_t main() { cin >> n >> m; for(int i=0;i<n;i++) cin >> s[i]; for(int i=0;i<n;i++) { for(int j=m-1;j>=0;j--) { suff_o[i][j]=suff_o[i][j+1]; if(s[i][j]=='O') suff_o[i][j]++; } } for(int i=0;i<m;i++) { for(int j=n-1;j>=0;j--) { suff_i[j][i]=suff_i[j+1][i]; if(s[j][i]=='I') suff_i[j][i]++; } } sum=0; for(int i=0;i<n;i++) { for(int j=0;j<m;j++) { if(s[i][j]=='J') { sum+=(suff_i[j][i])*(suff_o[i][j]); } } } cout << sum; }
#Verdict Execution timeMemoryGrader output
Fetching results...