Submission #209238

# Submission time Handle Problem Language Result Execution time Memory
209238 2020-03-13T13:09:33 Z my99n Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
592 ms 82448 KB
#include<bits/stdc++.h>
using namespace std;


string tab[3010];
int O[3010][3010], I[3010][3010];
int main(){
    int h, w; scanf("%d %d", &h, &w);
    for (int i = 0; i < h; i++) cin >> tab[i];
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (tab[i][j] == 'O') O[i+1][j+1] = 1;
            if (tab[i][j] == 'I') I[i+1][j+1] = 1;
            O[i+1][j+1] += O[i+1][j];
            I[i+1][j+1] += I[i][j+1];
        }
    }
    long long ans = 0;
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            if (tab[i-1][j-1] == 'J') {
                ans += (O[i][w]-O[i][j-1]) * (I[h][j]-I[i-1][j]);
            }
        }
    }
    printf("%lld", ans);
    return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:8:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int h, w; scanf("%d %d", &h, &w);
               ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 6 ms 1272 KB Output is correct
6 Correct 6 ms 1272 KB Output is correct
7 Correct 6 ms 1144 KB Output is correct
8 Correct 6 ms 1272 KB Output is correct
9 Correct 6 ms 1272 KB Output is correct
10 Correct 6 ms 1144 KB Output is correct
11 Correct 6 ms 1276 KB Output is correct
12 Correct 6 ms 1272 KB Output is correct
13 Correct 6 ms 1144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 6 ms 1272 KB Output is correct
6 Correct 6 ms 1272 KB Output is correct
7 Correct 6 ms 1144 KB Output is correct
8 Correct 6 ms 1272 KB Output is correct
9 Correct 6 ms 1272 KB Output is correct
10 Correct 6 ms 1144 KB Output is correct
11 Correct 6 ms 1276 KB Output is correct
12 Correct 6 ms 1272 KB Output is correct
13 Correct 6 ms 1144 KB Output is correct
14 Correct 20 ms 6136 KB Output is correct
15 Correct 7 ms 3836 KB Output is correct
16 Correct 14 ms 3704 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 24 ms 6904 KB Output is correct
19 Correct 21 ms 6648 KB Output is correct
20 Correct 21 ms 6776 KB Output is correct
21 Correct 24 ms 6904 KB Output is correct
22 Correct 22 ms 6520 KB Output is correct
23 Correct 21 ms 6776 KB Output is correct
24 Correct 24 ms 6904 KB Output is correct
25 Correct 20 ms 6520 KB Output is correct
26 Correct 22 ms 6780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 6 ms 1272 KB Output is correct
6 Correct 6 ms 1272 KB Output is correct
7 Correct 6 ms 1144 KB Output is correct
8 Correct 6 ms 1272 KB Output is correct
9 Correct 6 ms 1272 KB Output is correct
10 Correct 6 ms 1144 KB Output is correct
11 Correct 6 ms 1276 KB Output is correct
12 Correct 6 ms 1272 KB Output is correct
13 Correct 6 ms 1144 KB Output is correct
14 Correct 20 ms 6136 KB Output is correct
15 Correct 7 ms 3836 KB Output is correct
16 Correct 14 ms 3704 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 24 ms 6904 KB Output is correct
19 Correct 21 ms 6648 KB Output is correct
20 Correct 21 ms 6776 KB Output is correct
21 Correct 24 ms 6904 KB Output is correct
22 Correct 22 ms 6520 KB Output is correct
23 Correct 21 ms 6776 KB Output is correct
24 Correct 24 ms 6904 KB Output is correct
25 Correct 20 ms 6520 KB Output is correct
26 Correct 22 ms 6780 KB Output is correct
27 Correct 565 ms 82448 KB Output is correct
28 Correct 17 ms 19192 KB Output is correct
29 Correct 42 ms 7544 KB Output is correct
30 Correct 6 ms 632 KB Output is correct
31 Correct 416 ms 68728 KB Output is correct
32 Correct 509 ms 82424 KB Output is correct
33 Correct 515 ms 82168 KB Output is correct
34 Correct 480 ms 79736 KB Output is correct
35 Correct 509 ms 82424 KB Output is correct
36 Correct 506 ms 82168 KB Output is correct
37 Correct 592 ms 82424 KB Output is correct
38 Correct 355 ms 68728 KB Output is correct
39 Correct 359 ms 68472 KB Output is correct