Submission #844649

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

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    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]={};
    long long resp=0;

    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]++;
            if(grid[i][j]!='J')continue;
            resp+=sumO[i][j]*sumI[i][j];
        }
    }

    cout << resp << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 40 ms 71252 KB Output is correct
2 Correct 39 ms 71252 KB Output is correct
3 Correct 40 ms 71252 KB Output is correct
4 Correct 40 ms 71228 KB Output is correct
5 Correct 41 ms 71252 KB Output is correct
6 Correct 43 ms 71240 KB Output is correct
7 Correct 40 ms 71260 KB Output is correct
8 Correct 40 ms 71260 KB Output is correct
9 Correct 41 ms 71252 KB Output is correct
10 Correct 39 ms 71256 KB Output is correct
11 Correct 40 ms 71324 KB Output is correct
12 Correct 40 ms 71204 KB Output is correct
13 Correct 40 ms 71252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 71252 KB Output is correct
2 Correct 39 ms 71252 KB Output is correct
3 Correct 40 ms 71252 KB Output is correct
4 Correct 40 ms 71228 KB Output is correct
5 Correct 41 ms 71252 KB Output is correct
6 Correct 43 ms 71240 KB Output is correct
7 Correct 40 ms 71260 KB Output is correct
8 Correct 40 ms 71260 KB Output is correct
9 Correct 41 ms 71252 KB Output is correct
10 Correct 39 ms 71256 KB Output is correct
11 Correct 40 ms 71324 KB Output is correct
12 Correct 40 ms 71204 KB Output is correct
13 Correct 40 ms 71252 KB Output is correct
14 Correct 41 ms 71508 KB Output is correct
15 Correct 40 ms 71248 KB Output is correct
16 Correct 41 ms 71316 KB Output is correct
17 Correct 40 ms 71352 KB Output is correct
18 Correct 42 ms 71504 KB Output is correct
19 Correct 41 ms 71504 KB Output is correct
20 Correct 40 ms 71516 KB Output is correct
21 Correct 49 ms 71508 KB Output is correct
22 Correct 44 ms 71636 KB Output is correct
23 Correct 44 ms 71508 KB Output is correct
24 Correct 43 ms 71480 KB Output is correct
25 Correct 44 ms 71736 KB Output is correct
26 Correct 41 ms 71512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 71252 KB Output is correct
2 Correct 39 ms 71252 KB Output is correct
3 Correct 40 ms 71252 KB Output is correct
4 Correct 40 ms 71228 KB Output is correct
5 Correct 41 ms 71252 KB Output is correct
6 Correct 43 ms 71240 KB Output is correct
7 Correct 40 ms 71260 KB Output is correct
8 Correct 40 ms 71260 KB Output is correct
9 Correct 41 ms 71252 KB Output is correct
10 Correct 39 ms 71256 KB Output is correct
11 Correct 40 ms 71324 KB Output is correct
12 Correct 40 ms 71204 KB Output is correct
13 Correct 40 ms 71252 KB Output is correct
14 Correct 41 ms 71508 KB Output is correct
15 Correct 40 ms 71248 KB Output is correct
16 Correct 41 ms 71316 KB Output is correct
17 Correct 40 ms 71352 KB Output is correct
18 Correct 42 ms 71504 KB Output is correct
19 Correct 41 ms 71504 KB Output is correct
20 Correct 40 ms 71516 KB Output is correct
21 Correct 49 ms 71508 KB Output is correct
22 Correct 44 ms 71636 KB Output is correct
23 Correct 44 ms 71508 KB Output is correct
24 Correct 43 ms 71480 KB Output is correct
25 Correct 44 ms 71736 KB Output is correct
26 Correct 41 ms 71512 KB Output is correct
27 Correct 117 ms 79860 KB Output is correct
28 Correct 40 ms 71404 KB Output is correct
29 Correct 44 ms 71900 KB Output is correct
30 Correct 40 ms 71260 KB Output is correct
31 Correct 86 ms 77624 KB Output is correct
32 Correct 71 ms 80032 KB Output is correct
33 Correct 70 ms 80116 KB Output is correct
34 Correct 92 ms 78516 KB Output is correct
35 Correct 70 ms 80284 KB Output is correct
36 Correct 72 ms 80340 KB Output is correct
37 Correct 117 ms 80332 KB Output is correct
38 Correct 64 ms 77400 KB Output is correct
39 Correct 64 ms 77392 KB Output is correct