답안 #199364

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
199364 2020-01-31T16:38:49 Z houtaru 3단 점프 (JOI19_jumps) C++17
19 / 100
1356 ms 77380 KB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int n, q;
int a[5010];
int f[5010][5010];

int main() {
  ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  
  for (int i = n - 1; i >= 0; --i) {
    int cur = 0, mx = 0;
    for (int j = i + 2; j < n; ++j) {
      mx = max(mx, a[(i + j) / 2]);
      f[i][j] = max({a[i] + a[j] + mx, f[i + 1][j], f[i][j - 1]});
    }
  }

  cin >> q;
  while (q--) {
    int l, r; cin >> l >> r;
    cout << f[l - 1][r - 1] << "\n";
  }
  
  return 0;
}

Compilation message

jumps.cpp: In function 'int main()':
jumps.cpp:17:9: warning: unused variable 'cur' [-Wunused-variable]
     int cur = 0, mx = 0;
         ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 6 ms 760 KB Output is correct
3 Correct 6 ms 760 KB Output is correct
4 Correct 6 ms 760 KB Output is correct
5 Correct 6 ms 764 KB Output is correct
6 Correct 6 ms 764 KB Output is correct
7 Correct 5 ms 760 KB Output is correct
8 Correct 6 ms 760 KB Output is correct
9 Correct 5 ms 760 KB Output is correct
10 Correct 5 ms 760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 6 ms 760 KB Output is correct
3 Correct 6 ms 760 KB Output is correct
4 Correct 6 ms 760 KB Output is correct
5 Correct 6 ms 764 KB Output is correct
6 Correct 6 ms 764 KB Output is correct
7 Correct 5 ms 760 KB Output is correct
8 Correct 6 ms 760 KB Output is correct
9 Correct 5 ms 760 KB Output is correct
10 Correct 5 ms 760 KB Output is correct
11 Correct 736 ms 77380 KB Output is correct
12 Correct 407 ms 77304 KB Output is correct
13 Correct 423 ms 77036 KB Output is correct
14 Correct 412 ms 77304 KB Output is correct
15 Correct 1345 ms 77048 KB Output is correct
16 Correct 1035 ms 76408 KB Output is correct
17 Correct 868 ms 76408 KB Output is correct
18 Correct 1356 ms 76408 KB Output is correct
19 Correct 497 ms 76920 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 187 ms 760 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 376 KB Output is correct
2 Correct 6 ms 760 KB Output is correct
3 Correct 6 ms 760 KB Output is correct
4 Correct 6 ms 760 KB Output is correct
5 Correct 6 ms 764 KB Output is correct
6 Correct 6 ms 764 KB Output is correct
7 Correct 5 ms 760 KB Output is correct
8 Correct 6 ms 760 KB Output is correct
9 Correct 5 ms 760 KB Output is correct
10 Correct 5 ms 760 KB Output is correct
11 Correct 736 ms 77380 KB Output is correct
12 Correct 407 ms 77304 KB Output is correct
13 Correct 423 ms 77036 KB Output is correct
14 Correct 412 ms 77304 KB Output is correct
15 Correct 1345 ms 77048 KB Output is correct
16 Correct 1035 ms 76408 KB Output is correct
17 Correct 868 ms 76408 KB Output is correct
18 Correct 1356 ms 76408 KB Output is correct
19 Correct 497 ms 76920 KB Output is correct
20 Runtime error 187 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Halted 0 ms 0 KB -