제출 #1262551

#제출 시각아이디문제언어결과실행 시간메모리
1262551sohamsen15Bitaro the Brave (JOI19_ho_t1)C++20
0 / 100
0 ms324 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int h, w; cin >> h >> w;
    vector<vector<char>> a(h, vector<char>(w));

    for (int i = 0; i < h; i++) {
        string s; cin >> s;
        for (int j = 0; j < w; j++)
            a[i][j] = s[j];
    }

    vector<int> orbs(h);
    for (int i = 0; i < h; i++) {
        int curr = 0;
        for (int j = 0; j < w; j++)
            if (a[i][j] == 'O')
                curr++;
        orbs[i] = curr;
    }

    vector<int> ingots(w);
    for (int j = 0; j < w; j++) {
        int curr = 0;
        for (int i = 0; i < h; i++)
            if (a[i][j] == 'I')
                curr++;
        ingots[j] = curr;
    }

    vector<vector<int>> b(h, vector<int>(w, 0));
    for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++) 
            if (a[i][j] == 'J')
                b[i][j] = orbs[i] * ingots[j];

    int ans = 0;
    for (int i = 0; i < h; i++) 
        for (int j = 0; j < w; j++)
            ans += b[i][j];

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