답안 #670432

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
670432 2022-12-09T05:47:51 Z berr Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
319 ms 159116 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
int co[3005][3005], ci[3005][3005];
char gr[3005][3005];


signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m; cin>>n>>m;



    for(int i=0; i < n; i++){
        for(int l=0; l < m; l++){
            cin >> gr[i][l];

            if(gr[i][l] == 'I'){
                ci[i][l]++;
            }
            
            if(gr[i][l] == 'O'){
                co[i][l]++;
            }
        }
    }


    for(int i=0; i<n; i++){
        for(int l=m-2; l>=0; l--){
            co[i][l]+=co[i][l+1];
        }
    }

    for(int i=n-2; i>=0; i--){
        for(int l=0; l<m; l++){
            ci[i][l]+=ci[i+1][l];
        }
    }

    int ans=0;

    for(int i=0; i<n; i++){
        for(int l=0; l<m; l++){
            if(gr[i][l]=='J') ans+=(co[i][l]*ci[i][l]);
        }
    }


    cout<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1484 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 2 ms 1356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1484 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 2 ms 1356 KB Output is correct
14 Correct 10 ms 8916 KB Output is correct
15 Correct 2 ms 4936 KB Output is correct
16 Correct 5 ms 5248 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 13 ms 9932 KB Output is correct
19 Correct 9 ms 9792 KB Output is correct
20 Correct 8 ms 9800 KB Output is correct
21 Correct 13 ms 9940 KB Output is correct
22 Correct 10 ms 9724 KB Output is correct
23 Correct 8 ms 9680 KB Output is correct
24 Correct 11 ms 9944 KB Output is correct
25 Correct 9 ms 9812 KB Output is correct
26 Correct 8 ms 9684 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1484 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 2 ms 1356 KB Output is correct
14 Correct 10 ms 8916 KB Output is correct
15 Correct 2 ms 4936 KB Output is correct
16 Correct 5 ms 5248 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 13 ms 9932 KB Output is correct
19 Correct 9 ms 9792 KB Output is correct
20 Correct 8 ms 9800 KB Output is correct
21 Correct 13 ms 9940 KB Output is correct
22 Correct 10 ms 9724 KB Output is correct
23 Correct 8 ms 9680 KB Output is correct
24 Correct 11 ms 9944 KB Output is correct
25 Correct 9 ms 9812 KB Output is correct
26 Correct 8 ms 9684 KB Output is correct
27 Correct 309 ms 158512 KB Output is correct
28 Correct 12 ms 26324 KB Output is correct
29 Correct 17 ms 13816 KB Output is correct
30 Correct 1 ms 724 KB Output is correct
31 Correct 242 ms 131432 KB Output is correct
32 Correct 239 ms 159008 KB Output is correct
33 Correct 191 ms 158468 KB Output is correct
34 Correct 280 ms 152368 KB Output is correct
35 Correct 250 ms 159012 KB Output is correct
36 Correct 189 ms 158508 KB Output is correct
37 Correct 319 ms 159116 KB Output is correct
38 Correct 177 ms 130696 KB Output is correct
39 Correct 148 ms 130808 KB Output is correct