Submission #1258712

#TimeUsernameProblemLanguageResultExecution timeMemory
1258712nasufyroBitaro the Brave (JOI19_ho_t1)C++20
0 / 100
0 ms328 KiB
#include <bits/stdc++.h>
using namespace std;
long long h, w;
vector<string> board;
vector<long long> row, col;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> h >> w;
    board.resize(h+1);
    row.resize(h+1);
    col.resize(w+1);
    for (long long i = 1; i <= h; i++) {
        cin >> board[i];
        for(long long j=1; j <= w; j++) {
            if(board[i][j-1]=='O')
            {
                row[i]++;
            }
            else if(board[i][j-1]=='I')
            {
                col[j]++;
            }
        }
    }
    long long ans = 0;
    for(long long i = 1; i <= h; i++) {
        for(long long j = 1; j <= w; j++) {
            if(board[i][j-1] == 'J') {
                ans += row[i]*col[j];
            } 
        }
    }
    cout << ans;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...