제출 #646870

#제출 시각아이디문제언어결과실행 시간메모리
646870heittprBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
308 ms46648 KiB
#include <bits/stdc++.h> using namespace std; int h, w; char grid[3010][3010]; int x[3010][3010]; int main() { cin.tie(0)->sync_with_stdio(0); cin >> h >> w; for (int j = 0; j < h; j++) for (int i = 0; i < w; i++) cin >> grid[i][j]; for (int j = 0; j < h; j++) { int k = 0; for (int i = w; i >= 0; i--) { // cout << i << ',' << j << ' ' << grid[i][j] << '\n'; if (grid[i][j] == 'O') k++; if (grid[i][j] == 'J') { // cout << "-> " << i << ',' << j << ' ' << k << '\n'; x[i][j] = k; } } // cout << "\n"; } long long ans = 0; for (int i = 0; i < w; i++) { int k = 0; for (int j = 0; j < h; j++) { k += x[i][j]; // cout << i << ',' << j << ' ' << grid[i][j] << ' ' << k << '\n'; if (grid[i][j] == 'I') { ans += k; // cout << "-> " << i << ',' << j << ' ' << k << '\n'; } } // cout << '\n'; } cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...