답안 #990080

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
990080 2024-05-29T13:52:43 Z coftochka Bitaro the Brave (JOI19_ho_t1) C++17
20 / 100
9 ms 15196 KB
#include <iostream>
#include <cstring>

using namespace std;

const int N = 3030;
int O[N][N];
int I[N][N];
string s[N];
int n, m;


void input(){
    cin >> n >> m;
    for (int i = 0; i < n; ++i){
        cin >> s[i];
    }
    
}

void preprocess(){
    for (int i = 0; i < n; ++i){
        O[i][m] = 0;
        for (int j = m - 1; j >= 0; --j){
            O[i][j] = O[i][j + 1];
            if (s[i][j] == 'O'){
                ++O[i][j];
            }
        }
    }
    for (int j = 0; j < m; ++j){
        I[n][j] = 0;
        for (int i = n - 1; i >= 0; --i){
            I[i][j] = I[i + 1][j];
            if (s[i][j] == 'I'){
                ++I[i][j];
            }
        }
    }
}

int solve(){
    long long ans = 0;
    for (int i = 0; i < n; ++i){
        for (int j = 0; j < m; ++j){
            if (s[i][j] == 'J'){
                ans += O[i][j] * I[i][j];
            }
        }
    }
    return ans;
}

int main(){
    input();
    preprocess();
    cout << solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 6748 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 4700 KB Output is correct
8 Correct 1 ms 6748 KB Output is correct
9 Correct 1 ms 6492 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 6748 KB Output is correct
12 Correct 1 ms 6748 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 6748 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 4700 KB Output is correct
8 Correct 1 ms 6748 KB Output is correct
9 Correct 1 ms 6492 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 6748 KB Output is correct
12 Correct 1 ms 6748 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 8 ms 15196 KB Output is correct
15 Correct 1 ms 12632 KB Output is correct
16 Correct 3 ms 9032 KB Output is correct
17 Correct 1 ms 4700 KB Output is correct
18 Correct 9 ms 15192 KB Output is correct
19 Correct 6 ms 15196 KB Output is correct
20 Incorrect 7 ms 15196 KB Output isn't correct
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 6748 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 4700 KB Output is correct
8 Correct 1 ms 6748 KB Output is correct
9 Correct 1 ms 6492 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 6748 KB Output is correct
12 Correct 1 ms 6748 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 8 ms 15196 KB Output is correct
15 Correct 1 ms 12632 KB Output is correct
16 Correct 3 ms 9032 KB Output is correct
17 Correct 1 ms 4700 KB Output is correct
18 Correct 9 ms 15192 KB Output is correct
19 Correct 6 ms 15196 KB Output is correct
20 Incorrect 7 ms 15196 KB Output isn't correct
21 Halted 0 ms 0 KB -