Submission #220765

# Submission time Handle Problem Language Result Execution time Memory
220765 2020-04-08T18:03:43 Z Toirov_Sadi Triple Jump (JOI19_jumps) C++17
0 / 100
6 ms 384 KB
#include <bits/stdc++.h>

#define FILE
#define fr first
#define se second

using namespace std;

const long long N = 5e5 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;

int n;
int q;
int l;
int r;
long long d[N];
int main()
{
    #ifdef FILE
        freopen("input.txt", "r", stdin);
        /// freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);

    cin >> n;
    for(int i = 1; i <= n; i ++){
        cin >> d[i];
    }
    cin >> q;
    while(q --){
        long long sum = 0;
        cin >> l >> r;
        for(int a = l; a <= r; a ++){
            for(int b = a + 1; b <= r; b ++){
                for(int c = 2 * b - a; c <= r; c ++){
                    sum = max(sum, d[a] + d[b] + d[c]);
                }
            }
        }
        cout << sum << "\n";
    }
}

Compilation message

jumps.cpp: In function 'int main()':
jumps.cpp:21:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
         freopen("input.txt", "r", stdin);
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -