답안 #465076

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
465076 2021-08-15T07:14:14 Z Baray Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
839 ms 79872 KB
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <climits>
#include <deque>

using namespace std;

#define ll long long

ll n, m, ans;
char matrix[3005][3005];

int main() {
    cin >> n >> m;

    int preRight[3005][3005] = {0}, preDown[3005][3005] = {0};
    
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            cin >> matrix[i][j];
        }
    }

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            preRight[i][j] = preRight[i][j - 1];
            if (matrix[i][j] == 'O') {
                preRight[i][j]++;
            }
            //cout << preRight[i][j] << " " << i << " | " << j << "\n";
        }
    }

    for (int j = 1; j <= m; j++) {
        for (int i = 1; i <= n; i++) {
            preDown[i][j] = preDown[i - 1][j];
            if (matrix[i][j] == 'I') {
                preDown[i][j]++;
            }
            //cout << preDown[i][j] << " " << i << " | " << j << "\n";
        }
    }

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (matrix[i][j] == 'J') {
                ans += (preRight[i][m] - preRight[i][j]) * (preDown[n][j] - preDown[i][j]);
            }
        }
    }

    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 70960 KB Output is correct
2 Correct 38 ms 70860 KB Output is correct
3 Correct 40 ms 70956 KB Output is correct
4 Correct 41 ms 70928 KB Output is correct
5 Correct 40 ms 71232 KB Output is correct
6 Correct 40 ms 71260 KB Output is correct
7 Correct 40 ms 71108 KB Output is correct
8 Correct 39 ms 71216 KB Output is correct
9 Correct 40 ms 71216 KB Output is correct
10 Correct 40 ms 71152 KB Output is correct
11 Correct 41 ms 71172 KB Output is correct
12 Correct 40 ms 71232 KB Output is correct
13 Correct 39 ms 71176 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 70960 KB Output is correct
2 Correct 38 ms 70860 KB Output is correct
3 Correct 40 ms 70956 KB Output is correct
4 Correct 41 ms 70928 KB Output is correct
5 Correct 40 ms 71232 KB Output is correct
6 Correct 40 ms 71260 KB Output is correct
7 Correct 40 ms 71108 KB Output is correct
8 Correct 39 ms 71216 KB Output is correct
9 Correct 40 ms 71216 KB Output is correct
10 Correct 40 ms 71152 KB Output is correct
11 Correct 41 ms 71172 KB Output is correct
12 Correct 40 ms 71232 KB Output is correct
13 Correct 39 ms 71176 KB Output is correct
14 Correct 52 ms 72364 KB Output is correct
15 Correct 41 ms 72184 KB Output is correct
16 Correct 49 ms 71728 KB Output is correct
17 Correct 40 ms 70984 KB Output is correct
18 Correct 65 ms 72400 KB Output is correct
19 Correct 56 ms 72400 KB Output is correct
20 Correct 56 ms 72356 KB Output is correct
21 Correct 59 ms 72348 KB Output is correct
22 Correct 57 ms 72372 KB Output is correct
23 Correct 56 ms 72316 KB Output is correct
24 Correct 60 ms 72356 KB Output is correct
25 Correct 55 ms 72432 KB Output is correct
26 Correct 56 ms 72380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 70960 KB Output is correct
2 Correct 38 ms 70860 KB Output is correct
3 Correct 40 ms 70956 KB Output is correct
4 Correct 41 ms 70928 KB Output is correct
5 Correct 40 ms 71232 KB Output is correct
6 Correct 40 ms 71260 KB Output is correct
7 Correct 40 ms 71108 KB Output is correct
8 Correct 39 ms 71216 KB Output is correct
9 Correct 40 ms 71216 KB Output is correct
10 Correct 40 ms 71152 KB Output is correct
11 Correct 41 ms 71172 KB Output is correct
12 Correct 40 ms 71232 KB Output is correct
13 Correct 39 ms 71176 KB Output is correct
14 Correct 52 ms 72364 KB Output is correct
15 Correct 41 ms 72184 KB Output is correct
16 Correct 49 ms 71728 KB Output is correct
17 Correct 40 ms 70984 KB Output is correct
18 Correct 65 ms 72400 KB Output is correct
19 Correct 56 ms 72400 KB Output is correct
20 Correct 56 ms 72356 KB Output is correct
21 Correct 59 ms 72348 KB Output is correct
22 Correct 57 ms 72372 KB Output is correct
23 Correct 56 ms 72316 KB Output is correct
24 Correct 60 ms 72356 KB Output is correct
25 Correct 55 ms 72432 KB Output is correct
26 Correct 56 ms 72380 KB Output is correct
27 Correct 756 ms 79812 KB Output is correct
28 Correct 43 ms 77776 KB Output is correct
29 Correct 83 ms 71632 KB Output is correct
30 Correct 41 ms 70928 KB Output is correct
31 Correct 555 ms 78452 KB Output is correct
32 Correct 748 ms 79788 KB Output is correct
33 Correct 731 ms 79872 KB Output is correct
34 Correct 653 ms 79716 KB Output is correct
35 Correct 749 ms 79700 KB Output is correct
36 Correct 795 ms 79644 KB Output is correct
37 Correct 839 ms 79832 KB Output is correct
38 Correct 520 ms 78316 KB Output is correct
39 Correct 520 ms 78512 KB Output is correct