제출 #209238

#제출 시각아이디문제언어결과실행 시간메모리
209238my99nBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
592 ms82448 KiB
#include<bits/stdc++.h>
using namespace std;


string tab[3010];
int O[3010][3010], I[3010][3010];
int main(){
    int h, w; scanf("%d %d", &h, &w);
    for (int i = 0; i < h; i++) cin >> tab[i];
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (tab[i][j] == 'O') O[i+1][j+1] = 1;
            if (tab[i][j] == 'I') I[i+1][j+1] = 1;
            O[i+1][j+1] += O[i+1][j];
            I[i+1][j+1] += I[i][j+1];
        }
    }
    long long ans = 0;
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            if (tab[i-1][j-1] == 'J') {
                ans += (O[i][w]-O[i][j-1]) * (I[h][j]-I[i-1][j]);
            }
        }
    }
    printf("%lld", ans);
    return 0;
}

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

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:8:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int h, w; scanf("%d %d", &h, &w);
               ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...