Submission #334882

#TimeUsernameProblemLanguageResultExecution timeMemory
334882MilosMilutinovicBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
361 ms89708 KiB
#include <bits/stdc++.h> using namespace std; const int N=3050; int h,w,l[N][N],d[N][N]; char s[N][N]; int main(){ scanf("%i %i",&h,&w); for(int i=0;i<h;i++)scanf("%s",&s[i]); for(int i=0;i<h;i++){ for(int j=w-1;j>=0;j--){ if(j<w-1)l[i][j]=l[i][j+1]; if(s[i][j]=='O')l[i][j]++; } } for(int j=0;j<w;j++){ for(int i=h-1;i>=0;i--){ if(i<h-1)d[i][j]=d[i+1][j]; if(s[i][j]=='I')d[i][j]++; } } long long ans=0; for(int i=0;i<h;i++)for(int j=0;j<w;j++)if(s[i][j]=='J')ans+=d[i][j]*l[i][j]; printf("%lld",ans); return 0; }

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:8:33: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'char (*)[3050]' [-Wformat=]
    8 |     for(int i=0;i<h;i++)scanf("%s",&s[i]);
      |                                ~^  ~~~~~
      |                                 |  |
      |                                 |  char (*)[3050]
      |                                 char*
joi2019_ho_t1.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    7 |     scanf("%i %i",&h,&w);
      |     ~~~~~^~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:8:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    8 |     for(int i=0;i<h;i++)scanf("%s",&s[i]);
      |                         ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...