Submission #483576

# Submission time Handle Problem Language Result Execution time Memory
483576 2021-10-30T23:40:13 Z TLP39 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
397 ms 88700 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);
  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

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);
      |   ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:54:12: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   54 |       scanf("%c ",&jewel[i][j]);
      |       ~~~~~^~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 432 KB Output is correct
5 Correct 2 ms 1484 KB Output is correct
6 Correct 1 ms 1484 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1484 KB Output is correct
9 Correct 2 ms 1356 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1484 KB Output is correct
12 Correct 1 ms 1356 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 432 KB Output is correct
5 Correct 2 ms 1484 KB Output is correct
6 Correct 1 ms 1484 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1484 KB Output is correct
9 Correct 2 ms 1356 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1484 KB Output is correct
12 Correct 1 ms 1356 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 11 ms 7372 KB Output is correct
15 Correct 2 ms 4992 KB Output is correct
16 Correct 8 ms 4284 KB Output is correct
17 Correct 0 ms 460 KB Output is correct
18 Correct 18 ms 7940 KB Output is correct
19 Correct 14 ms 7816 KB Output is correct
20 Correct 12 ms 7748 KB Output is correct
21 Correct 13 ms 7996 KB Output is correct
22 Correct 12 ms 7884 KB Output is correct
23 Correct 12 ms 7864 KB Output is correct
24 Correct 14 ms 7888 KB Output is correct
25 Correct 11 ms 7896 KB Output is correct
26 Correct 12 ms 7728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 432 KB Output is correct
5 Correct 2 ms 1484 KB Output is correct
6 Correct 1 ms 1484 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1484 KB Output is correct
9 Correct 2 ms 1356 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1484 KB Output is correct
12 Correct 1 ms 1356 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 11 ms 7372 KB Output is correct
15 Correct 2 ms 4992 KB Output is correct
16 Correct 8 ms 4284 KB Output is correct
17 Correct 0 ms 460 KB Output is correct
18 Correct 18 ms 7940 KB Output is correct
19 Correct 14 ms 7816 KB Output is correct
20 Correct 12 ms 7748 KB Output is correct
21 Correct 13 ms 7996 KB Output is correct
22 Correct 12 ms 7884 KB Output is correct
23 Correct 12 ms 7864 KB Output is correct
24 Correct 14 ms 7888 KB Output is correct
25 Correct 11 ms 7896 KB Output is correct
26 Correct 12 ms 7728 KB Output is correct
27 Correct 357 ms 88004 KB Output is correct
28 Correct 10 ms 25916 KB Output is correct
29 Correct 26 ms 7704 KB Output is correct
30 Correct 1 ms 588 KB Output is correct
31 Correct 262 ms 72644 KB Output is correct
32 Correct 351 ms 88700 KB Output is correct
33 Correct 341 ms 88204 KB Output is correct
34 Correct 301 ms 84212 KB Output is correct
35 Correct 345 ms 88600 KB Output is correct
36 Correct 358 ms 88212 KB Output is correct
37 Correct 397 ms 88484 KB Output is correct
38 Correct 239 ms 72608 KB Output is correct
39 Correct 240 ms 72260 KB Output is correct