Submission #334409

# Submission time Handle Problem Language Result Execution time Memory
334409 2020-12-09T06:11:46 Z Tahmid690 Bitaro the Brave (JOI19_ho_t1) C++14
50 / 100
968 ms 274436 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    int h,w;
    string s[3005];
    cin >> h >> w;
    for(int i=0;i<h;i++) cin >> s[i];
    unordered_map<int,int> rows;
    unordered_map<int,int> colum;
    unordered_map<int,map<int,int>> rowsfin;
    unordered_map<int,map<int,int>> columfin;
    
    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 4 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 5 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 4 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 5 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 109 ms 18924 KB Output is correct
15 Correct 2 ms 876 KB Output is correct
16 Correct 70 ms 13036 KB Output is correct
17 Correct 2 ms 748 KB Output is correct
18 Correct 151 ms 24684 KB Output is correct
19 Correct 144 ms 23532 KB Output is correct
20 Correct 149 ms 24248 KB Output is correct
21 Correct 148 ms 24812 KB Output is correct
22 Correct 144 ms 23660 KB Output is correct
23 Correct 145 ms 24300 KB Output is correct
24 Correct 150 ms 24812 KB Output is correct
25 Correct 141 ms 23660 KB Output is correct
26 Correct 147 ms 24428 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 4 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 5 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 109 ms 18924 KB Output is correct
15 Correct 2 ms 876 KB Output is correct
16 Correct 70 ms 13036 KB Output is correct
17 Correct 2 ms 748 KB Output is correct
18 Correct 151 ms 24684 KB Output is correct
19 Correct 144 ms 23532 KB Output is correct
20 Correct 149 ms 24248 KB Output is correct
21 Correct 148 ms 24812 KB Output is correct
22 Correct 144 ms 23660 KB Output is correct
23 Correct 145 ms 24300 KB Output is correct
24 Correct 150 ms 24812 KB Output is correct
25 Correct 141 ms 23660 KB Output is correct
26 Correct 147 ms 24428 KB Output is correct
27 Runtime error 968 ms 274436 KB Execution killed with signal 9 (could be triggered by violating memory limits)
28 Halted 0 ms 0 KB -