# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
888960 |
2023-12-18T13:18:45 Z |
dwuy |
Watching (JOI13_watching) |
C++14 |
|
66 ms |
31912 KB |
/// dwuy: _,\,,,_\,__,\,,_
#include <bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define file(a) freopen(a".inp","r",stdin); freopen(a".out", "w",stdout)
#define fi first
#define se second
#define endl "\n"
#define len(s) int32_t(s.length())
#define MASK(k)(1LL<<(k))
#define TASK ""
#define int long long
using namespace std;
typedef tuple<int, int, int> tpiii;
typedef pair<double, double> pdd;
typedef pair<int, int> pii;
typedef long long ll;
const long long OO = 1e18;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MX = 2005;
int n, p, q;
int a[MX];
int dp[MX][MX];
/// dp[i][j] : least large camera to check a[1, i], used j small camera;
void nhap(){
cin >> n >> p >> q;
for(int i=1; i<=n; i++) cin >> a[i];
if(p+q>=n){
cout << 0;
exit(0);
}
}
bool ok(int mid){
memset(dp, 0x3f, sizeof dp);
memset(dp[0], 0, sizeof dp[0]);
for(int i=1, sm=1, bg=1; i<=n; i++){
while(a[i] - a[sm] + 1 > mid) sm++;
while(a[i] - a[bg] + 1 > mid+mid) bg++;
for(int j=1; j<=p; j++){
dp[i][j] = min({dp[i][j], dp[sm-1][j-1], dp[bg-1][j] + 1});
}
}
return dp[n][p] <= q;
}
void solve(){
int res = 0;
for(int lo=1, hi=1000000000; lo<=hi;){
int mid = (lo+hi)>>1;
if(ok(mid)) res = mid, hi = mid - 1;
else lo = mid + 1;
}
cout << res;
}
int32_t main(){
fastIO;
//file(TASK);
nhap();
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
66 ms |
31912 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
64 ms |
31832 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |