#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define pb emplace_back
#define N 2010
char a[N][N];
int cnt[2][N];
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n,m,i,j;
cin>>n>>m;
for(i=0;i<n;i++){
for(j=0;j<m;j++){
cin>>a[i][j];
if(a[i][j]=='O') cnt[0][i]++;
else if(a[i][j]=='I') cnt[1][j]++;
}
}
int ans=0;
for(i=0;i<n;i++) for(j=0;j<m;j++)
if(a[i][j]=='J') ans+=cnt[1][i]*cnt[0][j];
cout<<ans<<'\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
312 KB |
Output is correct |
2 |
Correct |
1 ms |
324 KB |
Output is correct |
3 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
312 KB |
Output is correct |
2 |
Correct |
1 ms |
324 KB |
Output is correct |
3 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
312 KB |
Output is correct |
2 |
Correct |
1 ms |
324 KB |
Output is correct |
3 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |