Submission #939544

#TimeUsernameProblemLanguageResultExecution timeMemory
939544NewtonabcBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
237 ms91324 KiB
#include<bits/stdc++.h> using namespace std; vector<string> tb; const int N=3e3+10; int o[N][N]; int e[N][N]; int main(){ int h,w; cin>>h >>w; tb.resize(h+10); for(int i=0;i<h;i++){ cin>>tb[i]; } //cout<<1; for(int i=0;i<h;i++){ for(int j=w-1;j>=0;j--){ o[i][j]=o[i][j+1]; if(tb[i][j]=='O') o[i][j]++; } } //cout<<2; for(int i=h-1;i>=0;i--){ //cout<<4; for(int j=0;j<w;j++){ //cout<<5; e[i][j]=e[i+1][j]; if(tb[i][j]=='I') e[i][j]++; } } //cout<<3; long long sum=0; for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ if(tb[i][j]=='J') sum+=(o[i][j+1]*e[i+1][j]); } } cout<<sum; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...