Submission #97434

#TimeUsernameProblemLanguageResultExecution timeMemory
97434aer0parkBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
516 ms150544 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n,m,no[3004][3004],ni[3004][3004],anw; vector<string> ar; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cin>>n>>m; for(int i=0;i<n;i++) { string a;cin>>a; ar.push_back(a); } for(int i=0;i<n;i++) { ll sum=0; for(int j=m-1;j>=0;j--) { if(ar[i][j]=='O') sum++; no[i][j]=sum; } } for(int i=0;i<m;i++) { ll sum=0; for(int j=n-1;j>=0;j--) { if(ar[j][i]=='I') sum++; ni[j][i]=sum; } } for(int i=0;i<n;i++) for(int j=0;j<m;j++) if(ar[i][j]=='J') anw+=ni[i][j]*no[i][j]; cout<<anw; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...