제출 #1179599

#제출 시각아이디문제언어결과실행 시간메모리
1179599user736482Bitaro the Brave (JOI19_ho_t1)C++20
100 / 100
136 ms150444 KiB
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pb push_back #define ff first #define ss second #define MOD 1000000009 #define INF 1000000019 #define INFL 1000000000000000099LL ll n,q,s,t,a,b,c,ans,k,m; ll dp[3007][3007][2]; char co[3007][3007]; int main() { ios_base::sync_with_stdio(0);cin.tie(0); cin>>n>>m; for(ll i=0;i<n;i++){ for(ll j=0;j<m;j++){ cin>>co[i][j]; } } for(ll i=n-1;i>=0;i--){ for(ll j=m-1;j>=0;j--){ dp[i][j][0]=dp[i+1][j][0]; dp[i][j][1]=dp[i][j+1][1]; if(co[i][j]=='O') dp[i][j][1]++; else if(co[i][j]=='I') dp[i][j][0]++; else ans+=dp[i][j][0]*dp[i][j][1]; } } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...