Submission #944019

#TimeUsernameProblemLanguageResultExecution timeMemory
944019teacupTriple Jump (JOI19_jumps)C++14
5 / 100
4083 ms3672 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ii pair<int,int> typedef vector<int> vi; #define iii tuple<int,int,int> typedef vector<ii> vii; typedef vector<iii> viii; typedef map<int,int> mii; #ifndef debug #define cerr if (0) cerr #endif int N, Q, L, R, ans; int32_t main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin>>N; vi A(N+5); for (int i=1; i<=N; i++) cin>>A[i]; cin>>Q; while (Q--){ cin>>L>>R; ans = 0; for (int i=L; i<=R; i++){ for (int j=i+1; j<=R; j++){ for (int k=j+1; k<=R; k++){ if (!(j-i <= k-j)) continue; ans=max(ans, A[i]+A[j]+A[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...