Submission #788441

#TimeUsernameProblemLanguageResultExecution timeMemory
788441mpawicka_77Bitaro the Brave (JOI19_ho_t1)C++14
100 / 100
461 ms79852 KiB
#include <bits/stdc++.h> using namespace std; const int N=3*1e3+2; char T[N][N]; int H[N][N],W[N][N]; int main() { int n,m; cin>>n>>m; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { cin>>T[i][j]; } } for(int i=1;i<=n;i++) { int wyn=0; for(int j=m;j>=1;j--) { W[i][j]=wyn; if(T[i][j]=='O')wyn++; } } for(int j=1;j<=m;j++) { int wyn=0; for(int i=n;i>=1;i--) { H[i][j]=wyn; if(T[i][j]=='I')wyn++; } } long long wyn=0; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { if(T[i][j]=='J') { wyn+=H[i][j]*W[i][j]; } } } cout<<wyn; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...