Submission #544290

# Submission time Handle Problem Language Result Execution time Memory
544290 2022-04-01T15:13:55 Z Jomnoi Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
88 ms 83396 KB
#include <bits/stdc++.h>
#define DEBUG 0
using namespace std;

const int N = 3e3 + 10;

char S[N][N];
int qsi[N][N], qso[N][N];

int main() {
    cin.tie(0)->sync_with_stdio(0);
    int H, W;
    cin >> H >> W;
    for(int i = 1; i <= H; i++) {
        cin >> (S[i] + 1);
    }
    
    for(int i = 1; i <= H; i++) {
        for(int j = 1; j <= W; j++) {
            qso[i][j] = qso[i][j - 1] + (S[i][j] == 'O');
            qsi[i][j] = qsi[i - 1][j] + (S[i][j] == 'I');
        }
    }

    long long ans = 0;
    for(int i = 1; i <= H; i++) {
        for(int j = 1; j <= W; j++) {
            ans += 1ll*(S[i][j] == 'J') * (qso[i][W] - qso[i][j]) * (qsi[H][j] - qsi[i][j]);
        }
    }
    cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 336 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 1368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 336 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 1368 KB Output is correct
14 Correct 5 ms 7508 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 3 ms 4336 KB Output is correct
17 Correct 1 ms 456 KB Output is correct
18 Correct 5 ms 7916 KB Output is correct
19 Correct 6 ms 7892 KB Output is correct
20 Correct 6 ms 7896 KB Output is correct
21 Correct 5 ms 8020 KB Output is correct
22 Correct 5 ms 7892 KB Output is correct
23 Correct 5 ms 7892 KB Output is correct
24 Correct 6 ms 8020 KB Output is correct
25 Correct 6 ms 7892 KB Output is correct
26 Correct 6 ms 7800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 336 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 1368 KB Output is correct
14 Correct 5 ms 7508 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 3 ms 4336 KB Output is correct
17 Correct 1 ms 456 KB Output is correct
18 Correct 5 ms 7916 KB Output is correct
19 Correct 6 ms 7892 KB Output is correct
20 Correct 6 ms 7896 KB Output is correct
21 Correct 5 ms 8020 KB Output is correct
22 Correct 5 ms 7892 KB Output is correct
23 Correct 5 ms 7892 KB Output is correct
24 Correct 6 ms 8020 KB Output is correct
25 Correct 6 ms 7892 KB Output is correct
26 Correct 6 ms 7800 KB Output is correct
27 Correct 75 ms 82760 KB Output is correct
28 Correct 14 ms 25932 KB Output is correct
29 Correct 7 ms 7792 KB Output is correct
30 Correct 1 ms 596 KB Output is correct
31 Correct 59 ms 69240 KB Output is correct
32 Correct 78 ms 83328 KB Output is correct
33 Correct 78 ms 82888 KB Output is correct
34 Correct 68 ms 79820 KB Output is correct
35 Correct 88 ms 83352 KB Output is correct
36 Correct 78 ms 82928 KB Output is correct
37 Correct 79 ms 83396 KB Output is correct
38 Correct 59 ms 69324 KB Output is correct
39 Correct 60 ms 68956 KB Output is correct