Submission #347526

#TimeUsernameProblemLanguageResultExecution timeMemory
347526jazzupBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
292 ms53356 KiB
#include<cstdio> using namespace std; char a[3001][3001]; int dp[3001][3001]; int main(){ int h,w; scanf("%d%d",&h,&w); for(int i=0;i<h;i++){ scanf("%s",a[i]); } int cnt; for(int i=h-1;i>=0;i--){ cnt=0; for(int j=w-1;j>=0;j--){ if(a[i][j]=='O')cnt++; else if(a[i][j]=='J')dp[i][j]=cnt; // printf("%d ",cnt); } } long long sum=0; for(int i=w-1;i>=0;i--){ cnt=0; for(int j=h-1;j>=0;j--){ if(a[j][i]=='I')cnt++; else if(a[j][i]=='J'){ dp[j][i]*=cnt; sum+=dp[j][i]; } } } printf("%lld\n",sum); // for(int i=0;i<h;i++){ // for(int j=0;j<w;j++) // printf("%d ",dp[i][j]); // printf("\n"); // } return 0; }

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   11 |  scanf("%d%d",&h,&w);
      |  ~~~~~^~~~~~~~~~~~~~
joi2019_ho_t1.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   13 |   scanf("%s",a[i]);
      |   ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...