Submission #224131

#TimeUsernameProblemLanguageResultExecution timeMemory
224131jamielimFire (JOI20_ho_t5)C++14
1 / 100
6 ms688 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n,q; scanf("%d%d",&n,&q); long long arr[n+5][n]; for(int i=0;i<n;i++)scanf("%lld",&arr[0][i]); for(int i=1;i<=n;i++){ arr[i][0]=arr[i-1][0]; for(int j=1;j<n;j++){ arr[i][j]=max(arr[i-1][j-1],arr[i-1][j]); } } int t,l,r; for(int i=0;i<q;i++){ scanf("%d%d%d",&t,&l,&r);l--;r--; long long ans=0; for(int j=l;j<=r;j++){ ans+=arr[t][j]; } printf("%lld\n",ans); } }

Compilation message (stderr)

ho_t5.cpp: In function 'int main()':
ho_t5.cpp:6:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&q);
  ~~~~~^~~~~~~~~~~~~~
ho_t5.cpp:8:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=0;i<n;i++)scanf("%lld",&arr[0][i]);
                      ~~~~~^~~~~~~~~~~~~~~~~~~
ho_t5.cpp:17:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%d",&t,&l,&r);l--;r--;
   ~~~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...