#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
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]]--;
| ~~~~~~~^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
Output is correct |
2 |
Correct |
1 ms |
4440 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Correct |
1 ms |
6744 KB |
Output is correct |
6 |
Correct |
1 ms |
6748 KB |
Output is correct |
7 |
Correct |
1 ms |
6748 KB |
Output is correct |
8 |
Correct |
1 ms |
6748 KB |
Output is correct |
9 |
Correct |
1 ms |
6748 KB |
Output is correct |
10 |
Correct |
1 ms |
6748 KB |
Output is correct |
11 |
Correct |
1 ms |
6744 KB |
Output is correct |
12 |
Correct |
1 ms |
6748 KB |
Output is correct |
13 |
Correct |
1 ms |
6748 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
Output is correct |
2 |
Correct |
1 ms |
4440 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Correct |
1 ms |
6744 KB |
Output is correct |
6 |
Correct |
1 ms |
6748 KB |
Output is correct |
7 |
Correct |
1 ms |
6748 KB |
Output is correct |
8 |
Correct |
1 ms |
6748 KB |
Output is correct |
9 |
Correct |
1 ms |
6748 KB |
Output is correct |
10 |
Correct |
1 ms |
6748 KB |
Output is correct |
11 |
Correct |
1 ms |
6744 KB |
Output is correct |
12 |
Correct |
1 ms |
6748 KB |
Output is correct |
13 |
Correct |
1 ms |
6748 KB |
Output is correct |
14 |
Correct |
3 ms |
6748 KB |
Output is correct |
15 |
Correct |
1 ms |
6748 KB |
Output is correct |
16 |
Correct |
2 ms |
6748 KB |
Output is correct |
17 |
Correct |
1 ms |
4444 KB |
Output is correct |
18 |
Correct |
4 ms |
6748 KB |
Output is correct |
19 |
Correct |
3 ms |
6748 KB |
Output is correct |
20 |
Correct |
3 ms |
6748 KB |
Output is correct |
21 |
Correct |
4 ms |
6748 KB |
Output is correct |
22 |
Correct |
4 ms |
6748 KB |
Output is correct |
23 |
Correct |
3 ms |
7000 KB |
Output is correct |
24 |
Correct |
4 ms |
6748 KB |
Output is correct |
25 |
Correct |
5 ms |
6796 KB |
Output is correct |
26 |
Correct |
3 ms |
6744 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
Output is correct |
2 |
Correct |
1 ms |
4440 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Correct |
1 ms |
6744 KB |
Output is correct |
6 |
Correct |
1 ms |
6748 KB |
Output is correct |
7 |
Correct |
1 ms |
6748 KB |
Output is correct |
8 |
Correct |
1 ms |
6748 KB |
Output is correct |
9 |
Correct |
1 ms |
6748 KB |
Output is correct |
10 |
Correct |
1 ms |
6748 KB |
Output is correct |
11 |
Correct |
1 ms |
6744 KB |
Output is correct |
12 |
Correct |
1 ms |
6748 KB |
Output is correct |
13 |
Correct |
1 ms |
6748 KB |
Output is correct |
14 |
Correct |
3 ms |
6748 KB |
Output is correct |
15 |
Correct |
1 ms |
6748 KB |
Output is correct |
16 |
Correct |
2 ms |
6748 KB |
Output is correct |
17 |
Correct |
1 ms |
4444 KB |
Output is correct |
18 |
Correct |
4 ms |
6748 KB |
Output is correct |
19 |
Correct |
3 ms |
6748 KB |
Output is correct |
20 |
Correct |
3 ms |
6748 KB |
Output is correct |
21 |
Correct |
4 ms |
6748 KB |
Output is correct |
22 |
Correct |
4 ms |
6748 KB |
Output is correct |
23 |
Correct |
3 ms |
7000 KB |
Output is correct |
24 |
Correct |
4 ms |
6748 KB |
Output is correct |
25 |
Correct |
5 ms |
6796 KB |
Output is correct |
26 |
Correct |
3 ms |
6744 KB |
Output is correct |
27 |
Correct |
114 ms |
18516 KB |
Output is correct |
28 |
Correct |
2 ms |
15452 KB |
Output is correct |
29 |
Correct |
11 ms |
8848 KB |
Output is correct |
30 |
Correct |
1 ms |
6492 KB |
Output is correct |
31 |
Correct |
82 ms |
17816 KB |
Output is correct |
32 |
Correct |
95 ms |
18572 KB |
Output is correct |
33 |
Correct |
98 ms |
18572 KB |
Output is correct |
34 |
Correct |
103 ms |
18312 KB |
Output is correct |
35 |
Correct |
126 ms |
18548 KB |
Output is correct |
36 |
Correct |
96 ms |
18512 KB |
Output is correct |
37 |
Correct |
127 ms |
18512 KB |
Output is correct |
38 |
Correct |
66 ms |
17796 KB |
Output is correct |
39 |
Correct |
67 ms |
17748 KB |
Output is correct |