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