답안 #98771

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
98771 2019-02-25T20:07:10 Z bogdan10bos Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
83 ms 18040 KB
#include <bits/stdc++.h>

using namespace std;

//#define FILE_IO

int N, M;
int dwn[3005], rgt[3005];
char a[3005][3005];

int main()
{
    #ifdef FILE_IO
    freopen("1.in", "r", stdin);
    //freopen("1.out", "w", stdout);
    #endif

    scanf("%d%d\n", &N, &M);
    for(int i = 1; i <= N; i++)
        scanf("%s\n", a[i] + 1);

    long long ans = 0;
    for(int i = N; i >= 1; i--)
        for(int j = M; j >= 1; j--)
        {
            rgt[j] = rgt[j + 1] + (a[i][j] == 'O');
            dwn[j] += (a[i][j] == 'I');
            if(a[i][j] == 'J')
                ans += 1LL * rgt[j] * dwn[j];
        }

    cout << ans;

    return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d\n", &N, &M);
     ~~~~~^~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s\n", a[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 640 KB Output is correct
6 Correct 3 ms 640 KB Output is correct
7 Correct 2 ms 640 KB Output is correct
8 Correct 2 ms 640 KB Output is correct
9 Correct 2 ms 640 KB Output is correct
10 Correct 2 ms 640 KB Output is correct
11 Correct 3 ms 640 KB Output is correct
12 Correct 2 ms 640 KB Output is correct
13 Correct 2 ms 640 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 640 KB Output is correct
6 Correct 3 ms 640 KB Output is correct
7 Correct 2 ms 640 KB Output is correct
8 Correct 2 ms 640 KB Output is correct
9 Correct 2 ms 640 KB Output is correct
10 Correct 2 ms 640 KB Output is correct
11 Correct 3 ms 640 KB Output is correct
12 Correct 2 ms 640 KB Output is correct
13 Correct 2 ms 640 KB Output is correct
14 Correct 5 ms 1920 KB Output is correct
15 Correct 3 ms 1536 KB Output is correct
16 Correct 4 ms 1152 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 6 ms 2048 KB Output is correct
19 Correct 4 ms 2048 KB Output is correct
20 Correct 5 ms 2048 KB Output is correct
21 Correct 6 ms 2048 KB Output is correct
22 Correct 4 ms 2048 KB Output is correct
23 Correct 5 ms 2048 KB Output is correct
24 Correct 5 ms 2048 KB Output is correct
25 Correct 4 ms 2048 KB Output is correct
26 Correct 4 ms 2048 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 640 KB Output is correct
6 Correct 3 ms 640 KB Output is correct
7 Correct 2 ms 640 KB Output is correct
8 Correct 2 ms 640 KB Output is correct
9 Correct 2 ms 640 KB Output is correct
10 Correct 2 ms 640 KB Output is correct
11 Correct 3 ms 640 KB Output is correct
12 Correct 2 ms 640 KB Output is correct
13 Correct 2 ms 640 KB Output is correct
14 Correct 5 ms 1920 KB Output is correct
15 Correct 3 ms 1536 KB Output is correct
16 Correct 4 ms 1152 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 6 ms 2048 KB Output is correct
19 Correct 4 ms 2048 KB Output is correct
20 Correct 5 ms 2048 KB Output is correct
21 Correct 6 ms 2048 KB Output is correct
22 Correct 4 ms 2048 KB Output is correct
23 Correct 5 ms 2048 KB Output is correct
24 Correct 5 ms 2048 KB Output is correct
25 Correct 4 ms 2048 KB Output is correct
26 Correct 4 ms 2048 KB Output is correct
27 Correct 76 ms 17556 KB Output is correct
28 Correct 7 ms 7168 KB Output is correct
29 Correct 7 ms 1784 KB Output is correct
30 Correct 2 ms 408 KB Output is correct
31 Correct 56 ms 13816 KB Output is correct
32 Correct 59 ms 17940 KB Output is correct
33 Correct 65 ms 17912 KB Output is correct
34 Correct 62 ms 15992 KB Output is correct
35 Correct 58 ms 18040 KB Output is correct
36 Correct 75 ms 18000 KB Output is correct
37 Correct 83 ms 18040 KB Output is correct
38 Correct 42 ms 13816 KB Output is correct
39 Correct 41 ms 13788 KB Output is correct