Submission #98203

#TimeUsernameProblemLanguageResultExecution timeMemory
98203scanhexBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
192 ms80648 KiB
#include <bits/stdc++.h> using namespace std; using nagai = long long; #define sz(x) int((x).size()) const int N=3003; string ss[N]; int cri[N][N],cdo[N][N]; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n,m; cin>>n>>m; for(int i=0;i<n;++i)cin>>ss[i]; for(int i=0;i<n;++i) for(int j=m-1;j>=0;j--) if(j==m-1)cri[i][j]=(ss[i][j]=='O');else cri[i][j]=(ss[i][j]=='O')+cri[i][j+1]; nagai ans=0; for(int i=n-1;i>=0;--i) for(int j=0;j<m;++j){ if(i==n-1)cdo[i][j]=(ss[i][j]=='I');else cdo[i][j]=(ss[i][j]=='I')+cdo[i+1][j]; if(ss[i][j]=='J') ans+=cdo[i][j]*cri[i][j]; } cout<<ans<<'\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...