Submission #646895

#TimeUsernameProblemLanguageResultExecution timeMemory
646895OlsonBitaro the Brave (JOI19_ho_t1)C++17
20 / 100
9 ms2644 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int h,w;cin>>h>>w; int pso[h+1][w+1]; int psi[h+1][w+1]; for(int i=0; i<=h; i++){ pso[i][0]=0; } for(int i=0; i<=w; i++){ pso[0][i]=0; } string s[h]; for(int i=0; i<h; i++)cin>>s[i]; for(int i=1; i<=h; i++){ for(int j=1; j<=w; j++){ psi[i][j]=psi[i-1][j]; pso[i][j]=pso[i][j-1]; if(s[i-1][j-1]=='I')psi[i][j]++; if(s[i-1][j-1]=='O')pso[i][j]++; } } int ans=0; for(int i=1; i<=h; i++){ for(int j=1; j<=w; j++){ if(s[i-1][j-1]=='J'){ int m = psi[h][j]-psi[i][j]; int n = pso[i][w]-pso[i][j]; ans+=m*n; } } } cout<<ans<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...