Submission #947621

#TimeUsernameProblemLanguageResultExecution timeMemory
947621KongggwpMecho (IOI09_mecho)C++14
5 / 100
14 ms34164 KiB
#include<bits/stdc++.h> using namespace std; #define int long long int int n , m , ao[3005][3005] , ai[3005][3005] , sum; char a[3005][3005] ; int32_t main() { ios_base::sync_with_stdio(0);cin.tie(0); cin >> n >> m; for(int i=0 ; i<n ; i++) { for(int j=0 ; j<m ; j++) { cin >> a[i][j]; if(a[i][j]=='O')ao[i][j]++; if(a[i][j]=='I')ai[i][j]++; } } for(int i=n-1 ; i>=0 ; i--)for(int j=m-1 ; j>=0 ; j--)ao[i][j]+=ao[i][j+1] , ai[i][j]+=ai[i+1][j]; for(int i=n-1 ; i>=0 ; i--)for(int j=m-1 ; j>=0 ; j--)if(a[i][j]=='J')sum += ao[i][j] * ai[i][j]; cout << sum; }
#Verdict Execution timeMemoryGrader output
Fetching results...