Submission #233934

# Submission time Handle Problem Language Result Execution time Memory
233934 2020-05-22T12:40:00 Z nicolaalexandra Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
712 ms 88824 KB
#include <bits/stdc++.h>
#define DIM 3010
using namespace std;
char a[DIM][DIM];
int dp_right[DIM][DIM],dp_up[DIM][DIM];
int n,m,i,j;
int main (){

    //ifstream cin ("date.in");
    //ofstream cout ("date.out");

    cin>>n>>m;
    for (i=1;i<=n;i++)
        cin>>a[i]+1;


    for (i=1;i<=n;i++){
        for (j=m;j;j--){
            dp_right[i][j] = dp_right[i][j+1];
            if (a[i][j] == 'O')
                dp_right[i][j]++;
        }
    }

    for (j=1;j<=m;j++){
        for (i=n;i;i--){
            dp_up[i][j] = dp_up[i+1][j];
            if (a[i][j] == 'I')
                dp_up[i][j]++;
        }
    }


    long long sol = 0;
    for (i=1;i<=n;i++)
        for (j=1;j<=m;j++)
            if (a[i][j] == 'J')
                sol += 1LL * dp_right[i][j] * dp_up[i][j];
    cout<<sol;

    return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:14:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
         cin>>a[i]+1;
              ~~~~^~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 512 KB Output is correct
5 Correct 7 ms 1536 KB Output is correct
6 Correct 6 ms 1536 KB Output is correct
7 Correct 5 ms 1408 KB Output is correct
8 Correct 6 ms 1536 KB Output is correct
9 Correct 6 ms 1536 KB Output is correct
10 Correct 7 ms 1408 KB Output is correct
11 Correct 7 ms 1536 KB Output is correct
12 Correct 6 ms 1536 KB Output is correct
13 Correct 6 ms 1408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 512 KB Output is correct
5 Correct 7 ms 1536 KB Output is correct
6 Correct 6 ms 1536 KB Output is correct
7 Correct 5 ms 1408 KB Output is correct
8 Correct 6 ms 1536 KB Output is correct
9 Correct 6 ms 1536 KB Output is correct
10 Correct 7 ms 1408 KB Output is correct
11 Correct 7 ms 1536 KB Output is correct
12 Correct 6 ms 1536 KB Output is correct
13 Correct 6 ms 1408 KB Output is correct
14 Correct 21 ms 7552 KB Output is correct
15 Correct 7 ms 4992 KB Output is correct
16 Correct 13 ms 4224 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 24 ms 8064 KB Output is correct
19 Correct 21 ms 7936 KB Output is correct
20 Correct 21 ms 7808 KB Output is correct
21 Correct 23 ms 8064 KB Output is correct
22 Correct 21 ms 7936 KB Output is correct
23 Correct 21 ms 7808 KB Output is correct
24 Correct 24 ms 8064 KB Output is correct
25 Correct 21 ms 7936 KB Output is correct
26 Correct 21 ms 7808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 512 KB Output is correct
5 Correct 7 ms 1536 KB Output is correct
6 Correct 6 ms 1536 KB Output is correct
7 Correct 5 ms 1408 KB Output is correct
8 Correct 6 ms 1536 KB Output is correct
9 Correct 6 ms 1536 KB Output is correct
10 Correct 7 ms 1408 KB Output is correct
11 Correct 7 ms 1536 KB Output is correct
12 Correct 6 ms 1536 KB Output is correct
13 Correct 6 ms 1408 KB Output is correct
14 Correct 21 ms 7552 KB Output is correct
15 Correct 7 ms 4992 KB Output is correct
16 Correct 13 ms 4224 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 24 ms 8064 KB Output is correct
19 Correct 21 ms 7936 KB Output is correct
20 Correct 21 ms 7808 KB Output is correct
21 Correct 23 ms 8064 KB Output is correct
22 Correct 21 ms 7936 KB Output is correct
23 Correct 21 ms 7808 KB Output is correct
24 Correct 24 ms 8064 KB Output is correct
25 Correct 21 ms 7936 KB Output is correct
26 Correct 21 ms 7808 KB Output is correct
27 Correct 668 ms 88192 KB Output is correct
28 Correct 20 ms 26112 KB Output is correct
29 Correct 42 ms 7800 KB Output is correct
30 Correct 6 ms 640 KB Output is correct
31 Correct 494 ms 72696 KB Output is correct
32 Correct 636 ms 88696 KB Output is correct
33 Correct 635 ms 88440 KB Output is correct
34 Correct 597 ms 84344 KB Output is correct
35 Correct 649 ms 88824 KB Output is correct
36 Correct 623 ms 88440 KB Output is correct
37 Correct 712 ms 88568 KB Output is correct
38 Correct 442 ms 72696 KB Output is correct
39 Correct 444 ms 72444 KB Output is correct