답안 #209874

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
209874 2020-03-15T19:26:27 Z shart23 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
350 ms 151544 KB
#include <bits/stdc++.h>

#define int long long
#define endl '\n'
using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n, m;
    cin >> n >> m;
    vector<string> arr(n);
    for (auto &x : arr) {
        cin >> x;
    }
    vector<vector<int>> O(n, vector<int>(m)), I(n, vector<int>(m));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (arr[i][j] == 'O') {
                O[i][j]++;
            } else if (arr[i][j] == 'I') {
                I[i][j]++;
            }
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = m - 2; j >= 0; j--) {
            O[i][j] += O[i][j + 1];
        }
    }
    for (int j = 0; j < m; j++) {
        for (int i = n - 2; i >= 0; i--) {
            I[i][j] += I[i + 1][j];
        }
    }
    int res = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (arr[i][j] == 'J') {
                res += O[i][j] * I[i][j];
            }
        }
    }
    cout << res << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 6 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 5 ms 504 KB Output is correct
7 Correct 5 ms 508 KB Output is correct
8 Correct 5 ms 504 KB Output is correct
9 Correct 5 ms 508 KB Output is correct
10 Correct 5 ms 504 KB Output is correct
11 Correct 5 ms 504 KB Output is correct
12 Correct 5 ms 504 KB Output is correct
13 Correct 5 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 6 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 5 ms 504 KB Output is correct
7 Correct 5 ms 508 KB Output is correct
8 Correct 5 ms 504 KB Output is correct
9 Correct 5 ms 508 KB Output is correct
10 Correct 5 ms 504 KB Output is correct
11 Correct 5 ms 504 KB Output is correct
12 Correct 5 ms 504 KB Output is correct
13 Correct 5 ms 504 KB Output is correct
14 Correct 11 ms 3704 KB Output is correct
15 Correct 5 ms 504 KB Output is correct
16 Correct 8 ms 2680 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 12 ms 4856 KB Output is correct
19 Correct 10 ms 4600 KB Output is correct
20 Correct 10 ms 4728 KB Output is correct
21 Correct 13 ms 4856 KB Output is correct
22 Correct 10 ms 4600 KB Output is correct
23 Correct 10 ms 4728 KB Output is correct
24 Correct 12 ms 4856 KB Output is correct
25 Correct 10 ms 4600 KB Output is correct
26 Correct 10 ms 4728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 6 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 5 ms 504 KB Output is correct
7 Correct 5 ms 508 KB Output is correct
8 Correct 5 ms 504 KB Output is correct
9 Correct 5 ms 508 KB Output is correct
10 Correct 5 ms 504 KB Output is correct
11 Correct 5 ms 504 KB Output is correct
12 Correct 5 ms 504 KB Output is correct
13 Correct 5 ms 504 KB Output is correct
14 Correct 11 ms 3704 KB Output is correct
15 Correct 5 ms 504 KB Output is correct
16 Correct 8 ms 2680 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 12 ms 4856 KB Output is correct
19 Correct 10 ms 4600 KB Output is correct
20 Correct 10 ms 4728 KB Output is correct
21 Correct 13 ms 4856 KB Output is correct
22 Correct 10 ms 4600 KB Output is correct
23 Correct 10 ms 4728 KB Output is correct
24 Correct 12 ms 4856 KB Output is correct
25 Correct 10 ms 4600 KB Output is correct
26 Correct 10 ms 4728 KB Output is correct
27 Correct 319 ms 143188 KB Output is correct
28 Correct 6 ms 1016 KB Output is correct
29 Correct 19 ms 11768 KB Output is correct
30 Correct 6 ms 760 KB Output is correct
31 Correct 241 ms 105592 KB Output is correct
32 Correct 262 ms 150648 KB Output is correct
33 Correct 249 ms 151164 KB Output is correct
34 Correct 277 ms 122232 KB Output is correct
35 Correct 257 ms 150648 KB Output is correct
36 Correct 249 ms 151084 KB Output is correct
37 Correct 350 ms 151544 KB Output is correct
38 Correct 178 ms 104568 KB Output is correct
39 Correct 172 ms 104952 KB Output is correct