Submission #812474

# Submission time Handle Problem Language Result Execution time Memory
812474 2023-08-07T08:54:12 Z vjudge1 Triple Jump (JOI19_jumps) C++17
19 / 100
249 ms 72376 KB
#ifdef Home
#define _GLIBCXX_DEBUG
#endif // Home

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const int N = 5005;


int mx[N][N], arr[N];

main() {
#ifdef Home
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // Home
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;
    for(int i = 1; i <= n; ++ i) {
        cin >> arr[i];
    }
    for(int l = n; l >= 1; -- l) {
        int m = l + 1;
        for(int r = m + 1; r <= n; ++ r) {
            if(m < (l + r) / 2 && arr[m] < arr[(l + r) / 2]) {
                m = (l + r) / 2;
            }
            mx[l][r] = max({mx[l + 1][r], mx[l][r - 1], arr[l] + arr[m] + arr[r]});
        }
    }
    int q, l, r;
    for(cin >> q; q --> 0;) {
        cin >> l >> r;
        cout << mx[l][r] << '\n';
    }
}

Compilation message

jumps.cpp:17:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   17 | main() {
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 724 KB Output is correct
3 Correct 1 ms 724 KB Output is correct
4 Correct 1 ms 724 KB Output is correct
5 Correct 1 ms 724 KB Output is correct
6 Correct 1 ms 724 KB Output is correct
7 Correct 1 ms 724 KB Output is correct
8 Correct 1 ms 724 KB Output is correct
9 Correct 1 ms 724 KB Output is correct
10 Correct 1 ms 724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 724 KB Output is correct
3 Correct 1 ms 724 KB Output is correct
4 Correct 1 ms 724 KB Output is correct
5 Correct 1 ms 724 KB Output is correct
6 Correct 1 ms 724 KB Output is correct
7 Correct 1 ms 724 KB Output is correct
8 Correct 1 ms 724 KB Output is correct
9 Correct 1 ms 724 KB Output is correct
10 Correct 1 ms 724 KB Output is correct
11 Correct 223 ms 72376 KB Output is correct
12 Correct 240 ms 72248 KB Output is correct
13 Correct 228 ms 72344 KB Output is correct
14 Correct 232 ms 72364 KB Output is correct
15 Correct 225 ms 72368 KB Output is correct
16 Correct 230 ms 71716 KB Output is correct
17 Correct 244 ms 71696 KB Output is correct
18 Correct 249 ms 71736 KB Output is correct
19 Correct 235 ms 72276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 17 ms 3528 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 724 KB Output is correct
3 Correct 1 ms 724 KB Output is correct
4 Correct 1 ms 724 KB Output is correct
5 Correct 1 ms 724 KB Output is correct
6 Correct 1 ms 724 KB Output is correct
7 Correct 1 ms 724 KB Output is correct
8 Correct 1 ms 724 KB Output is correct
9 Correct 1 ms 724 KB Output is correct
10 Correct 1 ms 724 KB Output is correct
11 Correct 223 ms 72376 KB Output is correct
12 Correct 240 ms 72248 KB Output is correct
13 Correct 228 ms 72344 KB Output is correct
14 Correct 232 ms 72364 KB Output is correct
15 Correct 225 ms 72368 KB Output is correct
16 Correct 230 ms 71716 KB Output is correct
17 Correct 244 ms 71696 KB Output is correct
18 Correct 249 ms 71736 KB Output is correct
19 Correct 235 ms 72276 KB Output is correct
20 Runtime error 17 ms 3528 KB Execution killed with signal 11
21 Halted 0 ms 0 KB -