답안 #996953

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
996953 2024-06-11T13:59:37 Z coolboy19521 Bitaro the Brave (JOI19_ho_t1) C++17
50 / 100
1000 ms 69408 KB
#include<bits/stdc++.h>

#define int long long

using namespace std;

const int sz = 3e3 + 9;

char a[sz][sz];

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

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

    map <int, vector <int>> os, is;
    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 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 2652 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2796 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 2652 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2796 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
14 Correct 19 ms 4188 KB Output is correct
15 Correct 1 ms 2652 KB Output is correct
16 Correct 9 ms 3420 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 25 ms 4848 KB Output is correct
19 Correct 11 ms 4956 KB Output is correct
20 Correct 15 ms 4092 KB Output is correct
21 Correct 27 ms 4952 KB Output is correct
22 Correct 15 ms 4444 KB Output is correct
23 Correct 12 ms 3932 KB Output is correct
24 Correct 26 ms 4184 KB Output is correct
25 Correct 11 ms 4952 KB Output is correct
26 Correct 12 ms 3932 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 2652 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2796 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
14 Correct 19 ms 4188 KB Output is correct
15 Correct 1 ms 2652 KB Output is correct
16 Correct 9 ms 3420 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 25 ms 4848 KB Output is correct
19 Correct 11 ms 4956 KB Output is correct
20 Correct 15 ms 4092 KB Output is correct
21 Correct 27 ms 4952 KB Output is correct
22 Correct 15 ms 4444 KB Output is correct
23 Correct 12 ms 3932 KB Output is correct
24 Correct 26 ms 4184 KB Output is correct
25 Correct 11 ms 4952 KB Output is correct
26 Correct 12 ms 3932 KB Output is correct
27 Execution timed out 1103 ms 69408 KB Time limit exceeded
28 Halted 0 ms 0 KB -