#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;
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 |
4952 KB |
Output is correct |
2 |
Correct |
1 ms |
4956 KB |
Output is correct |
3 |
Correct |
1 ms |
4800 KB |
Output is correct |
4 |
Runtime error |
5 ms |
9616 KB |
Execution killed with signal 11 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1061 ms |
460 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |