제출 #1158366

#제출 시각아이디문제언어결과실행 시간메모리
1158366crispxxBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
96 ms80964 KiB
#include <bits/stdc++.h> using namespace std; #define nl '\n' int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int H, W; cin >> H >> W; vector<string> s(H); for(auto &row : s) cin >> row; vector<vector<int>> I(H + 1, vector<int>(W + 1)), O(H + 1, vector<int>(W + 1)); for(int i = H - 1; i >= 0; i--) { for(int j = W - 1; j >= 0; j--) { I[i][j] = I[i + 1][j] + (s[i][j] == 'I'); O[i][j] = O[i][j + 1] + (s[i][j] == 'O'); } } long long ans = 0; for(int i = 0; i < H; i++) { for(int j = 0; j < W; j++) { if(s[i][j] == 'J') { ans += I[i][j] * 1LL * O[i][j]; } } } cout << ans << nl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...