#include <iostream>
#include <algorithm>
#define ll long long
#define ld long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
using namespace std;
const ll N = 5e5+100;
const ll MOD = 1e9+7;
char grid[3005][3005];
ll orb[3005];
ll ing[3005];
int main()
{
ios_base::sync_with_stdio(0);
//cin.tie(0);
ll n,m;
cin>>n>>m;
ll ans =0;
for(int i =1;i<=n;i++)
for(int j = 1;j<=m;j++)
cin>>grid[i][j];
for(int i =1;i<=n;i++){
for(int j =i;j<=m;j++) {
if(grid[i][j] == 'O')
orb[i]++;
}
}
for(int i =1;i<=m;i++){
for(int j =i;j<=n;j++) {
if(grid[j][i] == 'I')
ing[i]++;
}
}
for(int i =1;i<=n;i++){
for(int j =1;j<=m;j++){
if(grid[i][j] == 'J'){
ans += (orb[i] * ing[j]);
}
}
}
cout<<ans<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Incorrect |
5 ms |
376 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Incorrect |
5 ms |
376 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Incorrect |
5 ms |
376 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |