제출 #1302443

#제출 시각아이디문제언어결과실행 시간메모리
1302443duyanhchupapiBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
133 ms79784 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 3003, inf = 2e9; int h, w, pfo[N][N], pfi[N][N]; char a[N][N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); // freopen(".INP", "r", stdin); // freopen(".OUT", "w", stdout); cin >> h >> w; for (int i=1;i<=h;++i) { for (int j=1;j<=w;++j) { cin >> a[i][j]; pfo[i][j] = pfo[i][j - 1] + (a[i][j] == 'O'); pfi[i][j] = pfi[i - 1][j] + (a[i][j] == 'I'); } } ll ans = 0; for (int i=1;i<=h;++i) { for (int j=1;j<=w;++j) { if (a[i][j] == 'J') { ans += (pfo[i][w] - pfo[i][j]) * (pfi[h][j] - pfi[i][j]); } } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...