Submission #717840

# Submission time Handle Problem Language Result Execution time Memory
717840 2023-04-02T16:02:16 Z blackslex Bitaro the Brave (JOI19_ho_t1) C++17
50 / 100
333 ms 274432 KB
#include<bits/stdc++.h>

using namespace std;
using ll = long long;

const int N = 3005;
ll n, m, a[N][N][2], b[N][N][2], ans;
// char c[N][N];
string c[N];

int main() {
    scanf("%lld %lld", &n, &m);
    for (int i = 1; i <= n; i++) cin >> c[i];
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (c[i][j - 1] == 'O') a[i][j][0] = a[i - 1][j][0] + 1, b[i][j][0] = b[i][j - 1][0] + 1;
            else a[i][j][0] = a[i - 1][j][0], b[i][j][0] = b[i][j - 1][0];
            if (c[i][j - 1] == 'I') a[i][j][1] = a[i - 1][j][1] + 1, b[i][j][1] = b[i][j - 1][1] + 1;
            else a[i][j][1] = a[i - 1][j][1], b[i][j][1] = b[i][j - 1][1];
        }
    }
    for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) if (c[i][j - 1] == 'J') ans += (a[n][j][1] - a[i][j][1]) * (b[i][m][0] - b[i][j][0]);
    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("%lld %lld", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 ms 468 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1428 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 ms 468 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1428 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 11 ms 10708 KB Output is correct
15 Correct 2 ms 3924 KB Output is correct
16 Correct 8 ms 6760 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 17 ms 12748 KB Output is correct
19 Correct 14 ms 12116 KB Output is correct
20 Correct 13 ms 12620 KB Output is correct
21 Correct 15 ms 12756 KB Output is correct
22 Correct 12 ms 12236 KB Output is correct
23 Correct 13 ms 12500 KB Output is correct
24 Correct 14 ms 12672 KB Output is correct
25 Correct 12 ms 12168 KB Output is correct
26 Correct 12 ms 12508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 ms 468 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1428 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 11 ms 10708 KB Output is correct
15 Correct 2 ms 3924 KB Output is correct
16 Correct 8 ms 6760 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 17 ms 12748 KB Output is correct
19 Correct 14 ms 12116 KB Output is correct
20 Correct 13 ms 12620 KB Output is correct
21 Correct 15 ms 12756 KB Output is correct
22 Correct 12 ms 12236 KB Output is correct
23 Correct 13 ms 12500 KB Output is correct
24 Correct 14 ms 12672 KB Output is correct
25 Correct 12 ms 12168 KB Output is correct
26 Correct 12 ms 12508 KB Output is correct
27 Runtime error 333 ms 274432 KB Execution killed with signal 9
28 Halted 0 ms 0 KB -