제출 #1124860

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