Submission #100284

# Submission time Handle Problem Language Result Execution time Memory
100284 2019-03-10T09:06:34 Z toonewbie Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
458 ms 79820 KB
/*** Author: Barish Namazov (toonewbie) ***/
#include <bits/stdc++.h>

using namespace std;

char A[3005][3005];
int si[3005][3005], so[3005][3005];
int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            cin >> A[i][j];
        }
    }
    for (int i = 1; i <= n; i++) {
        for (int j = m; j >= 1; j--) {
            so[i][j] = so[i][j + 1] + (A[i][j] == 'O');
        }
    }
    for (int j = 1; j <= m; j++) {
        for (int i = n; i >= 1; i--) {
            si[i][j] = si[i + 1][j] + (A[i][j] == 'I');
        }
    }
    long long res = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (A[i][j] == 'J') {
                res += 1LL * so[i][j] * si[i][j];
            }
        }
    }
    cout << res << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 588 KB Output is correct
5 Correct 3 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 4 ms 1536 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 588 KB Output is correct
5 Correct 3 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 4 ms 1536 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
14 Correct 13 ms 7296 KB Output is correct
15 Correct 7 ms 4992 KB Output is correct
16 Correct 8 ms 4224 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 18 ms 7680 KB Output is correct
19 Correct 13 ms 7680 KB Output is correct
20 Correct 12 ms 7680 KB Output is correct
21 Correct 17 ms 7808 KB Output is correct
22 Correct 14 ms 7680 KB Output is correct
23 Correct 16 ms 7680 KB Output is correct
24 Correct 15 ms 7808 KB Output is correct
25 Correct 14 ms 7680 KB Output is correct
26 Correct 13 ms 7680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 588 KB Output is correct
5 Correct 3 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 4 ms 1536 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
14 Correct 13 ms 7296 KB Output is correct
15 Correct 7 ms 4992 KB Output is correct
16 Correct 8 ms 4224 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 18 ms 7680 KB Output is correct
19 Correct 13 ms 7680 KB Output is correct
20 Correct 12 ms 7680 KB Output is correct
21 Correct 17 ms 7808 KB Output is correct
22 Correct 14 ms 7680 KB Output is correct
23 Correct 16 ms 7680 KB Output is correct
24 Correct 15 ms 7808 KB Output is correct
25 Correct 14 ms 7680 KB Output is correct
26 Correct 13 ms 7680 KB Output is correct
27 Correct 406 ms 79820 KB Output is correct
28 Correct 26 ms 25984 KB Output is correct
29 Correct 21 ms 7212 KB Output is correct
30 Correct 3 ms 640 KB Output is correct
31 Correct 297 ms 66556 KB Output is correct
32 Correct 378 ms 79736 KB Output is correct
33 Correct 414 ms 79476 KB Output is correct
34 Correct 362 ms 77180 KB Output is correct
35 Correct 422 ms 79804 KB Output is correct
36 Correct 444 ms 79480 KB Output is correct
37 Correct 458 ms 79812 KB Output is correct
38 Correct 304 ms 66556 KB Output is correct
39 Correct 290 ms 66296 KB Output is correct