Submission #1093354

# Submission time Handle Problem Language Result Execution time Memory
1093354 2024-09-26T17:16:42 Z ortsac Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
412 ms 159316 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

const int MAXN = 3010;
int pfCol[MAXN][MAXN];
int pfRow[MAXN][MAXN];
char mat[MAXN][MAXN];

int32_t main() {
    //freopen("in", "r", stdin);
    int h, w;
    cin >> h >> w;
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            cin >> mat[i][j];
        }
    }
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            pfRow[i][j] = pfRow[i][j - 1];
            if (mat[i][j] == 'O') pfRow[i][j]++;
        }
    }
    for (int i = 1; i <= w; i++) {
        for (int j = 1; j <= h; j++) {
            pfCol[i][j] = pfCol[i][j - 1];
            if (mat[j][i] == 'I') pfCol[i][j]++; // coluna i, row j
        }
    }
    int ans = 0;
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            if (mat[i][j] == 'J') ans += ((pfRow[i][w] - pfRow[i][j - 1])*(pfCol[j][h] - pfCol[j][i - 1]));
        }
    }
    cout << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 352 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 1628 KB Output is correct
6 Correct 1 ms 1376 KB Output is correct
7 Correct 1 ms 1632 KB Output is correct
8 Correct 1 ms 1628 KB Output is correct
9 Correct 1 ms 1372 KB Output is correct
10 Correct 1 ms 1628 KB Output is correct
11 Correct 1 ms 1628 KB Output is correct
12 Correct 1 ms 1372 KB Output is correct
13 Correct 1 ms 1588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 352 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 1628 KB Output is correct
6 Correct 1 ms 1376 KB Output is correct
7 Correct 1 ms 1632 KB Output is correct
8 Correct 1 ms 1628 KB Output is correct
9 Correct 1 ms 1372 KB Output is correct
10 Correct 1 ms 1628 KB Output is correct
11 Correct 1 ms 1628 KB Output is correct
12 Correct 1 ms 1372 KB Output is correct
13 Correct 1 ms 1588 KB Output is correct
14 Correct 13 ms 8540 KB Output is correct
15 Correct 1 ms 3420 KB Output is correct
16 Correct 7 ms 6240 KB Output is correct
17 Correct 1 ms 1632 KB Output is correct
18 Correct 15 ms 10076 KB Output is correct
19 Correct 13 ms 9828 KB Output is correct
20 Correct 11 ms 9936 KB Output is correct
21 Correct 13 ms 10088 KB Output is correct
22 Correct 12 ms 9832 KB Output is correct
23 Correct 11 ms 9832 KB Output is correct
24 Correct 13 ms 10088 KB Output is correct
25 Correct 12 ms 9832 KB Output is correct
26 Correct 11 ms 9832 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 352 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 1628 KB Output is correct
6 Correct 1 ms 1376 KB Output is correct
7 Correct 1 ms 1632 KB Output is correct
8 Correct 1 ms 1628 KB Output is correct
9 Correct 1 ms 1372 KB Output is correct
10 Correct 1 ms 1628 KB Output is correct
11 Correct 1 ms 1628 KB Output is correct
12 Correct 1 ms 1372 KB Output is correct
13 Correct 1 ms 1588 KB Output is correct
14 Correct 13 ms 8540 KB Output is correct
15 Correct 1 ms 3420 KB Output is correct
16 Correct 7 ms 6240 KB Output is correct
17 Correct 1 ms 1632 KB Output is correct
18 Correct 15 ms 10076 KB Output is correct
19 Correct 13 ms 9828 KB Output is correct
20 Correct 11 ms 9936 KB Output is correct
21 Correct 13 ms 10088 KB Output is correct
22 Correct 12 ms 9832 KB Output is correct
23 Correct 11 ms 9832 KB Output is correct
24 Correct 13 ms 10088 KB Output is correct
25 Correct 12 ms 9832 KB Output is correct
26 Correct 11 ms 9832 KB Output is correct
27 Correct 412 ms 154976 KB Output is correct
28 Correct 8 ms 17000 KB Output is correct
29 Correct 31 ms 23032 KB Output is correct
30 Correct 5 ms 10088 KB Output is correct
31 Correct 304 ms 131556 KB Output is correct
32 Correct 350 ms 158800 KB Output is correct
33 Correct 361 ms 159060 KB Output is correct
34 Correct 345 ms 143184 KB Output is correct
35 Correct 358 ms 158804 KB Output is correct
36 Correct 349 ms 158960 KB Output is correct
37 Correct 410 ms 159316 KB Output is correct
38 Correct 269 ms 130644 KB Output is correct
39 Correct 251 ms 131156 KB Output is correct