Submission #944804

#TimeUsernameProblemLanguageResultExecution timeMemory
944804ezzzayBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
447 ms159092 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define ff first #define ss second #define pb push_back const int N=3e3+2; char a[N][N]; int psi[N][N]; int pso[N][N]; signed main(){ int n,m; cin>>n>>m; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cin>>a[i][j]; } } for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ pso[i][j]=pso[i][j-1]; if(a[i][j]=='O')pso[i][j]++; } } for(int j=1;j<=m;j++){ for(int i=1;i<=n;i++){ psi[i][j]=psi[i-1][j]; if(a[i][j]=='I')psi[i][j]++; } } int ans=0; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(a[i][j]=='J'){ ans+= (pso[i][m]-pso[i][j])*(psi[n][j]-psi[i][j]); } } } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...