Submission #1010567

# Submission time Handle Problem Language Result Execution time Memory
1010567 2024-06-29T08:08:51 Z danikoynov Triple Jump (JOI19_jumps) C++14
0 / 100
2 ms 348 KB
#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, mx = 0;
    for (int i = l; i <= r; i ++)
        mx = std::max(mx, a[i]);

    for (int i = l; i <= r; i ++)
        for (int f = i + 1; f <= r; f ++)
            for (int j = f + (f - i); j <= r; j ++)
            {
                if (a[i] != mx && a[f] != mx && a[j] != mx)
                    continue;
                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 time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 2 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 2 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 2 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -