Submission #522650

# Submission time Handle Problem Language Result Execution time Memory
522650 2022-02-05T10:09:01 Z Monarchuwu Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
231 ms 88456 KB
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;

const int N = 3000 + 3;
int h, w;
char c[N][N];

int f[N][N], g[N][N];
void prep() {
    for (int i = 0; i < h; ++i)
        for (int j = w - 1; ~j; --j)
            f[i][j] = f[i][j + 1] + (c[i][j] == 'O');

    for (int j = 0; j < w; ++j)
        for (int i = h - 1; ~i; --i)
            g[i][j] = g[i + 1][j] + (c[i][j] == 'I');
}

int main() {
    cin.tie(NULL)->sync_with_stdio(false);
    cin >> h >> w;
    for (int i = 0; i < h; ++i) cin >> c[i];
    prep();

    ll ans(0);
    for (int i = 0; i < h; ++i)
        for (int j = 0; j < w; ++j)
            if (c[i][j] == 'J') ans += (ll)f[i][j] * g[i][j];
    cout << ans << '\n';
}
/**  /\_/\
 *  (= ._.)
 *  / >0  \>1
**/
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 1 ms 1484 KB Output is correct
6 Correct 1 ms 1480 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1484 KB Output is correct
9 Correct 1 ms 1484 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1484 KB Output is correct
12 Correct 1 ms 1484 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 1 ms 1484 KB Output is correct
6 Correct 1 ms 1480 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1484 KB Output is correct
9 Correct 1 ms 1484 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1484 KB Output is correct
12 Correct 1 ms 1484 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 6 ms 7372 KB Output is correct
15 Correct 3 ms 4928 KB Output is correct
16 Correct 4 ms 4300 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 9 ms 7996 KB Output is correct
19 Correct 6 ms 7900 KB Output is correct
20 Correct 5 ms 7852 KB Output is correct
21 Correct 7 ms 8016 KB Output is correct
22 Correct 5 ms 7860 KB Output is correct
23 Correct 5 ms 7756 KB Output is correct
24 Correct 7 ms 7964 KB Output is correct
25 Correct 6 ms 7916 KB Output is correct
26 Correct 7 ms 7756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 1 ms 1484 KB Output is correct
6 Correct 1 ms 1480 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1484 KB Output is correct
9 Correct 1 ms 1484 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1484 KB Output is correct
12 Correct 1 ms 1484 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 6 ms 7372 KB Output is correct
15 Correct 3 ms 4928 KB Output is correct
16 Correct 4 ms 4300 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 9 ms 7996 KB Output is correct
19 Correct 6 ms 7900 KB Output is correct
20 Correct 5 ms 7852 KB Output is correct
21 Correct 7 ms 8016 KB Output is correct
22 Correct 5 ms 7860 KB Output is correct
23 Correct 5 ms 7756 KB Output is correct
24 Correct 7 ms 7964 KB Output is correct
25 Correct 6 ms 7916 KB Output is correct
26 Correct 7 ms 7756 KB Output is correct
27 Correct 215 ms 88024 KB Output is correct
28 Correct 12 ms 25968 KB Output is correct
29 Correct 10 ms 7752 KB Output is correct
30 Correct 1 ms 588 KB Output is correct
31 Correct 163 ms 72516 KB Output is correct
32 Correct 220 ms 88356 KB Output is correct
33 Correct 195 ms 88376 KB Output is correct
34 Correct 190 ms 84156 KB Output is correct
35 Correct 208 ms 88400 KB Output is correct
36 Correct 204 ms 88088 KB Output is correct
37 Correct 231 ms 88456 KB Output is correct
38 Correct 164 ms 72436 KB Output is correct
39 Correct 134 ms 72164 KB Output is correct