답안 #753079

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
753079 2023-06-04T14:26:28 Z CdS Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
786 ms 159312 KB
    #include<bits/stdc++.h>
    #define N 3010
    #define int long long
     
    using namespace std;
     
    int n, m;
    char c[N][N];
    int dir[N][N], bai[N][N];
     
    int32_t main(){
        cin >> n >> m;
     
        for(int i = 1;i <= n;i++){
            for(int j = 1;j <= m;j++){
                cin >> c[i][j];
            }
        }
     
        for(int i = 1;i <= n;i++){
            for(int j = m;j > 0;j--){
                dir[i][j] = dir[i][j+1] + (c[i][j] == 'O' ? 1 : 0);
            }
        }
     
        for(int j = 1;j <= m;j++){
            for(int i = n;i > 0;i--){
                bai[i][j] = bai[i+1][j] + (c[i][j] == 'I' ? 1 : 0);
            }
        }
     
        int res = 0;
     
        for(int i = 1;i <= n;i++){
            for(int j = 1;j <= m;j++){
                if(c[i][j] == 'J'){
                    res += dir[i][j]*bai[i][j];
                }
            }
        }
     
        cout << res << "\n";
     
        return 0;
    }
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 2 ms 1492 KB Output is correct
7 Correct 2 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 2 ms 1492 KB Output is correct
10 Correct 2 ms 1364 KB Output is correct
11 Correct 3 ms 1492 KB Output is correct
12 Correct 2 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 2 ms 1492 KB Output is correct
7 Correct 2 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 2 ms 1492 KB Output is correct
10 Correct 2 ms 1364 KB Output is correct
11 Correct 3 ms 1492 KB Output is correct
12 Correct 2 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 16 ms 8788 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 10 ms 5076 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 21 ms 9676 KB Output is correct
19 Correct 20 ms 9516 KB Output is correct
20 Correct 19 ms 9468 KB Output is correct
21 Correct 22 ms 9900 KB Output is correct
22 Correct 19 ms 9780 KB Output is correct
23 Correct 20 ms 9668 KB Output is correct
24 Correct 24 ms 9864 KB Output is correct
25 Correct 20 ms 9812 KB Output is correct
26 Correct 19 ms 9748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 2 ms 1492 KB Output is correct
7 Correct 2 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 2 ms 1492 KB Output is correct
10 Correct 2 ms 1364 KB Output is correct
11 Correct 3 ms 1492 KB Output is correct
12 Correct 2 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 16 ms 8788 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 10 ms 5076 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 21 ms 9676 KB Output is correct
19 Correct 20 ms 9516 KB Output is correct
20 Correct 19 ms 9468 KB Output is correct
21 Correct 22 ms 9900 KB Output is correct
22 Correct 19 ms 9780 KB Output is correct
23 Correct 20 ms 9668 KB Output is correct
24 Correct 24 ms 9864 KB Output is correct
25 Correct 20 ms 9812 KB Output is correct
26 Correct 19 ms 9748 KB Output is correct
27 Correct 729 ms 158820 KB Output is correct
28 Correct 15 ms 26324 KB Output is correct
29 Correct 46 ms 13824 KB Output is correct
30 Correct 2 ms 724 KB Output is correct
31 Correct 553 ms 131512 KB Output is correct
32 Correct 716 ms 159168 KB Output is correct
33 Correct 722 ms 158848 KB Output is correct
34 Correct 620 ms 152568 KB Output is correct
35 Correct 744 ms 159184 KB Output is correct
36 Correct 714 ms 158756 KB Output is correct
37 Correct 786 ms 159312 KB Output is correct
38 Correct 516 ms 130828 KB Output is correct
39 Correct 493 ms 130968 KB Output is correct