Submission #591153

# Submission time Handle Problem Language Result Execution time Memory
591153 2022-07-06T23:14:53 Z dryeab Bitaro the Brave (JOI19_ho_t1) C++17
0 / 100
1 ms 340 KB
#include <bits/stdc++.h>

using namespace std;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);

    int h, w;
    cin >> h >> w;

    vector<vector<char>> grid(h, vector<char>(w)), mark(h, vector<char>(w));

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

    int ok, res = 0;

    for (int i = 0; i < w; ++i) {
        ok = 0;
        for (int j = h - 1; j >= 0; --j) {
            if (grid[j][i] == 'I')
                ok++;
            else if (grid[j][i] == 'J')
                mark[j][i] = ok;
        }
    }

    for (int i = 0; i < h; ++i) {
        ok = 0;
        for (int j = w - 1; j >= 0; --j) {
            if (grid[i][j] == 'O')
                ok++;
            else if (grid[i][j] == 'J') {
                mark[i][j] *= ok;
                res += mark[i][j];
            }
        }
    }

    cout << res;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 1 ms 340 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 1 ms 340 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 1 ms 340 KB Output isn't correct
6 Halted 0 ms 0 KB -