답안 #717835

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
717835 2023-04-02T15:57:10 Z blackslex Bitaro the Brave (JOI19_ho_t1) C++17
50 / 100
186 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];

int main() {
    scanf("%lld %lld", &n, &m);
    for (int i = 1; i <= n; i++) scanf("%s", c[i] + 1);
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (c[i][j] == '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] == '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] == '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:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%lld %lld", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:12:39: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     for (int i = 1; i <= n; i++) scanf("%s", c[i] + 1);
      |                                  ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1748 KB Output is correct
6 Correct 1 ms 1620 KB Output is correct
7 Correct 1 ms 1492 KB Output is correct
8 Correct 1 ms 1620 KB Output is correct
9 Correct 1 ms 1620 KB Output is correct
10 Correct 1 ms 1492 KB Output is correct
11 Correct 1 ms 1748 KB Output is correct
12 Correct 1 ms 1668 KB Output is correct
13 Correct 1 ms 1492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1748 KB Output is correct
6 Correct 1 ms 1620 KB Output is correct
7 Correct 1 ms 1492 KB Output is correct
8 Correct 1 ms 1620 KB Output is correct
9 Correct 1 ms 1620 KB Output is correct
10 Correct 1 ms 1492 KB Output is correct
11 Correct 1 ms 1748 KB Output is correct
12 Correct 1 ms 1668 KB Output is correct
13 Correct 1 ms 1492 KB Output is correct
14 Correct 9 ms 11760 KB Output is correct
15 Correct 3 ms 5076 KB Output is correct
16 Correct 5 ms 7124 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 10 ms 13652 KB Output is correct
19 Correct 8 ms 13268 KB Output is correct
20 Correct 8 ms 13396 KB Output is correct
21 Correct 12 ms 13568 KB Output is correct
22 Correct 8 ms 13268 KB Output is correct
23 Correct 8 ms 13396 KB Output is correct
24 Correct 11 ms 13652 KB Output is correct
25 Correct 8 ms 13268 KB Output is correct
26 Correct 10 ms 13352 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1748 KB Output is correct
6 Correct 1 ms 1620 KB Output is correct
7 Correct 1 ms 1492 KB Output is correct
8 Correct 1 ms 1620 KB Output is correct
9 Correct 1 ms 1620 KB Output is correct
10 Correct 1 ms 1492 KB Output is correct
11 Correct 1 ms 1748 KB Output is correct
12 Correct 1 ms 1668 KB Output is correct
13 Correct 1 ms 1492 KB Output is correct
14 Correct 9 ms 11760 KB Output is correct
15 Correct 3 ms 5076 KB Output is correct
16 Correct 5 ms 7124 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 10 ms 13652 KB Output is correct
19 Correct 8 ms 13268 KB Output is correct
20 Correct 8 ms 13396 KB Output is correct
21 Correct 12 ms 13568 KB Output is correct
22 Correct 8 ms 13268 KB Output is correct
23 Correct 8 ms 13396 KB Output is correct
24 Correct 11 ms 13652 KB Output is correct
25 Correct 8 ms 13268 KB Output is correct
26 Correct 10 ms 13352 KB Output is correct
27 Runtime error 186 ms 274432 KB Execution killed with signal 9
28 Halted 0 ms 0 KB -