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 mod 1000000007
#define nmax 3007
#define fi first
#define se second
#define ll long long
ll t=1,n,m=0,i=0,j=0,d=0,x=0,k=0,y=0,z,h[nmax][200],c[nmax][200];
char ch[3007][3007];
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>n>>m;
for(i=1;i<=n;++i)
{
for(j=1;j<=m;++j)
{
cin>>ch[i][j];
h[i][ch[i][j]]++;
c[j][ch[i][j]]++;
}
}
d=0;
for(i=1;i<=n;++i)
{
for(j=1;j<=m;++j)
{
h[i][ch[i][j]]--;
c[j][ch[i][j]]--;
if(ch[i][j]=='J')
{
d+=h[i]['O']*c[j]['I'];
}
}
}
cout<<d;
}
Compilation message (stderr)
joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:19:25: warning: array subscript has type 'char' [-Wchar-subscripts]
19 | h[i][ch[i][j]]++;
| ~~~~~~~^
joi2019_ho_t1.cpp:20:25: warning: array subscript has type 'char' [-Wchar-subscripts]
20 | c[j][ch[i][j]]++;
| ~~~~~~~^
joi2019_ho_t1.cpp:28:25: warning: array subscript has type 'char' [-Wchar-subscripts]
28 | h[i][ch[i][j]]--;
| ~~~~~~~^
joi2019_ho_t1.cpp:29:25: warning: array subscript has type 'char' [-Wchar-subscripts]
29 | c[j][ch[i][j]]--;
| ~~~~~~~^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |