# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
374755 | daniel920712 | Bitaro the Brave (JOI19_ho_t1) | C++14 | 8 ms | 2156 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 <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
using namespace std;
int con1[5][3005]={0};
int con2[5][3005]={0};
char all[3005][3005];
int main()
{
int N,M,ans=0,i,j;
scanf("%d %d",&N,&M);
for(i=0;i<N;i++)
{
scanf("%s",all[i]);
for(j=0;j<M;j++)
{
if(all[i][j]=='J')
{
con1[0][i]++;
con2[0][j]++;
}
else if(all[i][j]=='O')
{
con1[1][i]++;
con2[1][j]++;
}
else
{
con1[2][i]++;
con2[2][j]++;
}
}
}
for(i=0;i<N;i++)
{
for(j=0;j<M;j++)
{
if(all[i][j]=='J') ans+=(con1[1][i])*(con2[2][j]);
if(all[i][j]=='J')
{
con1[0][i]--;
con2[0][j]--;
}
else if(all[i][j]=='O')
{
con1[1][i]--;
con2[1][j]--;
}
else
{
con1[2][i]--;
con2[2][j]--;
}
}
}
printf("%d\n",ans);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |