답안 #97383

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
97383 2019-02-15T16:50:53 Z kdh9949 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
426 ms 79896 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

const int N = 3005;

int h, w, p[N][N], q[N][N];
char b[N][N];
ll r;

int main(){
    scanf("%d%d", &h, &w);
    for(int i = 1; i <= h; i++) scanf("%s", b[i] + 1);
    for(int i = h; i; i--) for(int j = w; j; j--)
        p[i][j] = p[i][j + 1] + (b[i][j] == 'O');
    for(int i = w; i; i--) for(int j = h; j; j--)
        q[j][i] = q[j + 1][i] + (b[j][i] == 'I');
    for(int i = 1; i <= h; i++) for(int j = 1; j <= w; j++)
        if(b[i][j] == 'J') r += p[i][j] * q[i][j];
    printf("%lld\n", r);
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &h, &w);
     ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:14:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1; i <= h; i++) scanf("%s", b[i] + 1);
                                 ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 4 ms 1536 KB Output is correct
6 Correct 4 ms 1584 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 5 ms 1476 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 5 ms 1536 KB Output is correct
13 Correct 4 ms 1408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 4 ms 1536 KB Output is correct
6 Correct 4 ms 1584 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 5 ms 1476 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 5 ms 1536 KB Output is correct
13 Correct 4 ms 1408 KB Output is correct
14 Correct 12 ms 7296 KB Output is correct
15 Correct 8 ms 4992 KB Output is correct
16 Correct 8 ms 4224 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 15 ms 7808 KB Output is correct
19 Correct 14 ms 7680 KB Output is correct
20 Correct 13 ms 7680 KB Output is correct
21 Correct 10 ms 7808 KB Output is correct
22 Correct 1 ms 7680 KB Output is correct
23 Correct 13 ms 7680 KB Output is correct
24 Correct 13 ms 7808 KB Output is correct
25 Correct 11 ms 7680 KB Output is correct
26 Correct 12 ms 7552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 4 ms 1536 KB Output is correct
6 Correct 4 ms 1584 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 5 ms 1476 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 5 ms 1536 KB Output is correct
13 Correct 4 ms 1408 KB Output is correct
14 Correct 12 ms 7296 KB Output is correct
15 Correct 8 ms 4992 KB Output is correct
16 Correct 8 ms 4224 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 15 ms 7808 KB Output is correct
19 Correct 14 ms 7680 KB Output is correct
20 Correct 13 ms 7680 KB Output is correct
21 Correct 10 ms 7808 KB Output is correct
22 Correct 1 ms 7680 KB Output is correct
23 Correct 13 ms 7680 KB Output is correct
24 Correct 13 ms 7808 KB Output is correct
25 Correct 11 ms 7680 KB Output is correct
26 Correct 12 ms 7552 KB Output is correct
27 Correct 363 ms 79896 KB Output is correct
28 Correct 25 ms 26104 KB Output is correct
29 Correct 16 ms 7168 KB Output is correct
30 Correct 2 ms 640 KB Output is correct
31 Correct 304 ms 66424 KB Output is correct
32 Correct 368 ms 79820 KB Output is correct
33 Correct 344 ms 79480 KB Output is correct
34 Correct 332 ms 77140 KB Output is correct
35 Correct 426 ms 79736 KB Output is correct
36 Correct 350 ms 79708 KB Output is correct
37 Correct 397 ms 79736 KB Output is correct
38 Correct 261 ms 66552 KB Output is correct
39 Correct 257 ms 66168 KB Output is correct