답안 #588303

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
588303 2022-07-03T05:34:35 Z n_m_p Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
224 ms 159628 KB
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define infi INT_MAX
#define rinfi INT_MIN
#define inf LLONG_MAX
#define rinf LLONG_MIN
#define ff first
#define ss second
#ifdef LOCAL
#include"debug.h"
#else
#define line
#define debug(x...)
#endif
using namespace std;
main()
{   
    fast
    int tc=1,i,j,k;
    //cin>>tc;
    while(tc--)
    {
      int a,b;
      cin>>a>>b;
      string s[a];
      for(i=0;i<a;i++)
        cin>>s[i];
     int r[a][b],c[a][b];
     for(i=0;i<a;i++)
     {
        for(j=0;j<b;j++)
        {
            r[i][j]=c[i][j]=0;
            if(s[i][j]=='I')
            {
                r[i][j]=1;
            }
            if(s[i][j]=='O')
            {
                c[i][j]=1;
            }
        }
     }
     for(i=0;i<a;i++)
     {
        for(j=b-2;j>=0;j--)
        {
           c[i][j]+=c[i][j+1];
        }
     }
      for(i=a-2;i>=0;i--)
     {
        for(j=0;j<b;j++)
        {
           r[i][j]+=r[i+1][j];
        }
     }
     int ans=0;
     for(i=0;i<a;i++)
     {
        for(j=0;j<b;j++)
        {
            if(s[i][j]=='J')
            {
                ans+=(r[i][j]*c[i][j]);
            }
        }
     }
     cout<<ans<<endl;

    }
}

Compilation message

joi2019_ho_t1.cpp:18:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   18 | main()
      | ^~~~
joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:21:18: warning: unused variable 'k' [-Wunused-variable]
   21 |     int tc=1,i,j,k;
      |                  ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 1 ms 448 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 452 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 1 ms 448 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 452 KB Output is correct
14 Correct 7 ms 3716 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 3 ms 2516 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 7 ms 4684 KB Output is correct
19 Correct 4 ms 4564 KB Output is correct
20 Correct 4 ms 4564 KB Output is correct
21 Correct 6 ms 4676 KB Output is correct
22 Correct 4 ms 4552 KB Output is correct
23 Correct 4 ms 4564 KB Output is correct
24 Correct 6 ms 4684 KB Output is correct
25 Correct 4 ms 4564 KB Output is correct
26 Correct 4 ms 4564 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 1 ms 448 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 452 KB Output is correct
14 Correct 7 ms 3716 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 3 ms 2516 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 7 ms 4684 KB Output is correct
19 Correct 4 ms 4564 KB Output is correct
20 Correct 4 ms 4564 KB Output is correct
21 Correct 6 ms 4676 KB Output is correct
22 Correct 4 ms 4552 KB Output is correct
23 Correct 4 ms 4564 KB Output is correct
24 Correct 6 ms 4684 KB Output is correct
25 Correct 4 ms 4564 KB Output is correct
26 Correct 4 ms 4564 KB Output is correct
27 Correct 197 ms 150880 KB Output is correct
28 Correct 2 ms 724 KB Output is correct
29 Correct 13 ms 11732 KB Output is correct
30 Correct 2 ms 724 KB Output is correct
31 Correct 146 ms 111036 KB Output is correct
32 Correct 139 ms 158388 KB Output is correct
33 Correct 135 ms 159016 KB Output is correct
34 Correct 173 ms 128680 KB Output is correct
35 Correct 140 ms 158500 KB Output is correct
36 Correct 135 ms 159240 KB Output is correct
37 Correct 224 ms 159628 KB Output is correct
38 Correct 101 ms 109984 KB Output is correct
39 Correct 110 ms 110524 KB Output is correct