Submission #334405

# Submission time Handle Problem Language Result Execution time Memory
334405 2020-12-09T06:06:54 Z Tahmid690 Bitaro the Brave (JOI19_ho_t1) C++14
20 / 100
115 ms 24812 KB
#include<bits/stdc++.h>
using namespace std;
#define ll int
int main(){
    ll h,w;
    string s[3005];
    cin >> h >> w;
    for(int i=0;i<h;i++) cin >> s[i];
    unordered_map<ll,ll> rows;
    unordered_map<ll,ll> colum;
    unordered_map<ll,map<ll,ll>> rowsfin;
    unordered_map<ll,map<ll,ll>> columfin;
    
    for(int i=0;i<h;i++){
        ll x=0;
        for(int j=0;j<w;j++){
            if(s[i][j]=='O') x++;
            rowsfin[i][j+1]=x;
        }
        rows[i]=x;
       
    }
    
    for(int i=0;i<w;i++){
        ll x=0;
        for(int j=0;j<h;j++){
            if(s[j][i]=='I') x++;
            columfin[i][j+1]=x;
        }
        colum[i]=x;
       
        
    }
    
    ll ans=0;
    for(ll i=0;i<h;i++){
        for(ll j=0;j<w;j++){
            if(s[i][j]=='J') ans+=((rows[i]-rowsfin[i][j])*(colum[j]-columfin[j][i]));
        }
    }
    cout << ans << endl;
    
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 4 ms 1388 KB Output is correct
6 Correct 3 ms 1260 KB Output is correct
7 Correct 4 ms 1260 KB Output is correct
8 Correct 5 ms 1388 KB Output is correct
9 Correct 3 ms 1260 KB Output is correct
10 Correct 4 ms 1260 KB Output is correct
11 Correct 4 ms 1388 KB Output is correct
12 Correct 3 ms 1260 KB Output is correct
13 Correct 4 ms 1260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 4 ms 1388 KB Output is correct
6 Correct 3 ms 1260 KB Output is correct
7 Correct 4 ms 1260 KB Output is correct
8 Correct 5 ms 1388 KB Output is correct
9 Correct 3 ms 1260 KB Output is correct
10 Correct 4 ms 1260 KB Output is correct
11 Correct 4 ms 1388 KB Output is correct
12 Correct 3 ms 1260 KB Output is correct
13 Correct 4 ms 1260 KB Output is correct
14 Correct 83 ms 19052 KB Output is correct
15 Correct 2 ms 896 KB Output is correct
16 Correct 55 ms 13036 KB Output is correct
17 Correct 2 ms 748 KB Output is correct
18 Correct 115 ms 24812 KB Output is correct
19 Correct 87 ms 23532 KB Output is correct
20 Incorrect 94 ms 24300 KB Output isn't correct
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 4 ms 1388 KB Output is correct
6 Correct 3 ms 1260 KB Output is correct
7 Correct 4 ms 1260 KB Output is correct
8 Correct 5 ms 1388 KB Output is correct
9 Correct 3 ms 1260 KB Output is correct
10 Correct 4 ms 1260 KB Output is correct
11 Correct 4 ms 1388 KB Output is correct
12 Correct 3 ms 1260 KB Output is correct
13 Correct 4 ms 1260 KB Output is correct
14 Correct 83 ms 19052 KB Output is correct
15 Correct 2 ms 896 KB Output is correct
16 Correct 55 ms 13036 KB Output is correct
17 Correct 2 ms 748 KB Output is correct
18 Correct 115 ms 24812 KB Output is correct
19 Correct 87 ms 23532 KB Output is correct
20 Incorrect 94 ms 24300 KB Output isn't correct
21 Halted 0 ms 0 KB -