제출 #711074

#제출 시각아이디문제언어결과실행 시간메모리
711074JJAnawatBitaro the Brave (JOI19_ho_t1)C++14
20 / 100
30 ms71500 KiB
#include<bits/stdc++.h> using namespace std; int h,w; string grid[3005]; int qs1[3005][3005],qs2[3005][3005]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> h >> w; for(int i=1;i<=h;i++){ string s; cin >> s; s=" "+s; grid[i]=s; } memset(qs1,0,sizeof(qs1)); memset(qs2,0,sizeof(qs2)); for(int i=1;i<=h;i++){ for(int j=w;j>=1;j--){ qs1[i][j]=qs1[i][j+1]+(grid[i][j]=='O'); } } for(int i=h;i>=1;i--){ for(int j=1;j<=w;j++){ qs2[i][j]=qs2[i+1][j]+(grid[i][j]=='I'); } } int ans=0; for(int i=1;i<=h;i++){ for(int j=1;j<=w;j++){ if(grid[i][j]=='J'){ ans+=qs1[i][j]*qs2[i][j]; } } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...