Submission #1010565

#TimeUsernameProblemLanguageResultExecution timeMemory
1010565danikoynovTriple Jump (JOI19_jumps)C++14
5 / 100
1 ms856 KiB
#include<bits/stdc++.h> #define endl '\n' const int MAX_N = 110; int n, q, a[MAX_N]; void input() { std::cin >> n; for (int i = 1; i <= n; i ++) std::cin >> a[i]; } void single_query(int l, int r) { int res = 0; for (int i = l; i <= r; i ++) for (int f = i + 1; f <= r; f ++) for (int j = f + (f - i); j <= r; j ++) res = std::max(res, a[i] + a[f] + a[j]); std::cout << res << endl; } void answer_queries() { std::cin >> q; for (int i = 1; i <= q; i ++) { int l, r; std::cin >> l >> r; single_query(l, r); } } void solve() { input(); answer_queries(); } int main() { solve(); 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...