제출 #477232

#제출 시각아이디문제언어결과실행 시간메모리
477232ponytailBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
683 ms159304 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int ps1[3010][3010]; // O int ps2[3010][3010]; // I char a[3010][3010]; signed main() { int H, W; cin >> H >> W; for(int i=1; i<=H; i++) { for(int j=1; j<=W; j++) { cin >> a[i][j]; ps1[i][j] = ps1[i][j-1] + (a[i][j] == 'O'); ps2[i][j] = ps2[i-1][j] + (a[i][j] == 'I'); } } int ans = 0; for(int i=1; i<=H; i++) { for(int j=1; j<=W; j++) { if(a[i][j] == 'J') ans += (ps1[i][W] - ps1[i][j]) * (ps2[H][j] - ps2[i][j]); } } cout << ans << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...