Submission #1087237

#TimeUsernameProblemLanguageResultExecution timeMemory
1087237Tesla89Bitaro the Brave (JOI19_ho_t1)C++14
100 / 100
229 ms160428 KiB
#include <bits/stdc++.h> #define int long long using namespace std; int sufw[3010][3010],sufh[3010][3010]; signed 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...