Submission #879215

#TimeUsernameProblemLanguageResultExecution timeMemory
879215mahmoudbadawyBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
166 ms55888 KiB
#include <bits/stdc++.h> using namespace std; const int N=3005; int n,m; string gr[N]; int co[N][N]; int main() { cin >> n >> m; for(int i=0;i<n;i++) cin >> gr[i]; for(int i=n-1;i>=0;i--) { for(int j=0;j<m;j++) { co[i][j]=(gr[i][j]=='I')+co[i+1][j]; } } long long ans=0; for(int i=0;i<n;i++) { int cur=0; for(int j=m-1;j>=0;j--) { cur+=gr[i][j]=='O'; if(gr[i][j]=='J') { ans+=1LL*cur*co[i][j]; } } } printf("%lld\n", ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...