Submission #483574

# Submission time Handle Problem Language Result Execution time Memory
483574 2021-10-30T23:32:16 Z TLP39 Bitaro the Brave (JOI19_ho_t1) C++14
0 / 100
0 ms 332 KB
#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);
  getOrb();
  getIngot();
  printf("%lld",total());
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:49:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   49 |   scanf("%d %d",&h,&w);
      |   ~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 332 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 332 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 332 KB Output isn't correct
3 Halted 0 ms 0 KB -