이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ld, ld> pdd;
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int N = 3005;
int O[N][N];
int I[N][N];
bool is[N][N];
int main(){
fastIO;
int n, m;
cin >> n >> m;
char f;
for(int i = 1; i <= n; i ++ ){
for(int j = 1; j <= m ; j ++ ){
cin >> f;
if(f == 'J')
is[i][j] = true;
else if(f == 'O')
O[i][j] = 1;
else
I[i][j] = 1;
}
}
for(int i = 1; i <= n; i ++ ){
for(int j = 1; j <= m ; j ++ ){
O[i][j] += O[i][j-1];
I[i][j] += I[i-1][j];
}
}
ll res = 0;
for(int i = 1; i <= n; i ++ ){
for(int j = 1; j <= m; j ++ ){
res += is[i][j] * (O[i][m] - O[i][j]) * (I[n][j] - I[i][j]);
}
}
cout << res;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |