Submission #922101

#TimeUsernameProblemLanguageResultExecution timeMemory
922101406Bitaro the Brave (JOI19_ho_t1)C++17
100 / 100
115 ms163040 KiB
#include <bits/stdc++.h> #define int int64_t #define FOR(i, a, b) for (int i = (a); i < (b); ++i) using namespace std; using ar = array<int, 2>; const int64_t INF = 1ll << 60; const int N = 3000 + 50; string s[N]; int n, m, cntI[N][N], cntO[N][N]; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> m; FOR(i, 0, n) cin >> s[i]; int ans = 0; for (int i = n - 1; i >= 0; --i) { for (int j = m - 1; j >= 0; --j) { cntI[i][j] = cntI[i][j + 1] + (s[i][j] == 'O'); cntO[i][j] = cntO[i + 1][j] + (s[i][j] == 'I'); ans += (s[i][j] == 'J' ? cntI[i][j] * cntO[i][j] : 0); } } cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...