Submission #1087236

#TimeUsernameProblemLanguageResultExecution timeMemory
1087236Tesla89Bitaro the Brave (JOI19_ho_t1)C++14
20 / 100
6 ms6876 KiB
#include <bits/stdc++.h> using namespace std; int sufw[3001][3001],sufh[3001][3001]; int main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int h,w,res=0; cin>>h>>w; string a[h]; for(int i=0;i<h;i++)cin>>a[i]; for(int i=0;i<w;i++){ for(int j=h-1;j>=0;j--){ sufh[j][i]=sufh[j+1][i]+(a[j][i]=='I'); } } for(int i=0;i<h;i++){ for(int j=w-1;j>=0;j--){ sufw[i][j]=sufw[i][j+1]+(a[i][j]=='O'); } } for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ if(a[i][j]!='J')continue; res+=sufh[i][j]*sufw[i][j]; } } cout<<res<<'\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...