Submission #1003025

# Submission time Handle Problem Language Result Execution time Memory
1003025 2024-06-20T02:43:35 Z tamir1 Bitaro the Brave (JOI19_ho_t1) C++17
20 / 100
8 ms 7260 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();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 1372 KB Output is correct
6 Correct 1 ms 1368 KB Output is correct
7 Correct 1 ms 1112 KB Output is correct
8 Correct 1 ms 1372 KB Output is correct
9 Correct 1 ms 1372 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1372 KB Output is correct
12 Correct 1 ms 1368 KB Output is correct
13 Correct 1 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 1372 KB Output is correct
6 Correct 1 ms 1368 KB Output is correct
7 Correct 1 ms 1112 KB Output is correct
8 Correct 1 ms 1372 KB Output is correct
9 Correct 1 ms 1372 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1372 KB Output is correct
12 Correct 1 ms 1368 KB Output is correct
13 Correct 1 ms 1116 KB Output is correct
14 Correct 7 ms 6492 KB Output is correct
15 Correct 1 ms 3932 KB Output is correct
16 Correct 4 ms 3932 KB Output is correct
17 Correct 0 ms 604 KB Output is correct
18 Correct 8 ms 7260 KB Output is correct
19 Correct 6 ms 6744 KB Output is correct
20 Incorrect 6 ms 7000 KB Output isn't correct
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 1372 KB Output is correct
6 Correct 1 ms 1368 KB Output is correct
7 Correct 1 ms 1112 KB Output is correct
8 Correct 1 ms 1372 KB Output is correct
9 Correct 1 ms 1372 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1372 KB Output is correct
12 Correct 1 ms 1368 KB Output is correct
13 Correct 1 ms 1116 KB Output is correct
14 Correct 7 ms 6492 KB Output is correct
15 Correct 1 ms 3932 KB Output is correct
16 Correct 4 ms 3932 KB Output is correct
17 Correct 0 ms 604 KB Output is correct
18 Correct 8 ms 7260 KB Output is correct
19 Correct 6 ms 6744 KB Output is correct
20 Incorrect 6 ms 7000 KB Output isn't correct
21 Halted 0 ms 0 KB -