Submission #962974

# Submission time Handle Problem Language Result Execution time Memory
962974 2024-04-14T10:22:22 Z marinaluca Bitaro the Brave (JOI19_ho_t1) C++14
0 / 100
1 ms 4440 KB
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

#pragma GCC optimize ("O4")
#pragma GCC optimize ("fast-math")
#pragma GCC optimize ("unroll-loops")

using namespace std;
#define int long long
#define ll long long
#define XX first
#define YY second
#define pb push_back
#define sz (x) int(x.size())
#define pf pop_front
#define pob pop_back
#define pff push_front

const int NMAX = 3e3;
int n, m;
char v[NMAX + 1][NMAX + 1];
int w[NMAX + 1][NMAX + 1];
int matrix[NMAX + 1][NMAX + 1];
signed main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> m;
    for (int i = 1; i <= n; ++ i){
        for (int j = 1; j <= m; ++ j){
            cin >> v[i][j];
            w[i][j] = v[i - 1][j];
            matrix[i][j] = v[i][j - 1];
            if (v[i][j] == 'O')
                matrix[i][j] ++;
            if (v[i][j] == 'I')
                w[i][j] ++;
        }
    }
    int sum = 0;
    for (int i = 1; i <= n; ++ i){
        for (int j = 1; j <= m; ++ j){
            if (v[i][j] == 'J'){
                sum += (w[n][j] - w[i - 1][j]) * (matrix[i][m] - matrix[i][j - 1]);
            }
        }
    }
    cout << sum << "\n";
    return 0 ^ 0;   
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4440 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4440 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4440 KB Output isn't correct
2 Halted 0 ms 0 KB -