제출 #753095

#제출 시각아이디문제언어결과실행 시간메모리
753095CdSBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
701 ms150572 KiB
#include <bits/stdc++.h> using namespace std; long long orbes[3010][3010]; long long ingots[3010][3010]; char grid[3010][3010]; int main() { long long h, w; cin >> h >> w; for (long long i = 0; i < h; i++) { for (long long j = 0; j < w; j++) { cin >> grid[i][j]; } } for (long long i = 0; i < h; i++) { for (long long j = w; j >= 0; j--) { orbes[i][j] = orbes[i][j+1] + (grid[i][j] == 'O'); } } for (long long j = 0; j < w; j++) { for (long long i = h; i >= 0; i--) { ingots[i][j] = ingots[i+1][j] + (grid[i][j] == 'I'); } } long long ans = 0; for (long long i = 0; i < h; i++) { for (long long j = 0; j < w; j++) { if (grid[i][j] == 'J') { ans += ingots[i][j] * orbes[i][j]; } } } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...