Submission #1003044

#TimeUsernameProblemLanguageResultExecution timeMemory
1003044tamir1Bitaro the Brave (JOI19_ho_t1)C++17
100 / 100
340 ms88572 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; int x,y,n,m,i,j,dp1[3005][3005],dp2[3005][3005]; ll ans; char s[3005][3005]; int main(){ cin >> n >> m; for(i=1;i<=n;i++){ for(j=1;j<=m;j++){ cin >> s[i][j]; } } for(i=n;i>0;i--){ for(j=m;j>0;j--){ dp1[i][j]=dp1[i][j+1]; dp2[i][j]=dp2[i+1][j]; if(s[i][j]=='J') ans+=dp1[i][j]*dp2[i][j]; if(s[i][j]=='O') dp1[i][j]++; if(s[i][j]=='I') dp2[i][j]++; } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...