Submission #204495

#TimeUsernameProblemLanguageResultExecution timeMemory
204495T0p_Bitaro the Brave (JOI19_ho_t1)C++14
100 / 100
257 ms160520 KiB
#include<bits/stdc++.h> using namespace std; char t[3030][3030]; long long dp[2][3030][3030]; int main() { int n, m; scanf(" %d %d",&n,&m); for(int i=1 ; i<=n ; i++) scanf(" %s",t[i]+1); for(int i=n ; i>=1 ; i--) { for(int j=m ; j>=1 ; j--) { if(t[i][j] == 'O') dp[0][i][j]++; if(t[i][j] == 'I') dp[1][i][j]++; dp[0][i][j] += dp[0][i][j+1]; dp[1][i][j] += dp[1][i+1][j]; } } long long ans = 0; for(int i=1 ; i<=n ; i++) for(int j=1 ; j<=m ; j++) if(t[i][j] == 'J') ans += dp[0][i][j] * dp[1][i][j]; printf("%lld\n",ans); return 0; }

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf(" %d %d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf(" %s",t[i]+1);
   ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...