Submission #206964

# Submission time Handle Problem Language Result Execution time Memory
206964 2020-03-06T02:07:08 Z joylintp Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
403 ms 88448 KB
#include<bits/stdc++.h>
using namespace std;

char mp[3000][3000];
int n, m, cc[2][3000][3000];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> m;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++)
            cin >> mp[i][j];

    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++)
            if (mp[i][j] == 'O')
                cc[0][i][j]++;
            else if (mp[i][j] == 'I')
                cc[1][i][j]++;
            else;

    for (int i = 0; i < n; i++)
        for (int j = m - 2; j >= 0; j--)
            cc[0][i][j] += cc[0][i][j + 1];
    for (int j = 0; j < m; j++)
        for (int i = n - 2; i >= 0; i--)
            cc[1][i][j] += cc[1][i + 1][j];

    long long ans = 0;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++)
            if (mp[i][j] == 'J')
                ans += (long long)cc[0][i][j] * cc[1][i][j];
    cout << ans << '\n';

    return 0;
}

//      *   *  *****  *   *  *   *
//     *   *  *      **  *  *   *
//    *****  *****  * * *  *   *
//   *   *      *  *  **  *   *
//  *   *  *****  *   *   ***

//      ***** ***** *   * *     ***** *   * ***** *****
//        *  *   * *   * *       *   **  *   *   *   *
//       *  *   * ***** *       *   * * *   *   *****
//   *  *  *   *   *   *       *   *  **   *   *
//  ****  *****   *   ***** ***** *   *   *   *
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 6 ms 1528 KB Output is correct
6 Correct 5 ms 1528 KB Output is correct
7 Correct 5 ms 1400 KB Output is correct
8 Correct 5 ms 1528 KB Output is correct
9 Correct 5 ms 1528 KB Output is correct
10 Correct 5 ms 1400 KB Output is correct
11 Correct 6 ms 1528 KB Output is correct
12 Correct 5 ms 1528 KB Output is correct
13 Correct 5 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 6 ms 1528 KB Output is correct
6 Correct 5 ms 1528 KB Output is correct
7 Correct 5 ms 1400 KB Output is correct
8 Correct 5 ms 1528 KB Output is correct
9 Correct 5 ms 1528 KB Output is correct
10 Correct 5 ms 1400 KB Output is correct
11 Correct 6 ms 1528 KB Output is correct
12 Correct 5 ms 1528 KB Output is correct
13 Correct 5 ms 1400 KB Output is correct
14 Correct 15 ms 7544 KB Output is correct
15 Correct 7 ms 4984 KB Output is correct
16 Correct 9 ms 4344 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 16 ms 8056 KB Output is correct
19 Correct 14 ms 7928 KB Output is correct
20 Correct 15 ms 7928 KB Output is correct
21 Correct 16 ms 7960 KB Output is correct
22 Correct 13 ms 7932 KB Output is correct
23 Correct 13 ms 7928 KB Output is correct
24 Correct 16 ms 8056 KB Output is correct
25 Correct 13 ms 7928 KB Output is correct
26 Correct 13 ms 7932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 6 ms 1528 KB Output is correct
6 Correct 5 ms 1528 KB Output is correct
7 Correct 5 ms 1400 KB Output is correct
8 Correct 5 ms 1528 KB Output is correct
9 Correct 5 ms 1528 KB Output is correct
10 Correct 5 ms 1400 KB Output is correct
11 Correct 6 ms 1528 KB Output is correct
12 Correct 5 ms 1528 KB Output is correct
13 Correct 5 ms 1400 KB Output is correct
14 Correct 15 ms 7544 KB Output is correct
15 Correct 7 ms 4984 KB Output is correct
16 Correct 9 ms 4344 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 16 ms 8056 KB Output is correct
19 Correct 14 ms 7928 KB Output is correct
20 Correct 15 ms 7928 KB Output is correct
21 Correct 16 ms 7960 KB Output is correct
22 Correct 13 ms 7932 KB Output is correct
23 Correct 13 ms 7928 KB Output is correct
24 Correct 16 ms 8056 KB Output is correct
25 Correct 13 ms 7928 KB Output is correct
26 Correct 13 ms 7932 KB Output is correct
27 Correct 377 ms 87928 KB Output is correct
28 Correct 17 ms 25976 KB Output is correct
29 Correct 22 ms 7800 KB Output is correct
30 Correct 6 ms 632 KB Output is correct
31 Correct 284 ms 72568 KB Output is correct
32 Correct 304 ms 88312 KB Output is correct
33 Correct 291 ms 88184 KB Output is correct
34 Correct 330 ms 84092 KB Output is correct
35 Correct 312 ms 88440 KB Output is correct
36 Correct 307 ms 88184 KB Output is correct
37 Correct 403 ms 88448 KB Output is correct
38 Correct 223 ms 72568 KB Output is correct
39 Correct 206 ms 72184 KB Output is correct