Submission #1012393

#TimeUsernameProblemLanguageResultExecution timeMemory
1012393ereringTriple Jump (JOI19_jumps)C++17
5 / 100
4035 ms3672 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define pb push_back #define ll long long #define int long long const long long inf=1e18+1; const int MOD=1e9+7; const int N=5e5+1; signed main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int n; cin>>n; int a[n]; for(int i=0;i<n;i++)cin>>a[i]; int q; cin>>q; while(q--){ int l,r,ans=0; cin>>l>>r; l--; r--; for(int i=r;i>=l;i--){ for(int j=i-1;j>=l;j--){ for(int k=j-1;k>=j-(i-j) && k>=l;k--){ ans=max(ans,a[i]+a[j]+a[k]); } } } cout<<ans<<endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...