# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
947621 | Kongggwp | Mecho (IOI09_mecho) | C++14 | 14 ms | 34164 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |