# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
335719 | shahriarkhan | Bitaro the Brave (JOI19_ho_t1) | C++14 | 632 ms | 150328 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<bits/stdc++.h>
using namespace std ;
//type 0 -> orb
//type 1 -> ingot
const int maxN = 3e3 + 5 ;
long long dp[maxN][maxN][2] ;
int main()
{
char s[maxN][maxN] ;
int H , W ;
long long ans = 0 ;
scanf("%d%d",&H,&W) ;
for(int i = 0 ; i < H ; ++i)
{
for(int j = 0 ; j < W ; ++j)
{
scanf(" %c",&s[i][j]) ;
}
}
for(int i = H - 1 ; i >= 0 ; --i)
{
for(int j = W - 1 ; j >= 0 ; --j)
{
dp[i][j][0] = dp[i][j+1][0] ;
dp[i][j][1] = dp[i+1][j][1] ;
if(s[i][j]=='J') ans += (dp[i][j+1][0]*dp[i+1][j][1]) ;
else if(s[i][j]=='O') ++dp[i][j][0] ;
else ++dp[i][j][1] ;
}
}
printf("%lld\n",ans) ;
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... |