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