#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
#pragma GCC optimize ("O4")
#pragma GCC optimize ("fast-math")
#pragma GCC optimize ("unroll-loops")
using namespace std;
#define int long long
#define ll long long
#define XX first
#define YY second
#define pb push_back
#define sz (x) int(x.size())
#define pf pop_front
#define pob pop_back
#define pff push_front
const int NMAX = 3e3;
int n, m;
char v[NMAX + 1][NMAX + 1];
int w[NMAX + 1][NMAX + 1];
int matrix[NMAX + 1][NMAX + 1];
signed main(void){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> n >> m;
for (int i = 1; i <= n; ++ i){
for (int j = 1; j <= m; ++ j){
cin >> v[i][j];
w[i][j] = v[i - 1][j];
matrix[i][j] = v[i][j - 1];
if (v[i][j] == 'O')
matrix[i][j] ++;
if (v[i][j] == 'I')
w[i][j] ++;
}
}
int sum = 0;
for (int i = 1; i <= n; ++ i){
for (int j = 1; j <= m; ++ j){
if (v[i][j] == 'J'){
sum += (w[n][j] - w[i - 1][j]) * (matrix[i][m] - matrix[i][j - 1]);
}
}
}
cout << sum << "\n";
return 0 ^ 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
4440 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
4440 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
4440 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |