# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
717867 | 2023-04-02T17:03:56 Z | blackslex | Bitaro the Brave (JOI19_ho_t1) | C++17 | 193 ms | 150252 KB |
#include<bits/stdc++.h> using namespace std; using ll = long long; const int N = 3005; int n, m, a[N][N][2], b[N][N][2]; ll ans; char c[N][N]; int main() { scanf("%d %d", &n, &m); for (int i = 1; i <= n; i++) scanf("%s", c[i] + 1); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (c[i][j] == 'O') a[i][j][0] = a[i - 1][j][0] + 1, b[i][j][0] = b[i][j - 1][0] + 1; else a[i][j][0] = a[i - 1][j][0], b[i][j][0] = b[i][j - 1][0]; if (c[i][j] == 'I') a[i][j][1] = a[i - 1][j][1] + 1, b[i][j][1] = b[i][j - 1][1] + 1; else a[i][j][1] = a[i - 1][j][1], b[i][j][1] = b[i][j - 1][1]; } } for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) if (c[i][j] == 'J') ans += (a[n][j][1] - a[i][j][1]) * (b[i][m][0] - b[i][j][0]); printf("%lld", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 1492 KB | Output is correct |
6 | Correct | 1 ms | 1492 KB | Output is correct |
7 | Correct | 1 ms | 1364 KB | Output is correct |
8 | Correct | 1 ms | 1492 KB | Output is correct |
9 | Correct | 1 ms | 1448 KB | Output is correct |
10 | Correct | 1 ms | 1364 KB | Output is correct |
11 | Correct | 1 ms | 1492 KB | Output is correct |
12 | Correct | 1 ms | 1492 KB | Output is correct |
13 | Correct | 1 ms | 1364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 1492 KB | Output is correct |
6 | Correct | 1 ms | 1492 KB | Output is correct |
7 | Correct | 1 ms | 1364 KB | Output is correct |
8 | Correct | 1 ms | 1492 KB | Output is correct |
9 | Correct | 1 ms | 1448 KB | Output is correct |
10 | Correct | 1 ms | 1364 KB | Output is correct |
11 | Correct | 1 ms | 1492 KB | Output is correct |
12 | Correct | 1 ms | 1492 KB | Output is correct |
13 | Correct | 1 ms | 1364 KB | Output is correct |
14 | Correct | 8 ms | 8752 KB | Output is correct |
15 | Correct | 3 ms | 4948 KB | Output is correct |
16 | Correct | 4 ms | 5204 KB | Output is correct |
17 | Correct | 1 ms | 468 KB | Output is correct |
18 | Correct | 8 ms | 9684 KB | Output is correct |
19 | Correct | 8 ms | 9556 KB | Output is correct |
20 | Correct | 8 ms | 9428 KB | Output is correct |
21 | Correct | 10 ms | 9684 KB | Output is correct |
22 | Correct | 6 ms | 9556 KB | Output is correct |
23 | Correct | 7 ms | 9428 KB | Output is correct |
24 | Correct | 9 ms | 9684 KB | Output is correct |
25 | Correct | 7 ms | 9556 KB | Output is correct |
26 | Correct | 8 ms | 9436 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 1492 KB | Output is correct |
6 | Correct | 1 ms | 1492 KB | Output is correct |
7 | Correct | 1 ms | 1364 KB | Output is correct |
8 | Correct | 1 ms | 1492 KB | Output is correct |
9 | Correct | 1 ms | 1448 KB | Output is correct |
10 | Correct | 1 ms | 1364 KB | Output is correct |
11 | Correct | 1 ms | 1492 KB | Output is correct |
12 | Correct | 1 ms | 1492 KB | Output is correct |
13 | Correct | 1 ms | 1364 KB | Output is correct |
14 | Correct | 8 ms | 8752 KB | Output is correct |
15 | Correct | 3 ms | 4948 KB | Output is correct |
16 | Correct | 4 ms | 5204 KB | Output is correct |
17 | Correct | 1 ms | 468 KB | Output is correct |
18 | Correct | 8 ms | 9684 KB | Output is correct |
19 | Correct | 8 ms | 9556 KB | Output is correct |
20 | Correct | 8 ms | 9428 KB | Output is correct |
21 | Correct | 10 ms | 9684 KB | Output is correct |
22 | Correct | 6 ms | 9556 KB | Output is correct |
23 | Correct | 7 ms | 9428 KB | Output is correct |
24 | Correct | 9 ms | 9684 KB | Output is correct |
25 | Correct | 7 ms | 9556 KB | Output is correct |
26 | Correct | 8 ms | 9436 KB | Output is correct |
27 | Correct | 182 ms | 150252 KB | Output is correct |
28 | Correct | 14 ms | 26276 KB | Output is correct |
29 | Correct | 13 ms | 13140 KB | Output is correct |
30 | Correct | 1 ms | 724 KB | Output is correct |
31 | Correct | 140 ms | 125188 KB | Output is correct |
32 | Correct | 120 ms | 150172 KB | Output is correct |
33 | Correct | 115 ms | 149688 KB | Output is correct |
34 | Correct | 170 ms | 145260 KB | Output is correct |
35 | Correct | 133 ms | 150144 KB | Output is correct |
36 | Correct | 120 ms | 149736 KB | Output is correct |
37 | Correct | 193 ms | 150252 KB | Output is correct |
38 | Correct | 94 ms | 124652 KB | Output is correct |
39 | Correct | 112 ms | 124684 KB | Output is correct |