답안 #97296

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
97296 2019-02-15T00:20:35 Z RezwanArefin01 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
357 ms 79996 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 3010;
int n, m, r[N][N], c[N][N]; 
char s[N][N]; 

int main(int argc, char const *argv[]) {
    scanf("%d %d", &n, &m);
    for(int i = 1; i <= n; i++) 
        scanf(" %s", s[i] + 1); 
    
    for(int i = 1; i <= n; i++) 
        for(int j = m; j >= 1; j--)
            r[i][j] = r[i][j + 1] + (s[i][j] == 'O');

    for(int j = 1; j <= m; j++) 
        for(int i = n; i >= 1; i--) 
            c[i][j] = c[i + 1][j] + (s[i][j] == 'I'); 

    long long ans = 0;
    for(int i = 1; i <= n; i++) 
        for(int j = 1; j <= m; j++) 
            ans += (s[i][j] == 'J') * r[i][j] * c[i][j]; 

    printf("%lld\n", ans);
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main(int, const char**)':
joi2019_ho_t1.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf(" %s", s[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 3 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 3 ms 1536 KB Output is correct
9 Correct 3 ms 1536 KB Output is correct
10 Correct 3 ms 1408 KB Output is correct
11 Correct 3 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 3 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 3 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 3 ms 1536 KB Output is correct
9 Correct 3 ms 1536 KB Output is correct
10 Correct 3 ms 1408 KB Output is correct
11 Correct 3 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
14 Correct 10 ms 7296 KB Output is correct
15 Correct 6 ms 4992 KB Output is correct
16 Correct 8 ms 4352 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 15 ms 7808 KB Output is correct
19 Correct 11 ms 7680 KB Output is correct
20 Correct 11 ms 7552 KB Output is correct
21 Correct 13 ms 7808 KB Output is correct
22 Correct 12 ms 7680 KB Output is correct
23 Correct 8 ms 7552 KB Output is correct
24 Correct 13 ms 7808 KB Output is correct
25 Correct 11 ms 7680 KB Output is correct
26 Correct 11 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 3 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 3 ms 1536 KB Output is correct
9 Correct 3 ms 1536 KB Output is correct
10 Correct 3 ms 1408 KB Output is correct
11 Correct 3 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
14 Correct 10 ms 7296 KB Output is correct
15 Correct 6 ms 4992 KB Output is correct
16 Correct 8 ms 4352 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 15 ms 7808 KB Output is correct
19 Correct 11 ms 7680 KB Output is correct
20 Correct 11 ms 7552 KB Output is correct
21 Correct 13 ms 7808 KB Output is correct
22 Correct 12 ms 7680 KB Output is correct
23 Correct 8 ms 7552 KB Output is correct
24 Correct 13 ms 7808 KB Output is correct
25 Correct 11 ms 7680 KB Output is correct
26 Correct 11 ms 7552 KB Output is correct
27 Correct 309 ms 79848 KB Output is correct
28 Correct 28 ms 26112 KB Output is correct
29 Correct 18 ms 7168 KB Output is correct
30 Correct 3 ms 640 KB Output is correct
31 Correct 253 ms 66544 KB Output is correct
32 Correct 327 ms 79996 KB Output is correct
33 Correct 316 ms 79700 KB Output is correct
34 Correct 273 ms 77252 KB Output is correct
35 Correct 357 ms 79880 KB Output is correct
36 Correct 339 ms 79736 KB Output is correct
37 Correct 334 ms 79972 KB Output is correct
38 Correct 234 ms 66684 KB Output is correct
39 Correct 246 ms 66436 KB Output is correct