제출 #1167437

#제출 시각아이디문제언어결과실행 시간메모리
1167437henriess3단 점프 (JOI19_jumps)C++20
5 / 100
4094 ms1860 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n;cin >> n; vector<long long> A(n); for(int i = 0;i<n;i++){ cin >> A[i]; } long long q;cin >> q; //within each section I have to pick the 3 largest values while (q--){ long long l,r;cin >> l >> r; l--;r--; long long ans = 0; for(int i = l;i<=r;i++){ //assume i pick the first element at i for(int j = i+1;j<=r;j++){ for(int k = j+1;k<=r;k++){ if (abs(k-j) >= abs(j-i)){ ans = max(ans,A[i] + A[k] + A[j]); } } } } 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...