Submission #586951

# Submission time Handle Problem Language Result Execution time Memory
586951 2022-07-01T06:21:11 Z Justin1 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
767 ms 159032 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;

ll n,m,k,x,y,z;
ll O[3005][3005], I[3005][3005];
char ar[3005][3005];

int main() {
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            cin >> ar[i][j];
        }
    }
    for (int i = 1; i <= n; i++) {
        for (int j = m; j >= 1; j--) O[i][j] = O[i][j+1] + (ar[i][j] == 'O');
    }
    for (int i = 1; i <= m; i++) {
        for (int j = n; j >= 1; j--) I[j][i] = I[j+1][i] + (ar[j][i] == 'I');
    }
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (ar[i][j] == 'J') ans += O[i][j] * I[i][j];
        }
    }
    cout << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 2 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 2 ms 1364 KB Output is correct
11 Correct 2 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 1 ms 212 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 2 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 2 ms 1364 KB Output is correct
11 Correct 2 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 17 ms 8916 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 11 ms 5204 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 21 ms 9924 KB Output is correct
19 Correct 21 ms 9676 KB Output is correct
20 Correct 20 ms 9724 KB Output is correct
21 Correct 21 ms 9892 KB Output is correct
22 Correct 20 ms 9812 KB Output is correct
23 Correct 20 ms 9676 KB Output is correct
24 Correct 23 ms 9932 KB Output is correct
25 Correct 23 ms 9784 KB Output is correct
26 Correct 21 ms 9752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 2 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 2 ms 1364 KB Output is correct
11 Correct 2 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 17 ms 8916 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 11 ms 5204 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 21 ms 9924 KB Output is correct
19 Correct 21 ms 9676 KB Output is correct
20 Correct 20 ms 9724 KB Output is correct
21 Correct 21 ms 9892 KB Output is correct
22 Correct 20 ms 9812 KB Output is correct
23 Correct 20 ms 9676 KB Output is correct
24 Correct 23 ms 9932 KB Output is correct
25 Correct 23 ms 9784 KB Output is correct
26 Correct 21 ms 9752 KB Output is correct
27 Correct 742 ms 158476 KB Output is correct
28 Correct 14 ms 26196 KB Output is correct
29 Correct 49 ms 13776 KB Output is correct
30 Correct 3 ms 724 KB Output is correct
31 Correct 527 ms 131280 KB Output is correct
32 Correct 749 ms 158944 KB Output is correct
33 Correct 742 ms 158500 KB Output is correct
34 Correct 636 ms 152308 KB Output is correct
35 Correct 732 ms 158916 KB Output is correct
36 Correct 738 ms 158476 KB Output is correct
37 Correct 767 ms 159032 KB Output is correct
38 Correct 528 ms 130668 KB Output is correct
39 Correct 512 ms 130828 KB Output is correct