답안 #1118180

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1118180 2024-11-25T05:04:04 Z Bananabread Bulldozer (JOI17_bulldozer) C++17
0 / 100
2000 ms 2384 KB
#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=-2e18;
    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=1;i<=m;i++) bs.push_back(2*b[i]);
    for(int i=0;i<m;i++){
        merge(curr.begin(),curr.end(),bs.begin()+i,bs.begin()+i+1,back_inserter(nxt));
        curr=nxt;
        nxt={};
        ll ans=1e18;
        ll lo=0,hi=1e18;
        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();
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2047 ms 2384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2047 ms 2384 KB Time limit exceeded
2 Halted 0 ms 0 KB -