#include <bits/stdc++.h>
/// #pragma GCC optimize ("Ofast")
/// #pragma GCC target ("avx2")
/// #pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using ld = long double;
using ii = pair<ll, ll>;
using vi = vector<int>;
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lb lower_bound
#define int ll
#define double ld
const int MOD = 1000 * 1000 * 1000 + 7;
const double EPS = 1e-9;
int H, W, A[3001], B[3001];
char grid[3001][3001];
int32_t main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> H >> W;
for(int l = 0; l < H; l++)
for(int i = 0; i < W; i++)
cin >> grid[l][i];
int res = 0;
for(int l = 0; l < H; l++)
for(int i = 0; i < W; i++) {
if(grid[l][i] == 'O') A[l]++;
if(grid[l][i] == 'I') B[i]++;
}
for(int l = 0; l < H; l++)
for(int i = 0; i < W; i++)
if(grid[l][i] == 'J')
res += A[i] * B[l];
cout << res << "\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |