Submission #242328

# Submission time Handle Problem Language Result Execution time Memory
242328 2020-06-27T08:55:08 Z SomeoneUnknown Triple Jump (JOI19_jumps) C++14
0 / 100
44 ms 2064 KB
#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

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 time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 44 ms 2064 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -