# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
204495 | T0p_ | Bitaro the Brave (JOI19_ho_t1) | C++14 | 257 ms | 160520 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;
char t[3030][3030];
long long dp[2][3030][3030];
int main()
{
int n, m;
scanf(" %d %d",&n,&m);
for(int i=1 ; i<=n ; i++)
scanf(" %s",t[i]+1);
for(int i=n ; i>=1 ; i--)
{
for(int j=m ; j>=1 ; j--)
{
if(t[i][j] == 'O') dp[0][i][j]++;
if(t[i][j] == 'I') dp[1][i][j]++;
dp[0][i][j] += dp[0][i][j+1];
dp[1][i][j] += dp[1][i+1][j];
}
}
long long ans = 0;
for(int i=1 ; i<=n ; i++)
for(int j=1 ; j<=m ; j++)
if(t[i][j] == 'J') ans += dp[0][i][j] * dp[1][i][j];
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... |