Submission #230047

# Submission time Handle Problem Language Result Execution time Memory
230047 2020-05-07T21:13:37 Z nickmet2004 Bitaro the Brave (JOI19_ho_t1) C++11
50 / 100
24 ms 18688 KB
#include<bits/stdc++.h>
#define ll long long

using namespace std;

const int N = 2005;

int H , W;
string s[N];
int Jo[N][N] , Ji[N][N];

ll solve(){
    for(int i = 0; i < H; ++i){
        int cntO = 0;
        for(int j = W - 1; j >= 0; --j){
            if(s[i][j] == 'O') ++cntO;
            if(s[i][j] == 'J') Jo[i][j] = cntO;
        }
    }
    for(int i = 0; i < W; ++i){
        int cntI = 0;
        for(int j = H - 1; j>= 0; --j){
            if(s[j][i] == 'I') ++cntI;
            if(s[j][i] == 'J') Ji[j][i] = cntI;
        }
    }/*
    for(int i = 0; i < H; ++i){
        for(int j = 0; j < W; ++j) cout << Jo[i][j] << " "; cout << endl;
    }cerr << endl;
    for(int i = 0; i < H; ++i){
        for(int j = 0; j < W; ++j) cout << Ji[i][j] << " "; cout << endl;
    }cerr << endl;
    */
    ll ans = 0;
    for(int i = 0; i < H; ++i){
        for(int j = 0; j < W; ++j){
            //cerr << Jo[i][j] * Ji[i][j] << endl;
            ans += 1LL*(Jo[i][j] * Ji[i][j]);
        }
    }
    return ans;
}

int main (){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> H >> W;
    for(int i = 0; i < H; ++i) cin >> s[i];
    cout << solve() << endl;

}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 6 ms 1280 KB Output is correct
6 Correct 5 ms 1152 KB Output is correct
7 Correct 5 ms 1152 KB Output is correct
8 Correct 5 ms 1280 KB Output is correct
9 Correct 5 ms 1280 KB Output is correct
10 Correct 5 ms 1152 KB Output is correct
11 Correct 5 ms 1280 KB Output is correct
12 Correct 5 ms 1280 KB Output is correct
13 Correct 5 ms 1152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 6 ms 1280 KB Output is correct
6 Correct 5 ms 1152 KB Output is correct
7 Correct 5 ms 1152 KB Output is correct
8 Correct 5 ms 1280 KB Output is correct
9 Correct 5 ms 1280 KB Output is correct
10 Correct 5 ms 1152 KB Output is correct
11 Correct 5 ms 1280 KB Output is correct
12 Correct 5 ms 1280 KB Output is correct
13 Correct 5 ms 1152 KB Output is correct
14 Correct 11 ms 6272 KB Output is correct
15 Correct 6 ms 3584 KB Output is correct
16 Correct 7 ms 3328 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 12 ms 6784 KB Output is correct
19 Correct 9 ms 5888 KB Output is correct
20 Correct 8 ms 5504 KB Output is correct
21 Correct 12 ms 6912 KB Output is correct
22 Correct 9 ms 6144 KB Output is correct
23 Correct 8 ms 5504 KB Output is correct
24 Correct 12 ms 6912 KB Output is correct
25 Correct 9 ms 5888 KB Output is correct
26 Correct 8 ms 5504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 6 ms 1280 KB Output is correct
6 Correct 5 ms 1152 KB Output is correct
7 Correct 5 ms 1152 KB Output is correct
8 Correct 5 ms 1280 KB Output is correct
9 Correct 5 ms 1280 KB Output is correct
10 Correct 5 ms 1152 KB Output is correct
11 Correct 5 ms 1280 KB Output is correct
12 Correct 5 ms 1280 KB Output is correct
13 Correct 5 ms 1152 KB Output is correct
14 Correct 11 ms 6272 KB Output is correct
15 Correct 6 ms 3584 KB Output is correct
16 Correct 7 ms 3328 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 12 ms 6784 KB Output is correct
19 Correct 9 ms 5888 KB Output is correct
20 Correct 8 ms 5504 KB Output is correct
21 Correct 12 ms 6912 KB Output is correct
22 Correct 9 ms 6144 KB Output is correct
23 Correct 8 ms 5504 KB Output is correct
24 Correct 12 ms 6912 KB Output is correct
25 Correct 9 ms 5888 KB Output is correct
26 Correct 8 ms 5504 KB Output is correct
27 Runtime error 24 ms 18688 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Halted 0 ms 0 KB -