Submission #1105154

# Submission time Handle Problem Language Result Execution time Memory
1105154 2024-10-25T15:15:29 Z salmon Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
382 ms 93528 KB
#include <bits/stdc++.h>
using namespace std;

int H,W;
char lst[3100][3100];
int I[3100][3100];
int O[3100][3100];
long long int ans = 0;

int main(){

    scanf(" %d",&H);
    scanf(" %d",&W);

    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            scanf(" %c",&lst[i][j]);
        }
    }

    for(int i = 0; i < H; i++){
        O[i][W - 1] = 0;
        if(lst[i][W - 1] == 'O'){
            O[i][W - 1]++;
        }

        for(int j = W - 2; j >= 0; j--){
            O[i][j] = O[i][j + 1];
            if(lst[i][j] == 'O') O[i][j]++;
        }
    }

    for(int j = 0; j < W; j++){
        I[H - 1][j] = 0;
        if(lst[H - 1][j] == 'I'){
            I[H - 1][j]++;
        }

        for(int i = H - 2; i >= 0; i--){
            I[i][j] = I[i + 1][j];
            if(lst[i][j] == 'I') I[i][j]++;
        }
    }

    for(int i = 0; i < H; i++){
        for(int j  = 0; j < W; j++){
            if(lst[i][j] == 'J') ans += I[i][j] * O[i][j];
        }
    }

    printf("%lld",ans);

}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf(" %d",&H);
      |     ~~~~~^~~~~~~~~~
joi2019_ho_t1.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf(" %d",&W);
      |     ~~~~~^~~~~~~~~~
joi2019_ho_t1.cpp:17:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |             scanf(" %c",&lst[i][j]);
      |             ~~~~~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4432 KB Output is correct
2 Correct 1 ms 4432 KB Output is correct
3 Correct 1 ms 4432 KB Output is correct
4 Correct 2 ms 4432 KB Output is correct
5 Correct 2 ms 6480 KB Output is correct
6 Correct 3 ms 6480 KB Output is correct
7 Correct 2 ms 6480 KB Output is correct
8 Correct 2 ms 6480 KB Output is correct
9 Correct 2 ms 6736 KB Output is correct
10 Correct 2 ms 6480 KB Output is correct
11 Correct 2 ms 6480 KB Output is correct
12 Correct 2 ms 6480 KB Output is correct
13 Correct 2 ms 6480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4432 KB Output is correct
2 Correct 1 ms 4432 KB Output is correct
3 Correct 1 ms 4432 KB Output is correct
4 Correct 2 ms 4432 KB Output is correct
5 Correct 2 ms 6480 KB Output is correct
6 Correct 3 ms 6480 KB Output is correct
7 Correct 2 ms 6480 KB Output is correct
8 Correct 2 ms 6480 KB Output is correct
9 Correct 2 ms 6736 KB Output is correct
10 Correct 2 ms 6480 KB Output is correct
11 Correct 2 ms 6480 KB Output is correct
12 Correct 2 ms 6480 KB Output is correct
13 Correct 2 ms 6480 KB Output is correct
14 Correct 10 ms 19024 KB Output is correct
15 Correct 3 ms 16720 KB Output is correct
16 Correct 7 ms 10832 KB Output is correct
17 Correct 1 ms 4432 KB Output is correct
18 Correct 13 ms 19024 KB Output is correct
19 Correct 11 ms 19116 KB Output is correct
20 Correct 11 ms 19184 KB Output is correct
21 Correct 15 ms 19132 KB Output is correct
22 Correct 11 ms 19024 KB Output is correct
23 Correct 11 ms 19024 KB Output is correct
24 Correct 12 ms 19132 KB Output is correct
25 Correct 11 ms 19192 KB Output is correct
26 Correct 10 ms 19024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4432 KB Output is correct
2 Correct 1 ms 4432 KB Output is correct
3 Correct 1 ms 4432 KB Output is correct
4 Correct 2 ms 4432 KB Output is correct
5 Correct 2 ms 6480 KB Output is correct
6 Correct 3 ms 6480 KB Output is correct
7 Correct 2 ms 6480 KB Output is correct
8 Correct 2 ms 6480 KB Output is correct
9 Correct 2 ms 6736 KB Output is correct
10 Correct 2 ms 6480 KB Output is correct
11 Correct 2 ms 6480 KB Output is correct
12 Correct 2 ms 6480 KB Output is correct
13 Correct 2 ms 6480 KB Output is correct
14 Correct 10 ms 19024 KB Output is correct
15 Correct 3 ms 16720 KB Output is correct
16 Correct 7 ms 10832 KB Output is correct
17 Correct 1 ms 4432 KB Output is correct
18 Correct 13 ms 19024 KB Output is correct
19 Correct 11 ms 19116 KB Output is correct
20 Correct 11 ms 19184 KB Output is correct
21 Correct 15 ms 19132 KB Output is correct
22 Correct 11 ms 19024 KB Output is correct
23 Correct 11 ms 19024 KB Output is correct
24 Correct 12 ms 19132 KB Output is correct
25 Correct 11 ms 19192 KB Output is correct
26 Correct 10 ms 19024 KB Output is correct
27 Correct 341 ms 93004 KB Output is correct
28 Correct 8 ms 68176 KB Output is correct
29 Correct 23 ms 11312 KB Output is correct
30 Correct 2 ms 4688 KB Output is correct
31 Correct 251 ms 80456 KB Output is correct
32 Correct 372 ms 93512 KB Output is correct
33 Correct 341 ms 93528 KB Output is correct
34 Correct 292 ms 91724 KB Output is correct
35 Correct 312 ms 93480 KB Output is correct
36 Correct 319 ms 93512 KB Output is correct
37 Correct 382 ms 93512 KB Output is correct
38 Correct 244 ms 80456 KB Output is correct
39 Correct 227 ms 78408 KB Output is correct