Submission #334415

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

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 492 KB Output is correct
2 Correct 1 ms 492 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 1 ms 1260 KB Output is correct
6 Correct 1 ms 1260 KB Output is correct
7 Correct 1 ms 1260 KB Output is correct
8 Correct 2 ms 1260 KB Output is correct
9 Correct 1 ms 1260 KB Output is correct
10 Correct 1 ms 1260 KB Output is correct
11 Correct 1 ms 1260 KB Output is correct
12 Correct 1 ms 1260 KB Output is correct
13 Correct 1 ms 1260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 492 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 1 ms 1260 KB Output is correct
6 Correct 1 ms 1260 KB Output is correct
7 Correct 1 ms 1260 KB Output is correct
8 Correct 2 ms 1260 KB Output is correct
9 Correct 1 ms 1260 KB Output is correct
10 Correct 1 ms 1260 KB Output is correct
11 Correct 1 ms 1260 KB Output is correct
12 Correct 1 ms 1260 KB Output is correct
13 Correct 1 ms 1260 KB Output is correct
14 Correct 9 ms 5740 KB Output is correct
15 Correct 2 ms 2164 KB Output is correct
16 Correct 6 ms 4716 KB Output is correct
17 Correct 1 ms 1644 KB Output is correct
18 Correct 11 ms 6892 KB Output is correct
19 Correct 10 ms 6636 KB Output is correct
20 Correct 10 ms 6764 KB Output is correct
21 Correct 12 ms 6892 KB Output is correct
22 Correct 11 ms 6524 KB Output is correct
23 Correct 10 ms 6764 KB Output is correct
24 Correct 12 ms 6908 KB Output is correct
25 Correct 10 ms 6508 KB Output is correct
26 Correct 10 ms 6764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 492 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 1 ms 1260 KB Output is correct
6 Correct 1 ms 1260 KB Output is correct
7 Correct 1 ms 1260 KB Output is correct
8 Correct 2 ms 1260 KB Output is correct
9 Correct 1 ms 1260 KB Output is correct
10 Correct 1 ms 1260 KB Output is correct
11 Correct 1 ms 1260 KB Output is correct
12 Correct 1 ms 1260 KB Output is correct
13 Correct 1 ms 1260 KB Output is correct
14 Correct 9 ms 5740 KB Output is correct
15 Correct 2 ms 2164 KB Output is correct
16 Correct 6 ms 4716 KB Output is correct
17 Correct 1 ms 1644 KB Output is correct
18 Correct 11 ms 6892 KB Output is correct
19 Correct 10 ms 6636 KB Output is correct
20 Correct 10 ms 6764 KB Output is correct
21 Correct 12 ms 6892 KB Output is correct
22 Correct 11 ms 6524 KB Output is correct
23 Correct 10 ms 6764 KB Output is correct
24 Correct 12 ms 6908 KB Output is correct
25 Correct 10 ms 6508 KB Output is correct
26 Correct 10 ms 6764 KB Output is correct
27 Correct 449 ms 84844 KB Output is correct
28 Correct 7 ms 9964 KB Output is correct
29 Correct 33 ms 17644 KB Output is correct
30 Correct 6 ms 9964 KB Output is correct
31 Correct 320 ms 73580 KB Output is correct
32 Correct 448 ms 87020 KB Output is correct
33 Correct 444 ms 87148 KB Output is correct
34 Correct 369 ms 79828 KB Output is correct
35 Correct 446 ms 87048 KB Output is correct
36 Correct 439 ms 87020 KB Output is correct
37 Correct 448 ms 87276 KB Output is correct
38 Correct 307 ms 73368 KB Output is correct
39 Correct 315 ms 73452 KB Output is correct