Submission #1262561

#TimeUsernameProblemLanguageResultExecution timeMemory
1262561sohamsen15Bitaro the Brave (JOI19_ho_t1)C++20
20 / 100
4 ms2632 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int h, w, ans = 0; cin >> h >> w; vector<vector<char>> a(h + 1, vector<char>(w + 1)); for (int i = 1; i <= h; i++) { string s; cin >> s; for (int j = 1; j <= w; j++) a[i][j] = s[j - 1]; } vector<vector<int>> orbs(h + 1, vector<int>(w + 1)); for (int i = 1; i <= h; i++) for (int j = 1; j <= w; j++) orbs[i][j] = orbs[i][j - 1] + (a[i][j] == 'O'); vector<vector<int>> ingots(h + 1, vector<int>(w + 1)); for (int j = 1; j <= w; j++) for (int i = 1; i <= h; i++) ingots[i][j] = ingots[i - 1][j] + (a[i][j] == 'I'); for (int i = 1; i <= h; i++) for (int j = 1; j <= w; j++) if (a[i][j] == 'J') ans += (orbs[i][w] - orbs[i][j]) * (ingots[h][j] - ingots[i][j]); cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...