이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int nx=3e3+100;
long long h, w, dpr[nx], dpc[nx], ans;
char c[nx][nx];
vector<pair<int, int>> v;
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>h>>w;
for (int i=1; i<=h; i++) for (int j=1; j<=w; j++) cin>>c[i][j];
for (int i=h; i>=1; i--)
{
for (int j=w; j>=1; j--)
{
if (c[i][j]=='J') ans+=dpc[j]*dpr[i];
if (c[i][j]=='O') dpr[i]++;
if (c[i][j]=='I') dpc[j]++;
}
}
cout<<ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |