제출 #495553

#제출 시각아이디문제언어결과실행 시간메모리
495553600Mihnea3단 점프 (JOI19_jumps)C++17
5 / 100
4051 ms2764 KiB
#include <bits/stdc++.h> using namespace std; const int N = (int) 5e5 + 7; const int INF = (int) 1e9 + 7; int n; int q; int a[N]; signed main() { ios::sync_with_stdio(0); cin.tie(0); //freopen ("input", "r", stdin); cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; } cin >> q; for (int iq = 1; iq <= q; iq++) { int l, r, best = 0; cin >> l >> r; 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) { best = max(best, a[i] + a[j] + a[k]); } } } } cout << best << "\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...