답안 #529338

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
529338 2022-02-22T19:41:00 Z smth Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
315 ms 180036 KB
#include<iostream>
#define endl '\n'
using namespace std;
char s[5005][5005];
long long row[5005][5005], col[5005][5005];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin.tie(0);

    long long n,h,w,i,j;

    cin>>h>>w;

    for(i=0;i<h;i++)
    {
        for(j=0;j<w;j++)
        {
            cin>>s[i][j];
            if(s[i][j]=='O')row[i][j]=1;
            if(s[i][j]=='I')col[i][j]=1;
        }
    }
    for(i=h-1;i>=0;i--)
    {
        for(j=w-1;j>=0;j--)
        {
            col[i][j]+=col[i+1][j];
            row[i][j]+=row[i][j+1];
        }
    }
    long long ans=0;

    for(i=h-1;i>=0;i--)
    {
        for(j=w-1;j>=0;j--)
        {
           if(s[i][j]=='J')ans+=col[i][j]*row[i][j];
        }
    }
    cout<<ans<<endl;




}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:12:15: warning: unused variable 'n' [-Wunused-variable]
   12 |     long long n,h,w,i,j;
      |               ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 1612 KB Output is correct
6 Correct 1 ms 1612 KB Output is correct
7 Correct 1 ms 1484 KB Output is correct
8 Correct 1 ms 1612 KB Output is correct
9 Correct 1 ms 1612 KB Output is correct
10 Correct 1 ms 1484 KB Output is correct
11 Correct 1 ms 1612 KB Output is correct
12 Correct 1 ms 1612 KB Output is correct
13 Correct 1 ms 1484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 1612 KB Output is correct
6 Correct 1 ms 1612 KB Output is correct
7 Correct 1 ms 1484 KB Output is correct
8 Correct 1 ms 1612 KB Output is correct
9 Correct 1 ms 1612 KB Output is correct
10 Correct 1 ms 1484 KB Output is correct
11 Correct 1 ms 1612 KB Output is correct
12 Correct 1 ms 1612 KB Output is correct
13 Correct 1 ms 1484 KB Output is correct
14 Correct 10 ms 9548 KB Output is correct
15 Correct 3 ms 5412 KB Output is correct
16 Correct 5 ms 5608 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 13 ms 10444 KB Output is correct
19 Correct 10 ms 10388 KB Output is correct
20 Correct 8 ms 10316 KB Output is correct
21 Correct 11 ms 10712 KB Output is correct
22 Correct 10 ms 10572 KB Output is correct
23 Correct 8 ms 10520 KB Output is correct
24 Correct 11 ms 10700 KB Output is correct
25 Correct 9 ms 10532 KB Output is correct
26 Correct 9 ms 10468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 1612 KB Output is correct
6 Correct 1 ms 1612 KB Output is correct
7 Correct 1 ms 1484 KB Output is correct
8 Correct 1 ms 1612 KB Output is correct
9 Correct 1 ms 1612 KB Output is correct
10 Correct 1 ms 1484 KB Output is correct
11 Correct 1 ms 1612 KB Output is correct
12 Correct 1 ms 1612 KB Output is correct
13 Correct 1 ms 1484 KB Output is correct
14 Correct 10 ms 9548 KB Output is correct
15 Correct 3 ms 5412 KB Output is correct
16 Correct 5 ms 5608 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 13 ms 10444 KB Output is correct
19 Correct 10 ms 10388 KB Output is correct
20 Correct 8 ms 10316 KB Output is correct
21 Correct 11 ms 10712 KB Output is correct
22 Correct 10 ms 10572 KB Output is correct
23 Correct 8 ms 10520 KB Output is correct
24 Correct 11 ms 10700 KB Output is correct
25 Correct 9 ms 10532 KB Output is correct
26 Correct 9 ms 10468 KB Output is correct
27 Correct 315 ms 172492 KB Output is correct
28 Correct 14 ms 28880 KB Output is correct
29 Correct 17 ms 14020 KB Output is correct
30 Correct 1 ms 716 KB Output is correct
31 Correct 234 ms 130772 KB Output is correct
32 Correct 276 ms 179336 KB Output is correct
33 Correct 216 ms 179552 KB Output is correct
34 Correct 259 ms 151552 KB Output is correct
35 Correct 252 ms 179244 KB Output is correct
36 Correct 209 ms 179616 KB Output is correct
37 Correct 310 ms 180036 KB Output is correct
38 Correct 195 ms 129740 KB Output is correct
39 Correct 150 ms 129960 KB Output is correct