Submission #945003

#TimeUsernameProblemLanguageResultExecution timeMemory
945003thelegendary08Triple Jump (JOI19_jumps)C++14
5 / 100
4081 ms1880 KiB
#include<bits/stdc++.h> #define f0r(i,n) for(int i = 0;i<n;i++) #define pb push_back #define vll vector<long long int> using namespace std; typedef long long int ll; int main(){ int n; cin>>n; vll v(n); f0r(i,n){ cin>>v[i]; } int q; cin>>q; while(q--){ int l,r; cin>>l>>r; l--; r--; ll ans = 0; for(int i = l;i<r-1;i++){ for(int j = i+1;j<r;j++){ for(int k = i+1;k<=r;k++){ if(k-j >= j-i){ ans = max(ans, v[i] + v[j] + v[k]); } } } } 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...