当前位置:网站首页>[Niuke] [noip2015] jumping stone
[Niuke] [noip2015] jumping stone
2022-07-07 01:05:00 【*DDL_ GzmBlog】
Preface
t a g : tag : tag: Two points Two points answer
The question :
Ideas :
Because what the title asks is Shortest maximum , A very standard two-point inquiry method
So we can consider Two point shortest distance , So how do we check Well
It's simple , Obviously, what needs to be judged now x, If the difference between two stones is less than x When , We must remove it
So we just need to judge the quantity and m The relationship between
Of course, we can move the state through last To transfer
code :
int L,n,m;
int a[N];
int i,j;
int b[N];
bool check(int x){
int cnt = 0;
int last = 0 ;
Fup(i,1,n+1){
if(a[i] - last < x) cnt++;
else last = a[i];
if(cnt > m) return false;
}
return true;
}
void solve(){
// cin>>L>>N>>M;
cin>>L>>n>>m;
Fup(i,1,n) cin>>a[i];
a[n+1] = L;
int l = 0 , r = L;
//cout<<ans<<endl;
while(l<=r){
int mid = (l+r)>>1;
if(check(mid)){
l = mid+1;
}
else r = mid - 1;
}
cout<<((l+r)>>1)<<endl;
}
signed main(){
//int t;cin>>t;while(t--)
solve();
return 0 ;
}
边栏推荐
- C9高校,博士生一作发Nature!
- 腾讯云 WebShell 体验
- pyflink的安装和测试
- Make a simple graphical interface with Tkinter
- [force buckle]41 Missing first positive number
- Telerik UI 2022 R2 SP1 Retail-Not Crack
- A brief history of deep learning (II)
- Learning notes 5: ram and ROM
- Tencent cloud webshell experience
- How to get started and improve test development?
猜你喜欢

C9高校,博士生一作发Nature!

Dell笔记本周期性闪屏故障

Windows installation mysql8 (5 minutes)

筑梦数字时代,城链科技战略峰会西安站顺利落幕

ActiveReportsJS 3.1中文版|||ActiveReportsJS 3.1英文版

Dr selection of OSPF configuration for Huawei devices
Summary of being a microservice R & D Engineer in the past year

Chapter II proxy and cookies of urllib Library

JS+SVG爱心扩散动画js特效

Building a dream in the digital era, the Xi'an station of the city chain science and Technology Strategy Summit ended smoothly
随机推荐
Data sharing of the 835 postgraduate entrance examination of software engineering in Hainan University in 23
【JokerのZYNQ7020】AXI_ EMC。
【批處理DOS-CMD命令-匯總和小結】-字符串搜索、查找、篩選命令(find、findstr),Find和findstr的區別和辨析
线段树(SegmentTree)
迈动互联中标北京人寿保险,助推客户提升品牌价值
[user defined type] structure, union, enumeration
. Bytecode structure of class file
什么是时间
[batch dos-cmd command - summary and summary] - view or modify file attributes (attrib), view and modify file association types (Assoc, ftype)
mongodb客户端操作(MongoRepository)
Js+svg love diffusion animation JS special effects
C9高校,博士生一作发Nature!
JS+SVG爱心扩散动画js特效
Set (generic & list & Set & custom sort)
[C language] dynamic address book
What kind of experience is it to realize real-time collaboration in jupyter
Installation and testing of pyflink
Batch obtain the latitude coordinates of all administrative regions in China (to the county level)
STM32开发资料链接分享
筑梦数字时代,城链科技战略峰会西安站顺利落幕