Submission #703662

# Submission time Handle Problem Language Result Execution time Memory
703662 2023-02-28T04:51:36 Z qwe1rt1yuiop1 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
264 ms 160220 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

inline void solve()
{
    int n, m;
    cin >> n >> m;
    vector<string> v(n);
    for (auto &i : v)
        cin >> i;
    
    vector<vector<int>> ii(n + 1, vector<int>(m + 1, 0)), oo(ii);
    for (int i = n - 1; i >= 0; --i)
        for (int j = 0; j < m; ++j)
            ii[i][j] = ii[i + 1][j] + (v[i][j] == 'I');
    for (int j = m - 1; j >= 0; --j)
        for (int i = 0; i < n; ++i)
            oo[i][j] = oo[i][j + 1] + (v[i][j] == 'O');
    
    int ans = 0;
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j)
            if (v[i][j] == 'J')
                ans += ii[i][j] * oo[i][j];
    cout << ans << '\n';
}

signed main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    solve();

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 456 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 452 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 1 ms 468 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 456 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 452 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 1 ms 468 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 3 ms 3656 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 2 ms 2636 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 5 ms 4692 KB Output is correct
19 Correct 4 ms 4552 KB Output is correct
20 Correct 4 ms 4692 KB Output is correct
21 Correct 4 ms 4792 KB Output is correct
22 Correct 4 ms 4564 KB Output is correct
23 Correct 4 ms 4684 KB Output is correct
24 Correct 5 ms 4684 KB Output is correct
25 Correct 4 ms 4564 KB Output is correct
26 Correct 4 ms 4692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 456 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 452 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 1 ms 468 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 3 ms 3656 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 2 ms 2636 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 5 ms 4692 KB Output is correct
19 Correct 4 ms 4552 KB Output is correct
20 Correct 4 ms 4692 KB Output is correct
21 Correct 4 ms 4792 KB Output is correct
22 Correct 4 ms 4564 KB Output is correct
23 Correct 4 ms 4684 KB Output is correct
24 Correct 5 ms 4684 KB Output is correct
25 Correct 4 ms 4564 KB Output is correct
26 Correct 4 ms 4692 KB Output is correct
27 Correct 232 ms 151076 KB Output is correct
28 Correct 2 ms 984 KB Output is correct
29 Correct 9 ms 11756 KB Output is correct
30 Correct 1 ms 724 KB Output is correct
31 Correct 171 ms 111208 KB Output is correct
32 Correct 219 ms 158948 KB Output is correct
33 Correct 224 ms 159560 KB Output is correct
34 Correct 189 ms 128848 KB Output is correct
35 Correct 229 ms 158964 KB Output is correct
36 Correct 257 ms 159580 KB Output is correct
37 Correct 264 ms 160220 KB Output is correct
38 Correct 168 ms 110312 KB Output is correct
39 Correct 154 ms 110748 KB Output is correct