Submission #242244

#TimeUsernameProblemLanguageResultExecution timeMemory
242244tqbfjotldTriple Jump (JOI19_jumps)C++14
5 / 100
41 ms2040 KiB
#include <bits/stdc++.h> using namespace std; long long arr[500005]; int main(){ int n,q; scanf("%d",&n); for (int x = 0; x<n; x++){ scanf("%lld",&arr[x]); } scanf("%d",&q); if (n<=100 && q<=100){ for (int x = 0; x<q; x++){ int l,r; scanf("%d%d",&l,&r); l--;r--; long long ans = 0; for (int a = l; a<=r; a++){ for (int c = a+2; c<=r; c++){ for (int b = a+1; c-b>=b-a; b++){ ans = max(ans,arr[a]+arr[b]+arr[c]); } } } printf("%lld\n",ans); } } }

Compilation message (stderr)

jumps.cpp: In function 'int main()':
jumps.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
jumps.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",&arr[x]);
         ~~~~~^~~~~~~~~~~~~~~~
jumps.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&q);
     ~~~~~^~~~~~~~~
jumps.cpp:16:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d%d",&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...