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