#include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
const int N = 3001,INF=1e12;
char arr[N][N];
int jew[N][N],ob[N][N],col[N][N];
int32_t main()
{
//freopen("abc.in", "r", stdin);
int h , w;
cin >> h >> w;
for(int i = 0 ; i < h ; i ++){
for(int j = 0 ; j < w; j ++){
cin>>arr[i][j];
if(arr[i][j]=='J')
jew[i][j]++;
else if(arr[i][j]=='O')
ob[i][j]++;
else if(arr[i][j]=='I')
col[i][j]++;
if(j) ob[i][j]+=ob[i][j-1],col[i][j]+=col[i][j-1];
}
}
int ans=0;
for(int i = 0; i < h ; i ++)
{
for(int j = 0 ; j < w ; j ++)
{
if(jew[i][j]){
ans+=(ob[i][w-1]-ob[i][j])*(col[h-1][j]-col[i][j]);
}
}
}
cout<<ans<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Incorrect |
1 ms |
468 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Incorrect |
1 ms |
468 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Incorrect |
1 ms |
468 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |