이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define LL long long
LL n, m, br, lo[3009][3009], li[3009][3009];
char zad[3009][3009];
int main(){
ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> m;
for(int i=0; i<n; i++) for(int j=0; j<m; j++) cin >> zad[i][j];
for(int i=0; i<n; i++){
br = 0;
for(int j=m-1; j >= 0; j--){
if (zad[i][j] == 'O') br++;
lo[i][j] = br;
}
}
for(int j=0; j<m; j++){
br = 0;
for(int i=n-1; i >= 0; i--){
if (zad[i][j] == 'I') br++;
li[i][j] = br;
}
}
br = 0;
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
if (zad[i][j] == 'J') br += lo[i][j] * li[i][j];
}
}
cout << br; 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... |