Submission #1124110

#TimeUsernameProblemLanguageResultExecution timeMemory
1124110votranngocvyBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
213 ms150412 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int N = 3e3 + 5; char a[N][N]; int cntO[N][N],cntI[N][N]; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,m; cin >> n >> m; 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--) { cntO[i][j] = cntO[i][j + 1] + (a[i][j] == 'O'); cntI[i][j] = cntI[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 += cntO[i][j] * cntI[i][j]; cout << ans << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...