이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define N 3005
#define pii pair<int,int>
int h, w, ans;
char c;
int o[N][N], i[N][N];
vector<pii> j;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> h >> w;
for (int x=1; x<=h; x++)
for (int y=1; y<=w; y++)
{
cin >> c;
if (c=='J') j.push_back({x,y});
o[x][y]=o[x][y-1]+(c=='O');
i[x][y]=i[x-1][y]+(c=='I');
}
ans=0;
for (auto now:j)
{
int a=now.first, b=now.second;
ans+=(o[a][w]-o[a][b])*(i[h][b]-i[a][b]);
}
cout << ans;
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... |