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;
const int MAXN= 3e3 + 11;
using ll = long long;
int H,W;
string S[MAXN];
int cntI[MAXN];
int cntO[MAXN];
ll ans;
int main()
{
cin.tie(0);
cout.tie(0);
cin >> H >> W;
for(int i = 0;i<H;i++)
{
cin>>S[i];
}
for(int i =0;i<H;i++)
{
for(int j = 0;j<W;j++)
{
cntO[i]+=(S[i][j] == 'O');
cntI[j]+=(S[i][j] == 'I');
}
}
for(int i = 0;i<H;i++)
{
for(int j = 0;j<W;j++)
{
if(S[i][j] == 'J')
{
ans+=(cntO[i]*cntI[j]);
}
}
}
cout<<ans<<'\n';
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... |