Submission #465072

# Submission time Handle Problem Language Result Execution time Memory
465072 2021-08-15T06:59:22 Z Baray Bitaro the Brave (JOI19_ho_t1) C++17
0 / 100
31 ms 71060 KB
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <climits>
#include <deque>

using namespace std;

#define ll long long

int n, m, ans;
string matrix[3005];

int main() {
    cin >> n >> m;

    int preRight[3005][3005], preDown[3005][3005];
    
    for (int i = 1; i <= n; i++) {
        cin >> matrix[i];
    }

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            preRight[i][j] = preRight[i][j - 1];
            if (matrix[i][j] == 'O') {
                preRight[i][j]++;
            }
        }
    }

    for (int j = 1; j <= m; j++) {
        for (int i = 1; i <= m; i++) {
            preDown[i][j] = preDown[i][j - 1];
            if (matrix[i][j] == 'I') {
                preDown[i][j]++;
            }
        }
    }

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (matrix[i][j] == 'P') {
                ans += (preRight[i][m] - preRight[i][j]) * (preDown[n][j] - preDown[i][j]);
            }
        }
    }

    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 31 ms 71060 KB Output is correct
2 Incorrect 31 ms 70964 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 31 ms 71060 KB Output is correct
2 Incorrect 31 ms 70964 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 31 ms 71060 KB Output is correct
2 Incorrect 31 ms 70964 KB Output isn't correct
3 Halted 0 ms 0 KB -