제출 #591154

#제출 시각아이디문제언어결과실행 시간메모리
591154dryeabBitaro the Brave (JOI19_ho_t1)C++17
0 / 100
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int h, w; cin >> h >> w; vector<vector<char>> grid(h, vector<char>(w)), mark(h, vector<char>(w)); for (int i = 0; i < h; ++i) { for (int j = 0; j < w; ++j) cin >> grid[i][j]; } int ok; for (int i = 0; i < w; ++i) { ok = 0; for (int j = h - 1; j >= 0; --j) { if (grid[j][i] == 'I') ok++; else if (grid[j][i] == 'J') mark[j][i] = ok; } } long long res = 0; for (int i = 0; i < h; ++i) { ok = 0; for (int j = w - 1; j >= 0; --j) { if (grid[i][j] == 'O') ok++; else if (grid[i][j] == 'J') { mark[i][j] *= ok; res += mark[i][j]; } } } cout << res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...