Submission #1118183

#TimeUsernameProblemLanguageResultExecution timeMemory
1118183BananabreadBulldozer (JOI17_bulldozer)C++14
0 / 100
2048 ms2384 KiB
#include<bits/stdc++.h> #define ll long long #define ntr "\n" #define mod (ll)(1e9+7) #define taskname "APPLICATION" #define frep freopen(taskname".inp","r",stdin); freopen(taskname".out","w",stdout); using namespace std; ll a[200001]; ll b[200001]; ll n=2e5,m=10,d; bool check(ll p,vector<ll> &curr){ ll last=-2e16; for(auto j:curr){ ll mn=max(last+d,j-p); if(abs(j-mn)>p) return 0; last=mn; } return 1; } void sub1(){ d*=2; vector<ll> curr,nxt,bs; for(int i=1;i<=n;i++) curr.push_back(2*a[i]); for(int i=0;i<m;i++){ curr.push_back(2*b[i+1]); sort(curr.begin(),curr.end()); ll ans=1e16; ll lo=0,hi=1e16; while(lo<=hi){ ll mid=(lo+hi)/2; if(check(mid,curr)){ hi=mid-1; ans=mid; } else{ lo=mid+1; } } cout<<ans/2; if(ans&1) cout<<".5"; cout<<' '; } } void sub2(){ } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); //frep; cin>>n>>m>>d; for(int i=1;i<=n;i++) cin>>a[i]; for(int i=1;i<=m;i++) cin>>b[i]; sort(a+1,a+n+1); if(n) sub1(); else sub2(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...