Submission #586952

# Submission time Handle Problem Language Result Execution time Memory
586952 2022-07-01T06:22:09 Z Justin1 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
386 ms 150348 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.tie(0), cout.tie(0) -> sync_with_stdio(0);
    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 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 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 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 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 8 ms 8784 KB Output is correct
15 Correct 2 ms 4948 KB Output is correct
16 Correct 5 ms 5204 KB Output is correct
17 Correct 1 ms 428 KB Output is correct
18 Correct 10 ms 9684 KB Output is correct
19 Correct 9 ms 9556 KB Output is correct
20 Correct 9 ms 9544 KB Output is correct
21 Correct 12 ms 9684 KB Output is correct
22 Correct 9 ms 9556 KB Output is correct
23 Correct 8 ms 9560 KB Output is correct
24 Correct 9 ms 9684 KB Output is correct
25 Correct 10 ms 9536 KB Output is correct
26 Correct 9 ms 9556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 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 8 ms 8784 KB Output is correct
15 Correct 2 ms 4948 KB Output is correct
16 Correct 5 ms 5204 KB Output is correct
17 Correct 1 ms 428 KB Output is correct
18 Correct 10 ms 9684 KB Output is correct
19 Correct 9 ms 9556 KB Output is correct
20 Correct 9 ms 9544 KB Output is correct
21 Correct 12 ms 9684 KB Output is correct
22 Correct 9 ms 9556 KB Output is correct
23 Correct 8 ms 9560 KB Output is correct
24 Correct 9 ms 9684 KB Output is correct
25 Correct 10 ms 9536 KB Output is correct
26 Correct 9 ms 9556 KB Output is correct
27 Correct 349 ms 150272 KB Output is correct
28 Correct 13 ms 26324 KB Output is correct
29 Correct 17 ms 13228 KB Output is correct
30 Correct 1 ms 724 KB Output is correct
31 Correct 263 ms 125180 KB Output is correct
32 Correct 316 ms 150232 KB Output is correct
33 Correct 318 ms 149776 KB Output is correct
34 Correct 299 ms 145244 KB Output is correct
35 Correct 327 ms 150348 KB Output is correct
36 Correct 343 ms 149756 KB Output is correct
37 Correct 386 ms 150224 KB Output is correct
38 Correct 222 ms 124628 KB Output is correct
39 Correct 238 ms 124776 KB Output is correct