Submission #945039

#TimeUsernameProblemLanguageResultExecution timeMemory
945039bngybongybrdTriple Jump (JOI19_jumps)C++17
5 / 100
4050 ms3664 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int n, q; int arr[500005]; signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; for(int i = 0; i < n; i++) cin >> arr[i]; cin >> q; for(int i = 0; i < q; i++){ int maxm = 0; int l, r; cin >> l >> r; for(int x = l-1; x < (r-2); x++){ int temp; if((r-1+x)%2 == 1){ temp = (r+x-1)/2+1; } else { temp = (r+x-1)/2+1; } for(int j = x+1; j < temp; j++){ for(int y = (j-x)+j; y < r; y++){ //cout << arr[x]+arr[j]+arr[y] << "\n"; maxm = max(maxm, arr[x]+arr[j]+arr[y]); } } } cout << maxm << "\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...