답안 #996957

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
996957 2024-06-11T14:03:56 Z coolboy19521 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
612 ms 100432 KB
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>

#define int long long

using namespace std;

const int sz = 3e3 + 9;

vector <int> os[sz], is[sz];
char a[sz][sz];

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    int h, w;
    cin >> h >> w;

    int r = 0;

    for (int i = 1; i <= h; i ++) {
        for (int j = 1; j <= w; j ++) {
            cin >> a[i][j];

            if ('O' == a[i][j]) {
                os[i].push_back(j);
            } else if ('I' == a[i][j]) {
                is[j].push_back(i);
            }
        }
    }

    for (int i = 1; i <= h; i ++) {
        for (int j = 1; j <= w; j ++) {
            if ('J' == a[i][j]) {
                int oc = os[i].end() - upper_bound(begin(os[i]), end(os[i]), j);
                int ic = is[j].end() - upper_bound(begin(is[j]), end(is[j]), i);
                r += oc * ic;
            }
        }
    }

    cout << r << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 2908 KB Output is correct
6 Correct 1 ms 2908 KB Output is correct
7 Correct 1 ms 2908 KB Output is correct
8 Correct 1 ms 2908 KB Output is correct
9 Correct 1 ms 2908 KB Output is correct
10 Correct 1 ms 2904 KB Output is correct
11 Correct 1 ms 2908 KB Output is correct
12 Correct 1 ms 2908 KB Output is correct
13 Correct 1 ms 2908 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 2908 KB Output is correct
6 Correct 1 ms 2908 KB Output is correct
7 Correct 1 ms 2908 KB Output is correct
8 Correct 1 ms 2908 KB Output is correct
9 Correct 1 ms 2908 KB Output is correct
10 Correct 1 ms 2904 KB Output is correct
11 Correct 1 ms 2908 KB Output is correct
12 Correct 1 ms 2908 KB Output is correct
13 Correct 1 ms 2908 KB Output is correct
14 Correct 10 ms 4444 KB Output is correct
15 Correct 1 ms 2652 KB Output is correct
16 Correct 3 ms 3676 KB Output is correct
17 Correct 0 ms 604 KB Output is correct
18 Correct 12 ms 4956 KB Output is correct
19 Correct 5 ms 5212 KB Output is correct
20 Correct 5 ms 4188 KB Output is correct
21 Correct 13 ms 4952 KB Output is correct
22 Correct 6 ms 4444 KB Output is correct
23 Correct 5 ms 4188 KB Output is correct
24 Correct 13 ms 4444 KB Output is correct
25 Correct 5 ms 4956 KB Output is correct
26 Correct 4 ms 4188 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 2908 KB Output is correct
6 Correct 1 ms 2908 KB Output is correct
7 Correct 1 ms 2908 KB Output is correct
8 Correct 1 ms 2908 KB Output is correct
9 Correct 1 ms 2908 KB Output is correct
10 Correct 1 ms 2904 KB Output is correct
11 Correct 1 ms 2908 KB Output is correct
12 Correct 1 ms 2908 KB Output is correct
13 Correct 1 ms 2908 KB Output is correct
14 Correct 10 ms 4444 KB Output is correct
15 Correct 1 ms 2652 KB Output is correct
16 Correct 3 ms 3676 KB Output is correct
17 Correct 0 ms 604 KB Output is correct
18 Correct 12 ms 4956 KB Output is correct
19 Correct 5 ms 5212 KB Output is correct
20 Correct 5 ms 4188 KB Output is correct
21 Correct 13 ms 4952 KB Output is correct
22 Correct 6 ms 4444 KB Output is correct
23 Correct 5 ms 4188 KB Output is correct
24 Correct 13 ms 4444 KB Output is correct
25 Correct 5 ms 4956 KB Output is correct
26 Correct 4 ms 4188 KB Output is correct
27 Correct 551 ms 68828 KB Output is correct
28 Correct 2 ms 9052 KB Output is correct
29 Correct 13 ms 8296 KB Output is correct
30 Correct 2 ms 860 KB Output is correct
31 Correct 386 ms 58136 KB Output is correct
32 Correct 214 ms 100432 KB Output is correct
33 Correct 227 ms 81488 KB Output is correct
34 Correct 429 ms 63488 KB Output is correct
35 Correct 252 ms 80464 KB Output is correct
36 Correct 213 ms 81528 KB Output is correct
37 Correct 612 ms 85840 KB Output is correct
38 Correct 120 ms 70228 KB Output is correct
39 Correct 155 ms 64340 KB Output is correct