Submission #997841

#TimeUsernameProblemLanguageResultExecution timeMemory
997841oscarsierra12Watching (JOI13_watching)C++14
0 / 100
1061 ms9616 KiB
#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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...