답안 #713270

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
713270 2023-03-21T15:13:58 Z ln_e Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
315 ms 88512 KB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho
using ll=long long;
using ld=long double;
int const INF=1000000005;
ll const LINF=1000000000000000005;
ll const mod=1000000007;
ld const PI=3.14159265359;
ll const MAX_N=3e5+5;
ld const EPS=0.00000001;
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define sz(a) (int)a.size()
#define CODE_START  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll n,sum1[3005][3005],sum2[3005],m;
char a[3005][3005];
int32_t main(){
CODE_START;
#ifdef LOCAL
ifstream cin("input.txt");
#endif
cin>>n>>m;
for(ll i=1;i<=n;i++)
{
    for(ll j=1;j<=m;j++)
    {
        cin>>a[i][j];
    }
}
for(ll j=1;j<=m;j++)
{
ll sum=0;
for(ll i=n;i>=1;i--)
{
    if(a[i][j]=='I'){
        sum++;
    }else if(a[i][j]=='J'){
    sum1[i][j]=sum;
    }
}
}
ll ans=0;
for(ll i=1;i<=n;i++)
{
    ll sum=0;
    for(ll j=1;j<=m;j++)
    {
        //cout<<sum1[i][j]<<' ';
        if(a[i][j]=='J'){
            sum+=sum1[i][j];
        }else if(a[i][j]=='O'){
        ans+=sum;
        }
    }
    //cout<<endl;
}
cout<<ans<<endl;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 324 KB Output is correct
2 Correct 0 ms 324 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1108 KB Output is correct
6 Correct 2 ms 976 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 1108 KB Output is correct
9 Correct 1 ms 968 KB Output is correct
10 Correct 1 ms 980 KB Output is correct
11 Correct 1 ms 1108 KB Output is correct
12 Correct 1 ms 980 KB Output is correct
13 Correct 1 ms 972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 324 KB Output is correct
2 Correct 0 ms 324 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1108 KB Output is correct
6 Correct 2 ms 976 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 1108 KB Output is correct
9 Correct 1 ms 968 KB Output is correct
10 Correct 1 ms 980 KB Output is correct
11 Correct 1 ms 1108 KB Output is correct
12 Correct 1 ms 980 KB Output is correct
13 Correct 1 ms 972 KB Output is correct
14 Correct 7 ms 5460 KB Output is correct
15 Correct 2 ms 3156 KB Output is correct
16 Correct 3 ms 2772 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 9 ms 5908 KB Output is correct
19 Correct 6 ms 4952 KB Output is correct
20 Correct 6 ms 4564 KB Output is correct
21 Correct 8 ms 5972 KB Output is correct
22 Correct 7 ms 5320 KB Output is correct
23 Correct 5 ms 4564 KB Output is correct
24 Correct 9 ms 5944 KB Output is correct
25 Correct 6 ms 4948 KB Output is correct
26 Correct 6 ms 4560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 324 KB Output is correct
2 Correct 0 ms 324 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1108 KB Output is correct
6 Correct 2 ms 976 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 1108 KB Output is correct
9 Correct 1 ms 968 KB Output is correct
10 Correct 1 ms 980 KB Output is correct
11 Correct 1 ms 1108 KB Output is correct
12 Correct 1 ms 980 KB Output is correct
13 Correct 1 ms 972 KB Output is correct
14 Correct 7 ms 5460 KB Output is correct
15 Correct 2 ms 3156 KB Output is correct
16 Correct 3 ms 2772 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 9 ms 5908 KB Output is correct
19 Correct 6 ms 4952 KB Output is correct
20 Correct 6 ms 4564 KB Output is correct
21 Correct 8 ms 5972 KB Output is correct
22 Correct 7 ms 5320 KB Output is correct
23 Correct 5 ms 4564 KB Output is correct
24 Correct 9 ms 5944 KB Output is correct
25 Correct 6 ms 4948 KB Output is correct
26 Correct 6 ms 4560 KB Output is correct
27 Correct 273 ms 87996 KB Output is correct
28 Correct 8 ms 15956 KB Output is correct
29 Correct 13 ms 4692 KB Output is correct
30 Correct 1 ms 596 KB Output is correct
31 Correct 205 ms 72484 KB Output is correct
32 Correct 196 ms 66096 KB Output is correct
33 Correct 204 ms 53276 KB Output is correct
34 Correct 246 ms 84048 KB Output is correct
35 Correct 225 ms 72048 KB Output is correct
36 Correct 205 ms 53276 KB Output is correct
37 Correct 315 ms 88512 KB Output is correct
38 Correct 156 ms 50100 KB Output is correct
39 Correct 149 ms 39908 KB Output is correct