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>
#define ll long long
using namespace std;
ll n,m,orb[3003][3003],ingot[3003][3003],kq = 0;
char a[3003][3003];
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> m;
for(int i = 1; i <= n; i++)
for(int j = 1; j <= m; j++)
cin >> a[i][j];
memset(orb,0,sizeof(orb));
memset(ingot,0,sizeof(ingot));
for(int i = 1; i <= n; i++)
for(int j = 1; j <= m; j++)
{
orb[i][j] = orb[i][j-1] + (a[i][j] == 'O');
}
for(int j = 1; j <= m; j++)
for(int i = 1; i <= n; i++)
ingot[i][j] = ingot[i-1][j] + (a[i][j] == 'I');
for(int i = 1; i <= n; i++)
for(int j = 1; j <= m; j++)
if(a[i][j] == 'J')
kq += (orb[i][m] - orb[i][j]) * (ingot[n][j] - ingot[i][j]);
cout << kq;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |