답안 #484179

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
484179 2021-11-02T09:45:51 Z ToroTN Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
182 ms 150244 KB
#include<bits/stdc++.h>
using namespace std;
int n,m,c[3005][3005][2],r[3005][3005][2];
long long cnt=0;
char s[3005][3005];
int main()
{
    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=1;j<=m;j++)
        {
            if(s[i][j]=='O')
            {
                c[i][j][0]=c[i-1][j][0]+1;
                r[i][j][0]=r[i][j-1][0]+1;
            }else
            {
                c[i][j][0]=c[i-1][j][0];
                r[i][j][0]=r[i][j-1][0];
            }
            if(s[i][j]=='I')
            {
                c[i][j][1]=c[i-1][j][1]+1;
                r[i][j][1]=r[i][j-1][1]+1;
            }else
            {
                c[i][j][1]=c[i-1][j][1];
                r[i][j][1]=r[i][j-1][1];
            }
        }
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(s[i][j]=='J')
            {
                //cnt+=(c[n][j][0]-c[i][j][0])*(r[i][m][1]-r[i][j][1]);
                cnt+=(c[n][j][1]-c[i][j][1])*(r[i][m][0]-r[i][j][0]);
            }
        }
    }
    printf("%lld\n",cnt);
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     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]
   11 |         scanf("%s",s[i]+1);
      |         ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 1484 KB Output is correct
6 Correct 1 ms 1484 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1484 KB Output is correct
9 Correct 1 ms 1440 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1484 KB Output is correct
12 Correct 1 ms 1500 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 1484 KB Output is correct
6 Correct 1 ms 1484 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1484 KB Output is correct
9 Correct 1 ms 1440 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1484 KB Output is correct
12 Correct 1 ms 1500 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 6 ms 8780 KB Output is correct
15 Correct 3 ms 4940 KB Output is correct
16 Correct 3 ms 5196 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 7 ms 9676 KB Output is correct
19 Correct 6 ms 9456 KB Output is correct
20 Correct 7 ms 9420 KB Output is correct
21 Correct 8 ms 9712 KB Output is correct
22 Correct 6 ms 9548 KB Output is correct
23 Correct 6 ms 9420 KB Output is correct
24 Correct 8 ms 9676 KB Output is correct
25 Correct 6 ms 9548 KB Output is correct
26 Correct 6 ms 9500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 1484 KB Output is correct
6 Correct 1 ms 1484 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1484 KB Output is correct
9 Correct 1 ms 1440 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1484 KB Output is correct
12 Correct 1 ms 1500 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 6 ms 8780 KB Output is correct
15 Correct 3 ms 4940 KB Output is correct
16 Correct 3 ms 5196 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 7 ms 9676 KB Output is correct
19 Correct 6 ms 9456 KB Output is correct
20 Correct 7 ms 9420 KB Output is correct
21 Correct 8 ms 9712 KB Output is correct
22 Correct 6 ms 9548 KB Output is correct
23 Correct 6 ms 9420 KB Output is correct
24 Correct 8 ms 9676 KB Output is correct
25 Correct 6 ms 9548 KB Output is correct
26 Correct 6 ms 9500 KB Output is correct
27 Correct 169 ms 150176 KB Output is correct
28 Correct 12 ms 26332 KB Output is correct
29 Correct 10 ms 13260 KB Output is correct
30 Correct 1 ms 716 KB Output is correct
31 Correct 131 ms 125236 KB Output is correct
32 Correct 116 ms 150244 KB Output is correct
33 Correct 111 ms 149700 KB Output is correct
34 Correct 152 ms 145184 KB Output is correct
35 Correct 118 ms 150212 KB Output is correct
36 Correct 111 ms 149680 KB Output is correct
37 Correct 182 ms 150232 KB Output is correct
38 Correct 88 ms 124644 KB Output is correct
39 Correct 88 ms 124740 KB Output is correct