Submission #878753

# Submission time Handle Problem Language Result Execution time Memory
878753 2023-11-25T07:24:32 Z niter Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
365 ms 79796 KB
#include <bits/stdc++.h>
#define pb push_back
#define ins isnert
#define pii pair<int,int>
#define ff first
#define ss second
#define loop(i,a,b) for(int i = (a); i < (b); i ++)
#define op(x) cerr << #x << " = " << x << endl;
#define opa(x) cerr << #x << " = " << x << ", ";
#define ops(x) cerr << x;
#define spac cerr << ' ';
#define entr cerr << endl;
#define STL(x) cerr << #x << " : "; for(auto &qwe:x) cerr << qwe << ' '; cerr << endl;
#define ARR(x, nnn) cerr << #x << " : "; loop(qwe,0,nnn) cerr << x[qwe] << ' '; cerr << endl;
#define BAE(x) (x).begin(), (x).end()
using namespace std;

const int mxn = 3005;
char c[mxn][mxn];
int suf_o[mxn][mxn], suf_i[mxn][mxn];

int main(){
    int n, m;
    cin >> n >> m;
    loop(i,0,n){
        loop(j,0,m){
            cin >> c[i+1][j+1];
        }
    }
    loop(i,1,n+1){
        for(int j = m; j >= 1; j--){
            suf_o[i][j] += suf_o[i][j+1] + (c[i][j] == 'O');
        }
    }
    for(int i = n; i >= 1; i--){
        loop(j,1,m+1){
            suf_i[i][j] += suf_i[i+1][j] + (c[i][j] == 'I');
        }
    }
    long long ans = 0;
    loop(i,1,n+1){
        loop(j,1,m+1){
            if(c[i][j] == 'J'){
                ans += suf_o[i][j] * suf_i[i][j];
            }
        }
    }
    cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 ms 3164 KB Output is correct
6 Correct 1 ms 3164 KB Output is correct
7 Correct 1 ms 3164 KB Output is correct
8 Correct 2 ms 3164 KB Output is correct
9 Correct 1 ms 3164 KB Output is correct
10 Correct 2 ms 3164 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 3164 KB Output is correct
13 Correct 1 ms 3164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 ms 3164 KB Output is correct
6 Correct 1 ms 3164 KB Output is correct
7 Correct 1 ms 3164 KB Output is correct
8 Correct 2 ms 3164 KB Output is correct
9 Correct 1 ms 3164 KB Output is correct
10 Correct 2 ms 3164 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 3164 KB Output is correct
13 Correct 1 ms 3164 KB Output is correct
14 Correct 10 ms 12124 KB Output is correct
15 Correct 2 ms 8624 KB Output is correct
16 Correct 6 ms 6488 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 12 ms 12380 KB Output is correct
19 Correct 11 ms 12380 KB Output is correct
20 Correct 12 ms 12224 KB Output is correct
21 Correct 12 ms 12476 KB Output is correct
22 Correct 11 ms 12376 KB Output is correct
23 Correct 11 ms 12224 KB Output is correct
24 Correct 12 ms 12380 KB Output is correct
25 Correct 11 ms 12380 KB Output is correct
26 Correct 11 ms 12376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 ms 3164 KB Output is correct
6 Correct 1 ms 3164 KB Output is correct
7 Correct 1 ms 3164 KB Output is correct
8 Correct 2 ms 3164 KB Output is correct
9 Correct 1 ms 3164 KB Output is correct
10 Correct 2 ms 3164 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 3164 KB Output is correct
13 Correct 1 ms 3164 KB Output is correct
14 Correct 10 ms 12124 KB Output is correct
15 Correct 2 ms 8624 KB Output is correct
16 Correct 6 ms 6488 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 12 ms 12380 KB Output is correct
19 Correct 11 ms 12380 KB Output is correct
20 Correct 12 ms 12224 KB Output is correct
21 Correct 12 ms 12476 KB Output is correct
22 Correct 11 ms 12376 KB Output is correct
23 Correct 11 ms 12224 KB Output is correct
24 Correct 12 ms 12380 KB Output is correct
25 Correct 11 ms 12380 KB Output is correct
26 Correct 11 ms 12376 KB Output is correct
27 Correct 339 ms 79796 KB Output is correct
28 Correct 9 ms 44892 KB Output is correct
29 Correct 25 ms 8540 KB Output is correct
30 Correct 1 ms 2652 KB Output is correct
31 Correct 253 ms 67256 KB Output is correct
32 Correct 351 ms 79788 KB Output is correct
33 Correct 346 ms 79552 KB Output is correct
34 Correct 292 ms 77904 KB Output is correct
35 Correct 333 ms 79784 KB Output is correct
36 Correct 365 ms 79504 KB Output is correct
37 Correct 363 ms 79784 KB Output is correct
38 Correct 240 ms 67404 KB Output is correct
39 Correct 234 ms 66996 KB Output is correct