Submission #110688

#TimeUsernameProblemLanguageResultExecution timeMemory
110688kuroniBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
117 ms79864 KiB
#include <iostream> #include <cstdio> using namespace std; const int N = 3005, M = 3005; int m, n, f[M][N], g[M][N]; char s[M][N]; long long ans = 0; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> m >> n; for (int i = 0; i < m; i++) cin >> s[i]; for (int i = m - 1; i >= 0; i--) for (int j = n - 1; j >= 0; j--) { f[i][j] = f[i + 1][j] + (s[i][j] == 'I'); g[i][j] = g[i][j + 1] + (s[i][j] == 'O'); if (s[i][j] == 'J') ans += 1LL * f[i][j] * g[i][j]; } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...