Submission #1049592

# Submission time Handle Problem Language Result Execution time Memory
1049592 2024-08-09T00:55:26 Z vjudge1 Bitaro the Brave (JOI19_ho_t1) C++11
100 / 100
133 ms 151376 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define pb push_back
#define skdkdjfkv ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

void solve(){
    ll h, w;
    cin >> h >> w;
    string s[h+1];
    for(int i=1; i<=h; i++){
        cin >> s[i];
    }
    ll sufho[h+5][w+5], sufvi[w+5][h+5];
    for(int i=1; i<=h; i++){
        sufho[i][w+1]=0;
        for(int j=w; j>=1; j--){
            sufho[i][j]=sufho[i][j+1]+(s[i][j-1]=='O');
        }
    }
    for(int j=1; j<=w; j++){
        sufvi[j][h+1]=0;
        for(int i=h; i>=1; i--){
            sufvi[j][i]=sufvi[j][i+1]+(s[i][j-1]=='I');
        }
    }
    ll ans=0;
    for(int i=1; i<=h; i++){
        for(int j=1; j<=w; j++){
            if(s[i][j-1]=='J'){
                ans+=sufho[i][j+1]*sufvi[j][i+1];
            }
        }
    }
    cout << ans;
}

int main(){
    skdkdjfkv
    ll tc=1;
    //cin >> tc;
    while(tc--){
        solve();
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 0 ms 604 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 0 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 0 ms 604 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 0 ms 600 KB Output is correct
14 Correct 3 ms 3732 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 2652 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 3 ms 4700 KB Output is correct
19 Correct 3 ms 4444 KB Output is correct
20 Correct 3 ms 4444 KB Output is correct
21 Correct 4 ms 4700 KB Output is correct
22 Correct 3 ms 4548 KB Output is correct
23 Correct 3 ms 4440 KB Output is correct
24 Correct 3 ms 4700 KB Output is correct
25 Correct 3 ms 4444 KB Output is correct
26 Correct 3 ms 4444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 0 ms 604 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 0 ms 600 KB Output is correct
14 Correct 3 ms 3732 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 2652 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 3 ms 4700 KB Output is correct
19 Correct 3 ms 4444 KB Output is correct
20 Correct 3 ms 4444 KB Output is correct
21 Correct 4 ms 4700 KB Output is correct
22 Correct 3 ms 4548 KB Output is correct
23 Correct 3 ms 4440 KB Output is correct
24 Correct 3 ms 4700 KB Output is correct
25 Correct 3 ms 4444 KB Output is correct
26 Correct 3 ms 4444 KB Output is correct
27 Correct 127 ms 142928 KB Output is correct
28 Correct 1 ms 860 KB Output is correct
29 Correct 7 ms 11328 KB Output is correct
30 Correct 0 ms 860 KB Output is correct
31 Correct 109 ms 105300 KB Output is correct
32 Correct 111 ms 150356 KB Output is correct
33 Correct 112 ms 151012 KB Output is correct
34 Correct 107 ms 122100 KB Output is correct
35 Correct 116 ms 150352 KB Output is correct
36 Correct 132 ms 150868 KB Output is correct
37 Correct 133 ms 151376 KB Output is correct
38 Correct 70 ms 104532 KB Output is correct
39 Correct 83 ms 104784 KB Output is correct