Submission #207826

#TimeUsernameProblemLanguageResultExecution timeMemory
207826kai824Bitaro the Brave (JOI19_ho_t1)C++17
0 / 100
5 ms504 KiB
#include "bits/stdc++.h" using namespace std; typedef long long ll; string mp[3005]; ll i_cnt[3005][3005]; ll o_cnt[3005][3005],ans; int32_t main() { ios_base::sync_with_stdio(false);cin.tie(0); int h,w; cin>>h>>w; for(int x=0;x<h;x++){ cin>>mp[x]; } for(int x=0;x<h;x++){ if(mp[x][w-1]=='o')o_cnt[x][w-1]++; for(int i=w-2;i>=0;i--){ o_cnt[x][i]=o_cnt[x][i+1]; if(mp[x][i]=='O')o_cnt[x][i]++; } } for(int x=0;x<w;x++){ for(int i=h-1;i>=0;i--){ i_cnt[i][x]=i_cnt[i+1][x]; if(mp[i][x]=='I')i_cnt[i][x]++; } } for(int x=0;x<h;x++){ for(int y=0;y<w;y++){ ans+=o_cnt[x][y+1]*i_cnt[x+1][y]; } } cout<<ans<<'\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...