Submission #844648

# Submission time Handle Problem Language Result Execution time Memory
844648 2023-09-05T15:41:04 Z leanchec Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
270 ms 89348 KB
#include<bits/stdc++.h>
using namespace std;

int main(){
    int h, w;
    vector<string> grid;
    cin >> h >> w;

    for(int i=0; i<h; i++){
        string a;
        cin >> a;
        grid.push_back(a);
    }

    int sumO[3010][3010]={}, sumI[3010][3010]={};

    for(int i=h-1; i>=0; i--){
        for(int j=w-1; j>=0; j--){
            sumO[i][j]=sumO[i][j+1];
            if(grid[i][j]=='O')sumO[i][j]++;
            sumI[i][j]=sumI[i+1][j];
            if(grid[i][j]=='I')sumI[i][j]++;
        }
    }

    long long resp=0;

    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if(grid[i][j]!='J')continue;
            resp+=(long long)sumO[i][j]*sumI[i][j];
        }
    }

    cout << resp << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 40 ms 71248 KB Output is correct
2 Correct 40 ms 71312 KB Output is correct
3 Correct 40 ms 71260 KB Output is correct
4 Correct 40 ms 71252 KB Output is correct
5 Correct 40 ms 71260 KB Output is correct
6 Correct 39 ms 71252 KB Output is correct
7 Correct 40 ms 71248 KB Output is correct
8 Correct 40 ms 71260 KB Output is correct
9 Correct 39 ms 71256 KB Output is correct
10 Correct 40 ms 71312 KB Output is correct
11 Correct 40 ms 71576 KB Output is correct
12 Correct 39 ms 71288 KB Output is correct
13 Correct 40 ms 71252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 71248 KB Output is correct
2 Correct 40 ms 71312 KB Output is correct
3 Correct 40 ms 71260 KB Output is correct
4 Correct 40 ms 71252 KB Output is correct
5 Correct 40 ms 71260 KB Output is correct
6 Correct 39 ms 71252 KB Output is correct
7 Correct 40 ms 71248 KB Output is correct
8 Correct 40 ms 71260 KB Output is correct
9 Correct 39 ms 71256 KB Output is correct
10 Correct 40 ms 71312 KB Output is correct
11 Correct 40 ms 71576 KB Output is correct
12 Correct 39 ms 71288 KB Output is correct
13 Correct 40 ms 71252 KB Output is correct
14 Correct 45 ms 71764 KB Output is correct
15 Correct 39 ms 71252 KB Output is correct
16 Correct 42 ms 71356 KB Output is correct
17 Correct 40 ms 71248 KB Output is correct
18 Correct 47 ms 71844 KB Output is correct
19 Correct 44 ms 71760 KB Output is correct
20 Correct 44 ms 71740 KB Output is correct
21 Correct 47 ms 71728 KB Output is correct
22 Correct 44 ms 71632 KB Output is correct
23 Correct 45 ms 71772 KB Output is correct
24 Correct 46 ms 71788 KB Output is correct
25 Correct 45 ms 71724 KB Output is correct
26 Correct 44 ms 71636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 71248 KB Output is correct
2 Correct 40 ms 71312 KB Output is correct
3 Correct 40 ms 71260 KB Output is correct
4 Correct 40 ms 71252 KB Output is correct
5 Correct 40 ms 71260 KB Output is correct
6 Correct 39 ms 71252 KB Output is correct
7 Correct 40 ms 71248 KB Output is correct
8 Correct 40 ms 71260 KB Output is correct
9 Correct 39 ms 71256 KB Output is correct
10 Correct 40 ms 71312 KB Output is correct
11 Correct 40 ms 71576 KB Output is correct
12 Correct 39 ms 71288 KB Output is correct
13 Correct 40 ms 71252 KB Output is correct
14 Correct 45 ms 71764 KB Output is correct
15 Correct 39 ms 71252 KB Output is correct
16 Correct 42 ms 71356 KB Output is correct
17 Correct 40 ms 71248 KB Output is correct
18 Correct 47 ms 71844 KB Output is correct
19 Correct 44 ms 71760 KB Output is correct
20 Correct 44 ms 71740 KB Output is correct
21 Correct 47 ms 71728 KB Output is correct
22 Correct 44 ms 71632 KB Output is correct
23 Correct 45 ms 71772 KB Output is correct
24 Correct 46 ms 71788 KB Output is correct
25 Correct 45 ms 71724 KB Output is correct
26 Correct 44 ms 71636 KB Output is correct
27 Correct 236 ms 87892 KB Output is correct
28 Correct 40 ms 71660 KB Output is correct
29 Correct 54 ms 72896 KB Output is correct
30 Correct 41 ms 71252 KB Output is correct
31 Correct 188 ms 83680 KB Output is correct
32 Correct 203 ms 88972 KB Output is correct
33 Correct 203 ms 89104 KB Output is correct
34 Correct 207 ms 85588 KB Output is correct
35 Correct 191 ms 88840 KB Output is correct
36 Correct 197 ms 89348 KB Output is correct
37 Correct 270 ms 88912 KB Output is correct
38 Correct 155 ms 83628 KB Output is correct
39 Correct 154 ms 83424 KB Output is correct