# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
347526 | jazzup | Bitaro the Brave (JOI19_ho_t1) | C++14 | 292 ms | 53356 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<cstdio>
using namespace std;
char a[3001][3001];
int dp[3001][3001];
int main(){
int h,w;
scanf("%d%d",&h,&w);
for(int i=0;i<h;i++){
scanf("%s",a[i]);
}
int cnt;
for(int i=h-1;i>=0;i--){
cnt=0;
for(int j=w-1;j>=0;j--){
if(a[i][j]=='O')cnt++;
else if(a[i][j]=='J')dp[i][j]=cnt;
// printf("%d ",cnt);
}
}
long long sum=0;
for(int i=w-1;i>=0;i--){
cnt=0;
for(int j=h-1;j>=0;j--){
if(a[j][i]=='I')cnt++;
else if(a[j][i]=='J'){
dp[j][i]*=cnt;
sum+=dp[j][i];
}
}
}
printf("%lld\n",sum);
// for(int i=0;i<h;i++){
// for(int j=0;j<w;j++)
// printf("%d ",dp[i][j]);
// printf("\n");
// }
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |