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 optimizar_io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);cout.setf(ios::fixed);cout.precision(0);
#pragma GCC optimize("Ofast")
typedef long long ll;
#define double long double
int main()
{
optimizar_io
ll n,m;
cin>>n>>m;
char cad[n][m];
ll I[m]={ },O[n]={ };
for(int i=0; i<n; i++)
{
for(int j=0; j<m; j++)
{
cin>>cad[i][j];
if(cad[i][j]=='O')
O[i]++;
if(cad[i][j]=='I')
I[j]++;
}
}
ll cont=0;
for(int i=0; i<n; i++)
{
for(int j=0; j<m; j++)
{
if(cad[i][j]=='J')
cont+=(O[i]*I[j]);
if(cad[i][j]=='O')
O[i]--;
if(cad[i][j]=='I')
I[j]--;
}
}
cout<<cont;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |