Submission #897365

#TimeUsernameProblemLanguageResultExecution timeMemory
897365boxBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
86 ms89328 KiB
#include <bits/stdc++.h> using namespace std; const int N = 3000; int main() { ios::sync_with_stdio(0), cin.tie(0); int n, m; cin >> n >> m; static string s[N]; for (int i = 0; i < n; i++) cin >> s[i]; static int co[N][N], ci[N][N]; long long ans = 0; for (int i = n - 1; i >= 0; i--) for (int j = m - 1; j >= 0; j--) { if (j < m - 1) co[i][j] += co[i][j + 1]; if (i < n - 1) ci[i][j] += ci[i + 1][j]; if (s[i][j] == 'J') ans += co[i][j] * ci[i][j]; else if (s[i][j] == 'O') co[i][j]++; else ci[i][j]++; } cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...