Submission #529337

#TimeUsernameProblemLanguageResultExecution timeMemory
529337daisyBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
392 ms159076 KiB
#include<iostream> #define endl '\n' using namespace std; long long red,col,bro[3005][3005],bri[3005][3005],br=0; char c[3005][3005]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>red>>col; for(long long i=0;i<red;i++) { for(long long j=0;j<col;j++) { cin>>c[i][j]; } } for(long long i=0;i<red;i++) { for(long long j=col-1;j>=0;j--) { if(c[i][j]=='O') bro[i][j]++; bro[i][j]+=bro[i][j+1]; } } for(long long i=0;i<col;i++) { for(long long j=red-1;j>=0;j--) { if(c[j][i]=='I') bri[j][i]++; bri[j][i]+=bri[j+1][i]; } } for(long long i=0;i<red;i++) { for(long long j=0;j<col;j++) { if(c[i][j]=='J') br+=(bro[i][j+1]*bri[i+1][j]); } } cout<<br<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...