제출 #1357575

#제출 시각아이디문제언어결과실행 시간메모리
1357575gvancakBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
370 ms79808 KiB
#include <bits/stdc++.h>
using namespace std;
int t[3005][3005],c[3005][3005];
int main()
{
    int s,b,d,f;
    long long ans=0;
    int o=0;
    int h=0;
    cin>>s>>b;
    char w[s+5][b+5];
    for (int i=1;i<=s;i++)
    for (int j=1;j<=b;j++)
    cin>>w[i][j];
    
    for(int i=1;i<=s;i++)
    for(int j=b;j>=1;j--)
    {
    t[i][j]=t[i][j+1];
    if (w[i][j]=='O') t[i][j]++;
    }
    for(int j=1;j<=b;j++)
    for(int i=s;i>=1;i--)
    {
    c[i][j]=c[i+1][j];
    if (w[i][j]=='I') c[i][j]++;
    }
    for(int i=1;i<=s;i++)
    for(int j=1;j<=b;j++)
    if (w[i][j]=='J')
    {
        ans=ans+(c[i][j]*t[i][j]);
    }
    cout<<ans;
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…