Submission #242328

#TimeUsernameProblemLanguageResultExecution timeMemory
242328SomeoneUnknownTriple Jump (JOI19_jumps)C++14
0 / 100
44 ms2064 KiB
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    int firm[n];
    for(int i = 0; i < n; ++i){
        scanf("%d", &firm[i]);
    }
    int best[n][n];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            best[i][j] = 0;
            if(j <= i+1){
                continue;
            }
            int base = firm[i]+firm[j];
            for(int k = i+1; k <= (i+j)/2; k++){
                best[i][j] = max(best[i][j], base + firm[k]);
            }
        }
    }
    int q;
    scanf("%d", &q);
    for(int i = 0; i < q; i++){
        int a, c;
        scanf("%d %d", &a, &c);
        printf("%d\n", best[a-1][c-1]);
    }
}

Compilation message (stderr)

jumps.cpp: In function 'int main()':
jumps.cpp:6:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
jumps.cpp:9:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &firm[i]);
         ~~~~~^~~~~~~~~~~~~~~~
jumps.cpp:25:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &q);
     ~~~~~^~~~~~~~~~
jumps.cpp:28:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &a, &c);
         ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...