Submission #895423

#TimeUsernameProblemLanguageResultExecution timeMemory
895423Richw818Bitaro the Brave (JOI19_ho_t1)C++17
100 / 100
182 ms54424 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int h, w; cin >> h >> w; vector<string> grid(h); for (int i = 0; i < h; i++) { cin >> grid[i]; } vector<vector<int>> ibelow(h, vector<int>(w)); for (int c = 0; c < w; c++) { int i = 0; for (int r = h - 1; r >= 0; r--) { i += (grid[r][c] == 'I'); ibelow[r][c] = i; } } long long ans = 0; for (int r = 0; r < h; r++) { int o = 0; for (int c = w - 1; c >= 0; c--) { o += (grid[r][c] == 'O'); if (grid[r][c] == 'J') { ans += ibelow[r][c] * o; } } } cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...