제출 #1258785

#제출 시각아이디문제언어결과실행 시간메모리
1258785khanhttBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
102 ms80020 KiB
#include <iostream>
using namespace std;
int h,w,O[3005][3005],I[3005][3005];
long long res=0;
string A[3005];
main(){
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> h >> w;
    for (int i=1; i<=h; i++){
        cin >> A[i];
        A[i]="#"+A[i];
    }
    for (int i=1; i<=h; i++){
        for (int j=1; j<=w; j++){
            O[i][j]=O[i][j-1]+(A[i][j]=='O');
        }
    }
    for (int i=1; i<=h; i++){
        for (int j=1; j<=w; j++){
            I[i][j]=I[i-1][j]+(A[i][j]=='I');
        }
    }
    for (int i=1; i<=h; i++){
        for (int j=1; j<=w; j++){
            if (A[i][j]=='J'){
                long long left=O[i][w]-O[i][j],down=I[h][j]-I[i][j];
                res+=left*down;
            }
        }
    }
    cout << res;
}

컴파일 시 표준 에러 (stderr) 메시지

joi2019_ho_t1.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...