Submission #256351

# Submission time Handle Problem Language Result Execution time Memory
256351 2020-08-02T15:08:06 Z Osama_Alkhodairy Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
294 ms 89336 KB
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

const int N = 3001;

int n, m, g[N][N], h[N][N];
vector <string> a;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m;
    a.resize(n);
    for(auto &i : a) cin >> i;
    for(int i = 0 ; i < n ; i++){
        for(int j = m - 1 ; j >= 0 ; j--){
            g[i][j] = g[i][j + 1] + (a[i][j] == 'O');
        }
    }
    for(int j = 0 ; j < m ; j++){
        for(int i = n - 1 ; i >= 0 ; i--){
            h[i][j] = h[i + 1][j] + (a[i][j] == 'I');
        }
    }
    ll ans = 0;
    for(int i = 0 ; i < n ; i++){
        for(int j = 0 ; j < m ; j++){
            if(a[i][j] == 'J'){
                ans += 1LL * g[i][j] * h[i][j];
            }
        }
    }
    cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 1280 KB Output is correct
6 Correct 1 ms 1280 KB Output is correct
7 Correct 1 ms 1152 KB Output is correct
8 Correct 2 ms 1280 KB Output is correct
9 Correct 1 ms 1280 KB Output is correct
10 Correct 1 ms 1152 KB Output is correct
11 Correct 1 ms 1280 KB Output is correct
12 Correct 2 ms 1280 KB Output is correct
13 Correct 1 ms 1152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 1280 KB Output is correct
6 Correct 1 ms 1280 KB Output is correct
7 Correct 1 ms 1152 KB Output is correct
8 Correct 2 ms 1280 KB Output is correct
9 Correct 1 ms 1280 KB Output is correct
10 Correct 1 ms 1152 KB Output is correct
11 Correct 1 ms 1280 KB Output is correct
12 Correct 2 ms 1280 KB Output is correct
13 Correct 1 ms 1152 KB Output is correct
14 Correct 6 ms 6272 KB Output is correct
15 Correct 2 ms 3840 KB Output is correct
16 Correct 3 ms 3712 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 7 ms 6784 KB Output is correct
19 Correct 6 ms 6784 KB Output is correct
20 Correct 6 ms 6656 KB Output is correct
21 Correct 7 ms 6784 KB Output is correct
22 Correct 6 ms 6784 KB Output is correct
23 Correct 6 ms 6656 KB Output is correct
24 Correct 7 ms 6784 KB Output is correct
25 Correct 6 ms 6784 KB Output is correct
26 Correct 6 ms 6656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 1280 KB Output is correct
6 Correct 1 ms 1280 KB Output is correct
7 Correct 1 ms 1152 KB Output is correct
8 Correct 2 ms 1280 KB Output is correct
9 Correct 1 ms 1280 KB Output is correct
10 Correct 1 ms 1152 KB Output is correct
11 Correct 1 ms 1280 KB Output is correct
12 Correct 2 ms 1280 KB Output is correct
13 Correct 1 ms 1152 KB Output is correct
14 Correct 6 ms 6272 KB Output is correct
15 Correct 2 ms 3840 KB Output is correct
16 Correct 3 ms 3712 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 7 ms 6784 KB Output is correct
19 Correct 6 ms 6784 KB Output is correct
20 Correct 6 ms 6656 KB Output is correct
21 Correct 7 ms 6784 KB Output is correct
22 Correct 6 ms 6784 KB Output is correct
23 Correct 6 ms 6656 KB Output is correct
24 Correct 7 ms 6784 KB Output is correct
25 Correct 6 ms 6784 KB Output is correct
26 Correct 6 ms 6656 KB Output is correct
27 Correct 283 ms 88312 KB Output is correct
28 Correct 11 ms 19328 KB Output is correct
29 Correct 13 ms 7808 KB Output is correct
30 Correct 1 ms 640 KB Output is correct
31 Correct 215 ms 71864 KB Output is correct
32 Correct 269 ms 89208 KB Output is correct
33 Correct 261 ms 89080 KB Output is correct
34 Correct 233 ms 83320 KB Output is correct
35 Correct 275 ms 89208 KB Output is correct
36 Correct 261 ms 89052 KB Output is correct
37 Correct 294 ms 89336 KB Output is correct
38 Correct 178 ms 71800 KB Output is correct
39 Correct 175 ms 71544 KB Output is correct