Submission #335719

#TimeUsernameProblemLanguageResultExecution timeMemory
335719shahriarkhanBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
632 ms150328 KiB
#include<bits/stdc++.h> using namespace std ; //type 0 -> orb //type 1 -> ingot const int maxN = 3e3 + 5 ; long long dp[maxN][maxN][2] ; int main() { char s[maxN][maxN] ; int H , W ; long long ans = 0 ; scanf("%d%d",&H,&W) ; for(int i = 0 ; i < H ; ++i) { for(int j = 0 ; j < W ; ++j) { scanf(" %c",&s[i][j]) ; } } for(int i = H - 1 ; i >= 0 ; --i) { for(int j = W - 1 ; j >= 0 ; --j) { dp[i][j][0] = dp[i][j+1][0] ; dp[i][j][1] = dp[i+1][j][1] ; if(s[i][j]=='J') ans += (dp[i][j+1][0]*dp[i+1][j][1]) ; else if(s[i][j]=='O') ++dp[i][j][0] ; else ++dp[i][j][1] ; } } printf("%lld\n",ans) ; return 0 ; }

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |     scanf("%d%d",&H,&W) ;
      |     ~~~~~^~~~~~~~~~~~~~
joi2019_ho_t1.cpp:21:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   21 |             scanf(" %c",&s[i][j]) ;
      |             ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...