Submission #944132

#TimeUsernameProblemLanguageResultExecution timeMemory
944132yhkhooTriple Jump (JOI19_jumps)C++17
5 / 100
4051 ms1124 KiB
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(0); ios_base::sync_with_stdio(0); int N; cin >> N; vector<int> A(N); for(int i=0; i<N; i++){ cin >> A[i]; } int Q; cin >> Q; while(Q--){ int L, R; cin >> L >> R; L--; R--; int ans=0; for(int a=L; a<R-1; a++){ for(int c=a+2; c<=R; c++){ for(int b=a+1; b<=a+(c-a)/2; b++){ ans = max(ans, A[a]+A[b]+A[c]); } } } cout << ans << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...