# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
483575 | TLP39 | Bitaro the Brave (JOI19_ho_t1) | C++14 | 0 ms | 204 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;
int h,w;
char jewel[3010][3010];
int orbRight[3010][3010];
int ingotDown[3010][3010];
void getOrb()
{
for(int i=0;i<h;i++)
{
orbRight[i][w-1] = 0;
for(int j=w-1;j>=1;j--)
{
orbRight[i][j-1] = orbRight[i][j]+(jewel[i][j]=='O'? 1:0);
}
}
}
void getIngot()
{
for(int i=0;i<w;i++) ingotDown[h-1][i] = 0;
for(int i=h-1;i>=1;i--)
{
for(int j=0;j<w;j++)
{
ingotDown[i-1][j] = ingotDown[i][j]+(jewel[i][j]=='I'? 1:0);
}
}
}
long long int total()
{
long long int tot = 0;
for(int i=0;i<h;i++)
{
for(int j=0;j<w;j++)
{
if(jewel[i][j]=='J') tot += 1ll * orbRight[i][j] * ingotDown[i][j];
}
}
return tot;
}
int main()
{
scanf("%d %d",&h,&w);
for(int i=0;i<h;i++)
{
for(int j=0;j<w;j++)
{
scanf("%c ",&jewel[i][j]);
}
}
getOrb();
getIngot();
printf("%lld",total());
}
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... |