版本比较
写代码
正文
增加 8 行删除 8 行
11234511 行未改动1718192021212223242525262728295 行未改动3536373839394041424343444546474849505151525354554 行未改动6061626364646566666768``` ```#include<bits/stdc++.h>using namespace std;struct aaa{ int x,y;11 行未改动 q.push({a[i].y,a[i].x}); p.push({a[i].y,a[i].x}); } if(!q.empty()){ if(abs(q.top().first-p.top().first)>=k){ if(abs(q.top().first-p.top().first)>=k){ return 1; } }
for(;i<n;i++){ q.push({a[i].y,a[i].x}); while(q.top().second<a[i].x-x){// cout<<q.top().second<<endl;5 行未改动 p.pop(); }// cout<<q.top().first<<endl; if(abs(q.top().first-p.top().first)>=k){
return 1; } } return 0; return 0;}
int main(){ ios::sync_with_stdio(0); cin.tie(0); cin>>n>>k; for(int i=0;i<n;i++){ cin>>a[i].x>>a[i].y; cin>>a[i].x>>a[i].y; } sort(a,a+n,cmp); int l=0,r=1e9+10; while(l<r-1){4 行未改动 }else{ l=mid; } } if(r==1e9+10) cout<<-1; if(r==1e9+10) cout<<-1; else cout<<r<<endl;
return 0;}