Submission #483576

#TimeUsernameProblemLanguageResultExecution timeMemory
483576TLP39Bitaro the Brave (JOI19_ho_t1)C++14
100 / 100
397 ms88700 KiB
#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)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...