Submission #514933

#TimeUsernameProblemLanguageResultExecution timeMemory
514933status_codingBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
278 ms161560 KiB
#include <iostream> using namespace std; long long n,m,ans; string s[3005]; long long dpR[3005][3005]; long long dpD[3005][3005]; int main() { cin>>n>>m; for(int i=0;i<n;i++) cin>>s[i]; for(int i=n-1;i>=0;i--) for(int j=m-1;j>=0;j--) { dpR[i][j]=dpR[i][j+1] + (s[i][j] == 'O'); dpD[i][j]=dpD[i+1][j] + (s[i][j] == 'I'); if(s[i][j] == 'J') ans += dpR[i][j] * dpD[i][j]; } cout<<ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...