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 <iostream>
#include <vector>
using namespace std;
int main()
{
int n,m; cin>>n>>m;
char matrica[n][m];
vector<int> O(n),I(m);
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
char c; cin>>c;
matrica[i][j]=c;
if(c=='O')
{
O[i]++;
}
else if(c=='I')
{
I[j]++;
}
}
}
long long rez=0;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
if(matrica[i][j]=='J')
{
rez+=(O[i]*I[j]);
}
else if(matrica[i][j]=='O')
{
O[i]--;
}
else
{
I[j]--;
}
}
}
cout<<rez;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |