Submission #1024593

#TimeUsernameProblemLanguageResultExecution timeMemory
1024593toast12Bitaro the Brave (JOI19_ho_t1)C++14
100 / 100
233 ms18112 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); int h, w; cin >> h >> w; vector<vector<char>> grid(h+1, vector<char>(w+1)); vector<int> orb(h+1), ingot(w+1); for (int i = 1; i <= h; i++) { for (int j = 1; j <= w; j++) { cin >> grid[i][j]; if (grid[i][j] == 'O') orb[i]++; else if (grid[i][j] == 'I') ingot[j]++; } } ll ans = 0; for (int i = 1; i <= h; i++) { for (int j = 1; j <= w; j++) { if (grid[i][j] == 'J') ans += 1ll*orb[i]*ingot[j]; else if (grid[i][j] == 'O') orb[i]--; else ingot[j]--; } } cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...