Submission #1121388

#TimeUsernameProblemLanguageResultExecution timeMemory
1121388kasdoBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
482 ms159324 KiB
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { int n, m; cin>>n>>m; char a[n + 5][m + 5]; int s1[n + 5][m + 5] = {}, s2[n + 5][m + 5] = {}; for(int i=1; i<=n; i++) { for(int j=1; j<=m; j++) cin>>a[i][j]; } for(int i=n; i>=1; i--) { for(int j=m; j>=1; j--) { s1[i][j] = s1[i][j + 1] + (a[i][j] == 'O'); s2[i][j] = s2[i + 1][j] + (a[i][j] == 'I'); } } int ans = 0; for(int i=1; i<=n; i++) { for(int j=1; j<=m; j++) { if (a[i][j] == 'J') ans += (s1[i][j + 1] * s2[i + 1][j]); } } cout<<ans<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...