#include <bits/stdc++.h>
using namespace std;
int main() {
int N, P, Q;
cin >> N >> P >> Q;
vector<int> lanes(N);
for (int i = 0; i < N; ++i) {
cin >> lanes[i];
}
sort(lanes.begin(), lanes.end());
int min_k = lanes[N - 1] - lanes[0] + 1;
for (int k = 1; k <= lanes[N - 1] - lanes[0] + 1; ++k) {
int used_P = 0; // Number of small detectors used
int used_Q = 0; // Number of large detectors used
int start = lanes[0];
for (int i = 0; i < N; ++i) {
if (lanes[i] > start + k - 1) {
if (lanes[i] - start <= 2 * k - 1) {
used_P++;
} else {
used_Q++;
}
start = lanes[i] + 1;
}
}
if (used_P <= P && used_Q <= Q) {
min_k = min(min_k, k);
}
}
cout << min_k << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1014 ms |
344 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1027 ms |
344 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |