답안 #242334

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
242334 2020-06-27T08:57:21 Z SomeoneUnknown 3단 점프 (JOI19_jumps) C++14
5 / 100
4000 ms 13208 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);
        int cbest = 0;
        for(int j = a; j < c; j++){
            for(int k = j+2; k <= c; k++){
                cbest = max(cbest, best[j-1][k-1]);
            }
        }
        printf("%d\n", cbest);
    }
}

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);
         ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Execution timed out 4059 ms 13208 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 38 ms 2040 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Execution timed out 4059 ms 13208 KB Time limit exceeded
12 Halted 0 ms 0 KB -