답안 #997842

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
997842 2024-06-13T02:26:14 Z oscarsierra12 구경하기 (JOI13_watching) C++14
50 / 100
1000 ms 4972 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 105;
const int oo = 1e9 + 7;

int dp [N][N][N];
int n;
int a[N];

int go (int i, int s, int l) {
  if (i == n) return 0;
  auto &rf = dp[i][s][l];
  if (rf != -1) return rf;

  rf = oo;
  for (int j = i; j < n; ++j) {
    if (s)
      rf = min(rf, max(go(j + 1, s - 1, l), a[j] - a[i] + 1));
    if (l)
      rf = min(rf, max(go(j + 1, s, l - 1), (a[j] - a[i] + 2) / 2));
  }

  return rf;
}

int main() {

  int p, q; cin >> n >> p >> q; 
  p = min(n,p);
  q = min(n,q);
  for (int i = 0; i < n; ++i) cin >> a[i];
  sort (a, a + n);

  memset(dp, -1, sizeof dp);
  cout << go (0, p, q) << '\n';
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4956 KB Output is correct
2 Correct 1 ms 4956 KB Output is correct
3 Correct 1 ms 4956 KB Output is correct
4 Correct 13 ms 4956 KB Output is correct
5 Correct 13 ms 4952 KB Output is correct
6 Correct 47 ms 4956 KB Output is correct
7 Correct 2 ms 4952 KB Output is correct
8 Correct 4 ms 4956 KB Output is correct
9 Correct 4 ms 4956 KB Output is correct
10 Correct 32 ms 4956 KB Output is correct
11 Correct 22 ms 4952 KB Output is correct
12 Correct 42 ms 4956 KB Output is correct
13 Correct 2 ms 4956 KB Output is correct
14 Correct 2 ms 4972 KB Output is correct
15 Correct 3 ms 4956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1041 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -