Submission #334412

# Submission time Handle Problem Language Result Execution time Memory
334412 2020-12-09T06:16:18 Z Tahmid690 Bitaro the Brave (JOI19_ho_t1) C++14
50 / 100
616 ms 274432 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int h,w;
string s[3005];
unordered_map<int,int> rows;
unordered_map<int,int> colum;
unordered_map<int,map<int,int>> rowsfin;
unordered_map<int,map<int,int>> columfin;

int main(){
    
    cin >> h >> w;
    for(int i=0;i<h;i++) cin >> s[i];
    
    
    for(int i=0;i<h;i++){
        int 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++){
        int 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++){
            ll a,b,c,d;
            a=rows[i];
            b=rowsfin[i][j];
            c=colum[j];
            d=columfin[j][i];
            if(s[i][j]=='J') ans+=((a-b)*(c-d));
        }
    }
    cout << ans << endl;
    
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 4 ms 1360 KB Output is correct
6 Correct 3 ms 1104 KB Output is correct
7 Correct 3 ms 1392 KB Output is correct
8 Correct 4 ms 1360 KB Output is correct
9 Correct 3 ms 1272 KB Output is correct
10 Correct 3 ms 1360 KB Output is correct
11 Correct 3 ms 1372 KB Output is correct
12 Correct 3 ms 1104 KB Output is correct
13 Correct 4 ms 1528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 4 ms 1360 KB Output is correct
6 Correct 3 ms 1104 KB Output is correct
7 Correct 3 ms 1392 KB Output is correct
8 Correct 4 ms 1360 KB Output is correct
9 Correct 3 ms 1272 KB Output is correct
10 Correct 3 ms 1360 KB Output is correct
11 Correct 3 ms 1372 KB Output is correct
12 Correct 3 ms 1104 KB Output is correct
13 Correct 4 ms 1528 KB Output is correct
14 Correct 101 ms 19024 KB Output is correct
15 Correct 2 ms 1024 KB Output is correct
16 Correct 48 ms 13192 KB Output is correct
17 Correct 2 ms 848 KB Output is correct
18 Correct 104 ms 24904 KB Output is correct
19 Correct 93 ms 23624 KB Output is correct
20 Correct 105 ms 24228 KB Output is correct
21 Correct 108 ms 24720 KB Output is correct
22 Correct 112 ms 23608 KB Output is correct
23 Correct 102 ms 24396 KB Output is correct
24 Correct 115 ms 24904 KB Output is correct
25 Correct 100 ms 23620 KB Output is correct
26 Correct 109 ms 24392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 4 ms 1360 KB Output is correct
6 Correct 3 ms 1104 KB Output is correct
7 Correct 3 ms 1392 KB Output is correct
8 Correct 4 ms 1360 KB Output is correct
9 Correct 3 ms 1272 KB Output is correct
10 Correct 3 ms 1360 KB Output is correct
11 Correct 3 ms 1372 KB Output is correct
12 Correct 3 ms 1104 KB Output is correct
13 Correct 4 ms 1528 KB Output is correct
14 Correct 101 ms 19024 KB Output is correct
15 Correct 2 ms 1024 KB Output is correct
16 Correct 48 ms 13192 KB Output is correct
17 Correct 2 ms 848 KB Output is correct
18 Correct 104 ms 24904 KB Output is correct
19 Correct 93 ms 23624 KB Output is correct
20 Correct 105 ms 24228 KB Output is correct
21 Correct 108 ms 24720 KB Output is correct
22 Correct 112 ms 23608 KB Output is correct
23 Correct 102 ms 24396 KB Output is correct
24 Correct 115 ms 24904 KB Output is correct
25 Correct 100 ms 23620 KB Output is correct
26 Correct 109 ms 24392 KB Output is correct
27 Runtime error 616 ms 274432 KB Execution killed with signal 9
28 Halted 0 ms 0 KB -