Submission #743422

# Submission time Handle Problem Language Result Execution time Memory
743422 2023-05-17T11:33:05 Z mickey080929 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
702 ms 88608 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

char a[3010][3010];
int c[3010][3010];
int r[3010][3010];

int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    for (int i=1; i<=n; i++) {
        for (int j=1; j<=m; j++) {
            scanf(" %c", &a[i][j]);
        }
    }
    for (int i=1; i<=n; i++) {
        for (int j=m; j>=1; j--) {
            c[i][j] = c[i][j+1] + (a[i][j] == 'O');
        }
    }
    for (int j=1; j<=m; j++) {
        for (int i=n; i>=1; i--) {
            r[i][j] = r[i+1][j] + (a[i][j] == 'I');
        }
    }
    ll ans = 0;
    for (int i=1; i<=n; i++) {
        for (int j=1; j<=m; j++) {
            if (a[i][j] != 'J') continue;
            ans += (ll)c[i][j] * r[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 %d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:15:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |             scanf(" %c", &a[i][j]);
      |             ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 1 ms 1392 KB Output is correct
7 Correct 2 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 2 ms 1492 KB Output is correct
10 Correct 2 ms 1364 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 2 ms 1364 KB Output is correct
13 Correct 2 ms 1364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 1 ms 1392 KB Output is correct
7 Correct 2 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 2 ms 1492 KB Output is correct
10 Correct 2 ms 1364 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 2 ms 1364 KB Output is correct
13 Correct 2 ms 1364 KB Output is correct
14 Correct 13 ms 7496 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 9 ms 4280 KB Output is correct
17 Correct 1 ms 440 KB Output is correct
18 Correct 17 ms 7896 KB Output is correct
19 Correct 16 ms 7908 KB Output is correct
20 Correct 16 ms 7848 KB Output is correct
21 Correct 17 ms 7884 KB Output is correct
22 Correct 15 ms 7892 KB Output is correct
23 Correct 16 ms 7836 KB Output is correct
24 Correct 18 ms 8020 KB Output is correct
25 Correct 16 ms 7792 KB Output is correct
26 Correct 16 ms 7880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 1 ms 1392 KB Output is correct
7 Correct 2 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 2 ms 1492 KB Output is correct
10 Correct 2 ms 1364 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 2 ms 1364 KB Output is correct
13 Correct 2 ms 1364 KB Output is correct
14 Correct 13 ms 7496 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 9 ms 4280 KB Output is correct
17 Correct 1 ms 440 KB Output is correct
18 Correct 17 ms 7896 KB Output is correct
19 Correct 16 ms 7908 KB Output is correct
20 Correct 16 ms 7848 KB Output is correct
21 Correct 17 ms 7884 KB Output is correct
22 Correct 15 ms 7892 KB Output is correct
23 Correct 16 ms 7836 KB Output is correct
24 Correct 18 ms 8020 KB Output is correct
25 Correct 16 ms 7792 KB Output is correct
26 Correct 16 ms 7880 KB Output is correct
27 Correct 569 ms 88164 KB Output is correct
28 Correct 15 ms 25940 KB Output is correct
29 Correct 37 ms 7756 KB Output is correct
30 Correct 2 ms 596 KB Output is correct
31 Correct 395 ms 72584 KB Output is correct
32 Correct 563 ms 88576 KB Output is correct
33 Correct 555 ms 88316 KB Output is correct
34 Correct 471 ms 84328 KB Output is correct
35 Correct 573 ms 88524 KB Output is correct
36 Correct 702 ms 88216 KB Output is correct
37 Correct 639 ms 88608 KB Output is correct
38 Correct 388 ms 72840 KB Output is correct
39 Correct 390 ms 72400 KB Output is correct