제출 #1135600

#제출 시각아이디문제언어결과실행 시간메모리
1135600Hamed_GhaffariBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
132 ms79644 KiB
#include<bits/stdc++.h> using namespace std; const int MXN = 3003; int h, w; char a[MXN][MXN]; int I[MXN][MXN], O[MXN][MXN]; int32_t main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); cin >> h >> w; for(int i=1; i<=h; i++) for(int j=1; j<=w; j++) cin >> a[i][j]; long long ans = 0; for(int i=h; i>=1; i--) for(int j=w; j>=1; j--) { I[i][j] = (i+1<=h ? I[i+1][j] : 0) + (a[i][j]=='I'); O[i][j] = (j+1<=w ? O[i][j+1] : 0) + (a[i][j]=='O'); if(a[i][j]=='J') ans += I[i][j]*O[i][j]; } cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...