Submission #941678

#TimeUsernameProblemLanguageResultExecution timeMemory
941678emptypringlescanTriple Jump (JOI19_jumps)C++17
5 / 100
4034 ms1884 KiB
#include <bits/stdc++.h> using namespace std; int32_t main(){ ios::sync_with_stdio(0);cin.tie(0); int n; cin >> n; long long arr[n]; for(int i=0; i<n; i++) cin >> arr[i]; int q; cin >> q; while(q--){ int l,r; cin >> l >> r; l--; r--; long long ans=0; for(int a=l; a<=r; a++){ for(int b=a+1; b<=r; b++){ for(int c=b*2-a; c<=r; c++) ans=max(ans,arr[a]+arr[b]+arr[c]); } } cout << ans << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...