Submission #101845

# Submission time Handle Problem Language Result Execution time Memory
101845 2019-03-20T13:56:43 Z brcode Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
954 ms 155384 KB
#include <iostream>

using namespace std;
const long long MAXN = 3010;
char arr[MAXN][MAXN];
long long dp[MAXN][MAXN];
long long dp2[MAXN][MAXN];
int main(){
    long long n,m;
    cin>>n>>m;
    for(long long i=1;i<=n;i++){
        for(long long j=1;j<=m;j++){
            cin>>arr[i][j];
        }
    }
    for(long long i=1;i<=n;i++){
        for(long long j=m;j>=1;j--){
            dp[i][j] = dp[i][j+1]+(arr[i][j] == 'O');
            
        }
    }
    for(long long j=1;j<=m;j++){
        for(long long i=n;i>=1;i--){
            dp2[i][j] = dp2[i+1][j] + (arr[i][j] == 'I');
        }
    }
    long long ans =0;
    for(long long i=1;i<=n;i++){
        for(long long j=1;j<=m;j++){
            if(arr[i][j] == 'J'){
                ans+= ((long long)1*(dp2[i][j]*dp[i][j]));
            }
        }
    }
    cout<<ans<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 4 ms 1664 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 4 ms 1536 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1536 KB Output is correct
11 Correct 4 ms 1664 KB Output is correct
12 Correct 3 ms 1532 KB Output is correct
13 Correct 4 ms 1536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 4 ms 1664 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 4 ms 1536 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1536 KB Output is correct
11 Correct 4 ms 1664 KB Output is correct
12 Correct 3 ms 1532 KB Output is correct
13 Correct 4 ms 1536 KB Output is correct
14 Correct 23 ms 8960 KB Output is correct
15 Correct 6 ms 5120 KB Output is correct
16 Correct 14 ms 5248 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 40 ms 9872 KB Output is correct
19 Correct 36 ms 9848 KB Output is correct
20 Correct 26 ms 9720 KB Output is correct
21 Correct 33 ms 9960 KB Output is correct
22 Correct 25 ms 9728 KB Output is correct
23 Correct 25 ms 9728 KB Output is correct
24 Correct 27 ms 9976 KB Output is correct
25 Correct 26 ms 9728 KB Output is correct
26 Correct 27 ms 9720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 4 ms 1664 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 4 ms 1536 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1536 KB Output is correct
11 Correct 4 ms 1664 KB Output is correct
12 Correct 3 ms 1532 KB Output is correct
13 Correct 4 ms 1536 KB Output is correct
14 Correct 23 ms 8960 KB Output is correct
15 Correct 6 ms 5120 KB Output is correct
16 Correct 14 ms 5248 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 40 ms 9872 KB Output is correct
19 Correct 36 ms 9848 KB Output is correct
20 Correct 26 ms 9720 KB Output is correct
21 Correct 33 ms 9960 KB Output is correct
22 Correct 25 ms 9728 KB Output is correct
23 Correct 25 ms 9728 KB Output is correct
24 Correct 27 ms 9976 KB Output is correct
25 Correct 26 ms 9728 KB Output is correct
26 Correct 27 ms 9720 KB Output is correct
27 Correct 883 ms 155280 KB Output is correct
28 Correct 25 ms 26360 KB Output is correct
29 Correct 53 ms 13816 KB Output is correct
30 Correct 4 ms 896 KB Output is correct
31 Correct 710 ms 130396 KB Output is correct
32 Correct 917 ms 155256 KB Output is correct
33 Correct 954 ms 154744 KB Output is correct
34 Correct 811 ms 150344 KB Output is correct
35 Correct 941 ms 155256 KB Output is correct
36 Correct 946 ms 154820 KB Output is correct
37 Correct 947 ms 155384 KB Output is correct
38 Correct 608 ms 129580 KB Output is correct
39 Correct 659 ms 129784 KB Output is correct