1 solutions
-
0
C++ :
#include<bits/stdc++.h> using namespace std; int y,n,m,a[50005]; int main() { cin>>y>>n>>m; for(int i=1;i<=n;i++)cin>>a[i]; a[n+1]=y; int l=0,r=y+1; while(l+1<r) { int mid=(l+r)/2; int t=0,s=0; for(int i=1;i<=n+1;i++) if(a[i]-a[s]<mid)t++; else s=i; if(t>m)r=mid; else l=mid; } cout<<l; return 0; }
- 1
Information
- ID
- 657
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 10
- Tags
- # Submissions
- 2
- Accepted
- 2
- Uploaded By