Submission #1046637

# Submission time Handle Problem Language Result Execution time Memory
1046637 2024-08-06T19:09:38 Z DeathIsAwe Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
248 ms 91220 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
    int h, w; cin >> h >> w;
    vector<string> grid(h);
    for (int i=0;i<h;i++) {
        cin >> grid[i];
    }
    vector<vector<int>> numsbelow, numsright;
    vector<int> bruh(w);
    for (int i=0;i<h;i++) {
        numsbelow.push_back(bruh);
        numsright.push_back(bruh);
    }



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


    ll ans = 0;
    for (int i=0;i<h;i++) {
        for (int j=0;j<w;j++) {
            if (grid[i][j] == 'J') {
                ans += numsbelow[i][j] * numsright[i][j];
            }
        }
    }
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 6 ms 2396 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 2 ms 1628 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 7 ms 3184 KB Output is correct
19 Correct 6 ms 2648 KB Output is correct
20 Correct 5 ms 2908 KB Output is correct
21 Correct 7 ms 3164 KB Output is correct
22 Correct 4 ms 2652 KB Output is correct
23 Correct 6 ms 3004 KB Output is correct
24 Correct 7 ms 3164 KB Output is correct
25 Correct 4 ms 2824 KB Output is correct
26 Correct 4 ms 2908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 6 ms 2396 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 2 ms 1628 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 7 ms 3184 KB Output is correct
19 Correct 6 ms 2648 KB Output is correct
20 Correct 5 ms 2908 KB Output is correct
21 Correct 7 ms 3164 KB Output is correct
22 Correct 4 ms 2652 KB Output is correct
23 Correct 6 ms 3004 KB Output is correct
24 Correct 7 ms 3164 KB Output is correct
25 Correct 4 ms 2824 KB Output is correct
26 Correct 4 ms 2908 KB Output is correct
27 Correct 231 ms 86884 KB Output is correct
28 Correct 1 ms 856 KB Output is correct
29 Correct 11 ms 7008 KB Output is correct
30 Correct 1 ms 608 KB Output is correct
31 Correct 169 ms 65180 KB Output is correct
32 Correct 159 ms 90628 KB Output is correct
33 Correct 164 ms 91012 KB Output is correct
34 Correct 200 ms 75348 KB Output is correct
35 Correct 178 ms 90704 KB Output is correct
36 Correct 164 ms 90964 KB Output is correct
37 Correct 248 ms 91220 KB Output is correct
38 Correct 111 ms 64596 KB Output is correct
39 Correct 120 ms 64852 KB Output is correct