Submission #334413

# Submission time Handle Problem Language Result Execution time Memory
334413 2020-12-09T06:16:52 Z Tahmid690 Bitaro the Brave (JOI19_ho_t1) C++14
50 / 100
977 ms 274436 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 364 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 5 ms 1388 KB Output is correct
6 Correct 4 ms 1260 KB Output is correct
7 Correct 5 ms 1260 KB Output is correct
8 Correct 5 ms 1388 KB Output is correct
9 Correct 4 ms 1260 KB Output is correct
10 Correct 4 ms 1260 KB Output is correct
11 Correct 5 ms 1388 KB Output is correct
12 Correct 4 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 364 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 5 ms 1388 KB Output is correct
6 Correct 4 ms 1260 KB Output is correct
7 Correct 5 ms 1260 KB Output is correct
8 Correct 5 ms 1388 KB Output is correct
9 Correct 4 ms 1260 KB Output is correct
10 Correct 4 ms 1260 KB Output is correct
11 Correct 5 ms 1388 KB Output is correct
12 Correct 4 ms 1260 KB Output is correct
13 Correct 4 ms 1260 KB Output is correct
14 Correct 114 ms 18924 KB Output is correct
15 Correct 3 ms 876 KB Output is correct
16 Correct 71 ms 13164 KB Output is correct
17 Correct 2 ms 748 KB Output is correct
18 Correct 153 ms 24844 KB Output is correct
19 Correct 141 ms 23660 KB Output is correct
20 Correct 146 ms 24300 KB Output is correct
21 Correct 153 ms 24852 KB Output is correct
22 Correct 141 ms 23660 KB Output is correct
23 Correct 150 ms 24428 KB Output is correct
24 Correct 149 ms 24940 KB Output is correct
25 Correct 140 ms 23788 KB Output is correct
26 Correct 145 ms 24300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 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 5 ms 1388 KB Output is correct
6 Correct 4 ms 1260 KB Output is correct
7 Correct 5 ms 1260 KB Output is correct
8 Correct 5 ms 1388 KB Output is correct
9 Correct 4 ms 1260 KB Output is correct
10 Correct 4 ms 1260 KB Output is correct
11 Correct 5 ms 1388 KB Output is correct
12 Correct 4 ms 1260 KB Output is correct
13 Correct 4 ms 1260 KB Output is correct
14 Correct 114 ms 18924 KB Output is correct
15 Correct 3 ms 876 KB Output is correct
16 Correct 71 ms 13164 KB Output is correct
17 Correct 2 ms 748 KB Output is correct
18 Correct 153 ms 24844 KB Output is correct
19 Correct 141 ms 23660 KB Output is correct
20 Correct 146 ms 24300 KB Output is correct
21 Correct 153 ms 24852 KB Output is correct
22 Correct 141 ms 23660 KB Output is correct
23 Correct 150 ms 24428 KB Output is correct
24 Correct 149 ms 24940 KB Output is correct
25 Correct 140 ms 23788 KB Output is correct
26 Correct 145 ms 24300 KB Output is correct
27 Runtime error 977 ms 274436 KB Execution killed with signal 9 (could be triggered by violating memory limits)
28 Halted 0 ms 0 KB -