제출 #1180660

#제출 시각아이디문제언어결과실행 시간메모리
1180660takoshanavaBitaro the Brave (JOI19_ho_t1)C++20
50 / 100
1094 ms12048 KiB
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fs first
#define sc second
using namespace std;

int h, w;
const int maxw = 3005;
int cntj[maxw];
string s[maxw];

signed main() {
    cin >> h >> w;
    for (int i = 0; i < h; i++){
        cin >> s[i];
    }

    long long ans = 0;
    for (int i = 0; i < w; i++){
        cntj[i] = 0;
    }

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (s[i][j] == 'O') {
                for (int k = 0; k < j; k++) {
                    if (s[i][k] == 'J') {
                        cntj[k]++;
                    }
                }
            }
        }
        for (int j = 0; j < w; j++) {
            if (s[i][j] == 'I') {
                ans += cntj[j];
            }
        }
    }

    cout << ans << endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...