답안 #879227

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
879227 2023-11-27T00:56:26 Z 12345678 3단 점프 (JOI19_jumps) C++17
5 / 100
21 ms 34396 KB
#include <bits/stdc++.h>

using namespace std;

const int nx=2e3+5;
int n, a[nx], mx[nx][nx], dp[nx][nx], q, l, r;

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n;
    for (int i=1; i<=n; i++) cin>>a[i], mx[i][i]=a[i];
    for (int i=1; i<=n; i++) for (int j=i+1; j<=n; j++) mx[i][j]=max(mx[i][j-1], a[j]);
    for (int k=2; k<=n; k++) for (int i=1; i<=n; i++) dp[i][i+k]=max({dp[i][i+k-1], dp[i+1][i+k], a[i]+a[i+k]+mx[i+1][(i+i+k)/2]});
    cin>>q;
    while (q--) cin>>l>>r, cout<<dp[l][r]<<'\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2908 KB Output is correct
3 Correct 1 ms 2908 KB Output is correct
4 Correct 1 ms 2908 KB Output is correct
5 Correct 1 ms 2908 KB Output is correct
6 Correct 1 ms 2776 KB Output is correct
7 Correct 1 ms 2908 KB Output is correct
8 Correct 1 ms 2908 KB Output is correct
9 Correct 1 ms 2772 KB Output is correct
10 Correct 1 ms 2908 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2908 KB Output is correct
3 Correct 1 ms 2908 KB Output is correct
4 Correct 1 ms 2908 KB Output is correct
5 Correct 1 ms 2908 KB Output is correct
6 Correct 1 ms 2776 KB Output is correct
7 Correct 1 ms 2908 KB Output is correct
8 Correct 1 ms 2908 KB Output is correct
9 Correct 1 ms 2772 KB Output is correct
10 Correct 1 ms 2908 KB Output is correct
11 Runtime error 19 ms 34396 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 21 ms 34392 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2908 KB Output is correct
3 Correct 1 ms 2908 KB Output is correct
4 Correct 1 ms 2908 KB Output is correct
5 Correct 1 ms 2908 KB Output is correct
6 Correct 1 ms 2776 KB Output is correct
7 Correct 1 ms 2908 KB Output is correct
8 Correct 1 ms 2908 KB Output is correct
9 Correct 1 ms 2772 KB Output is correct
10 Correct 1 ms 2908 KB Output is correct
11 Runtime error 19 ms 34396 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -