제출 #391392

#제출 시각아이디문제언어결과실행 시간메모리
391392lukameladzeBitaro the Brave (JOI19_ho_t1)C++14
50 / 100
558 ms39788 KiB
# include <bits/stdc++.h> #define f first #define s second #define pb push_back using namespace std; const int N=1005; long long n,m,ans,sf1[N][N],sf[N][N]; char ch[N][N]; int main() { cin>>n>>m; for(int i=1; i<=n; i++) { for (int j=1; j<=m; j++) { cin>>ch[i][j]; } } for (int i=1; i<=n; i++) { for (int j=m; j>=1; j--) { sf[i][j]=sf[i][j+1]+(ch[i][j]=='O'); } } for (int j=1; j<=m; j++) { for (int i=n; i>=1; i--) { sf1[i][j]=sf1[i+1][j]+(ch[i][j]=='I'); } } for (int i=1; i<=n; i++) { for (int j=1; j<=m; j++) { if (ch[i][j]!='J') continue; ans+=sf[i][j+1]*sf1[i+1][j]; } } cout<<ans<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...