Submission #543734

# Submission time Handle Problem Language Result Execution time Memory
543734 2022-03-31T09:40:32 Z tudor Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
405 ms 91060 KB
#include <iostream>
#include <string>

using namespace std;
const int nmax = 3000;
string s[nmax];
int O[nmax][nmax + 1];
int I[nmax + 1][nmax];
int main() {
    int n, m;
    cin >> n >> m;
    for ( int i = 0; i < n; i++ )
        cin >> s[i];

    for ( int i = 0; i < n; i++ )
        for ( int j = m - 1; j >= 0; j-- )
            O[i][j] = O[i][j + 1] + ( s[i][j] == 'O' );

    for ( int j = 0; j < m; j++ )
        for ( int i = n - 1; i >= 0; i-- )
            I[i][j] = I[i + 1][j] + ( s[i][j] == 'I' );

    long long cate = 0;
    for ( int i = 0; i < n; i++ )
        for ( int j = 0; j < m; j++ )
            if ( s[i][j] == 'J' )
                cate += ( long long ) O[i][j + 1] * I[i + 1][j];

    cout << cate;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 404 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 1236 KB Output is correct
6 Correct 1 ms 1236 KB Output is correct
7 Correct 1 ms 1176 KB Output is correct
8 Correct 1 ms 1236 KB Output is correct
9 Correct 1 ms 1236 KB Output is correct
10 Correct 1 ms 1108 KB Output is correct
11 Correct 1 ms 1308 KB Output is correct
12 Correct 1 ms 1236 KB Output is correct
13 Correct 1 ms 1108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 404 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 1236 KB Output is correct
6 Correct 1 ms 1236 KB Output is correct
7 Correct 1 ms 1176 KB Output is correct
8 Correct 1 ms 1236 KB Output is correct
9 Correct 1 ms 1236 KB Output is correct
10 Correct 1 ms 1108 KB Output is correct
11 Correct 1 ms 1308 KB Output is correct
12 Correct 1 ms 1236 KB Output is correct
13 Correct 1 ms 1108 KB Output is correct
14 Correct 9 ms 6228 KB Output is correct
15 Correct 2 ms 3796 KB Output is correct
16 Correct 6 ms 3796 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 11 ms 7064 KB Output is correct
19 Correct 10 ms 6740 KB Output is correct
20 Correct 10 ms 6940 KB Output is correct
21 Correct 11 ms 7068 KB Output is correct
22 Correct 10 ms 6740 KB Output is correct
23 Correct 9 ms 6860 KB Output is correct
24 Correct 12 ms 6996 KB Output is correct
25 Correct 11 ms 6632 KB Output is correct
26 Correct 10 ms 6924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 404 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 1236 KB Output is correct
6 Correct 1 ms 1236 KB Output is correct
7 Correct 1 ms 1176 KB Output is correct
8 Correct 1 ms 1236 KB Output is correct
9 Correct 1 ms 1236 KB Output is correct
10 Correct 1 ms 1108 KB Output is correct
11 Correct 1 ms 1308 KB Output is correct
12 Correct 1 ms 1236 KB Output is correct
13 Correct 1 ms 1108 KB Output is correct
14 Correct 9 ms 6228 KB Output is correct
15 Correct 2 ms 3796 KB Output is correct
16 Correct 6 ms 3796 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 11 ms 7064 KB Output is correct
19 Correct 10 ms 6740 KB Output is correct
20 Correct 10 ms 6940 KB Output is correct
21 Correct 11 ms 7068 KB Output is correct
22 Correct 10 ms 6740 KB Output is correct
23 Correct 9 ms 6860 KB Output is correct
24 Correct 12 ms 6996 KB Output is correct
25 Correct 11 ms 6632 KB Output is correct
26 Correct 10 ms 6924 KB Output is correct
27 Correct 383 ms 90396 KB Output is correct
28 Correct 13 ms 19188 KB Output is correct
29 Correct 20 ms 7964 KB Output is correct
30 Correct 1 ms 672 KB Output is correct
31 Correct 290 ms 74540 KB Output is correct
32 Correct 384 ms 90840 KB Output is correct
33 Correct 381 ms 90704 KB Output is correct
34 Correct 329 ms 86476 KB Output is correct
35 Correct 377 ms 90828 KB Output is correct
36 Correct 365 ms 90620 KB Output is correct
37 Correct 405 ms 91060 KB Output is correct
38 Correct 284 ms 74544 KB Output is correct
39 Correct 259 ms 74268 KB Output is correct