Submission #1099102

#TimeUsernameProblemLanguageResultExecution timeMemory
1099102rukashiiTriple Jump (JOI19_jumps)C++17
5 / 100
16 ms3676 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int maxn = 1e6 + 4; int a[maxn] , n , m; void nhap() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i = 1 ; i <= n ; i ++) cin >> a[i]; cin >> m; } void xl1(int l , int r) { int ans = 0; for (int i = l ; i <= r - 2 ; i ++) { for (int j = i + 1 ; j <= r - 1 ; j ++) { for (int k = j + (j - i) ; k <= r ; k ++) { ans = max(ans , a[i] + a[j] + a[k]); } } } cout << ans << '\n'; } void Sub1() { for (int i = 1 ; i <= m ; i ++) { int l , r; cin >> l >> r; xl1(l , r); } } signed main() { nhap(); if (n <= 100 && m <= 100) Sub1(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...