Submission #610977

# Submission time Handle Problem Language Result Execution time Memory
610977 2022-07-28T20:58:34 Z four_specks Bitaro the Brave (JOI19_ho_t1) C++17
20 / 100
5 ms 2772 KB
#include <bits/stdc++.h>

using namespace std;

inline namespace
{
} // namespace

void solve()
{
    int n, m;
    cin >> n >> m;

    vector<string> a(n);
    for (string &s : a)
        cin >> s;

    vector suff1(n, vector<int>(m + 1, 0)), suff2(m, vector<int>(n + 1, 0));
    for (int i = 0; i < n; i++)
    {
        for (int j = m - 1; j >= 0; j--)
            suff1[i][j] = suff1[i][j + 1] + (a[i][j] == 'O');
    }
    for (int i = 0; i < m; i++)
    {
        for (int j = n - 1; j >= 0; j--)
            suff2[i][j] = suff2[i][j + 1] + (a[j][i] == 'I');
    }

    int res = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            if (a[i][j] == 'J')
                res += suff1[i][j] * suff2[j][i];
        }
    }

    cout << res << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false), cin.tie(NULL);

    solve();

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 320 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 320 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 4 ms 2248 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 3 ms 1620 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 5 ms 2764 KB Output is correct
19 Correct 4 ms 2640 KB Output is correct
20 Incorrect 3 ms 2772 KB Output isn't correct
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 320 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 4 ms 2248 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 3 ms 1620 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 5 ms 2764 KB Output is correct
19 Correct 4 ms 2640 KB Output is correct
20 Incorrect 3 ms 2772 KB Output isn't correct
21 Halted 0 ms 0 KB -