Submission #833117

# Submission time Handle Problem Language Result Execution time Memory
833117 2023-08-22T01:22:38 Z PurpleCrayon Triple Jump (JOI19_jumps) C++17
5 / 100
4000 ms 1652 KB
#include <bits/stdc++.h>
using namespace std;

#define sz(v) int(v.size())
#define ar array
typedef long long ll;
const int N = 5e5+10, INF = 1e9+10;

int n, q, a[N];

void solve() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    int q; cin >> q;
    while (q--) {
        int l, r; cin >> l >> r, --l, --r;
        ll ans = 0;
        for (int i = l; i <= r; i++) {
            for (int j = i+1; j <= r; j++) {
                for (int k = j+1; k <= r; k++) {
                    if (k - j >= j - i) {
                        ans = max(ans, (long long) a[i] + a[j] + a[k]);
                    }
                }
            }
        }
        cout << ans << '\n';
    }
}

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    solve();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 4 ms 212 KB Output is correct
3 Correct 3 ms 212 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
7 Correct 3 ms 212 KB Output is correct
8 Correct 3 ms 212 KB Output is correct
9 Correct 4 ms 212 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 4 ms 212 KB Output is correct
3 Correct 3 ms 212 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
7 Correct 3 ms 212 KB Output is correct
8 Correct 3 ms 212 KB Output is correct
9 Correct 4 ms 212 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
11 Execution timed out 4011 ms 468 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4008 ms 1652 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 4 ms 212 KB Output is correct
3 Correct 3 ms 212 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
7 Correct 3 ms 212 KB Output is correct
8 Correct 3 ms 212 KB Output is correct
9 Correct 4 ms 212 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
11 Execution timed out 4011 ms 468 KB Time limit exceeded
12 Halted 0 ms 0 KB -