Submission #464415

#TimeUsernameProblemLanguageResultExecution timeMemory
464415MKutayBozkurtBitaro the Brave (JOI19_ho_t1)C++14
20 / 100
13 ms2756 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; struct item { int o, i; }; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; vector<vector<char>> a(n + 1, vector<char>(m + 1)); vector<vector<item>> cnt(n + 1, vector<item>(m + 1)); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >> a[i][j]; if (a[i][j] == 'O') cnt[i][j].o++; if (a[i][j] == 'I') cnt[i][j].i++; cnt[i][j].o += cnt[i][j - 1].o; cnt[i][j].i += cnt[i - 1][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 += (cnt[i][m].o - cnt[i][j].o) * (cnt[n][j].i - cnt[i][j].i); } } } cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...