답안 #1118164

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1118164 2024-11-25T04:44:03 Z Pannda Measures (CEOI22_measures) C++17
0 / 100
13 ms 2640 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=-1e9;
    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);

    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 Correct 3 ms 2384 KB Output is correct
2 Correct 3 ms 2384 KB Output is correct
3 Correct 3 ms 2384 KB Output is correct
4 Correct 3 ms 2384 KB Output is correct
5 Correct 3 ms 2596 KB Output is correct
6 Correct 2 ms 2384 KB Output is correct
7 Correct 3 ms 2384 KB Output is correct
8 Incorrect 3 ms 2384 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 2384 KB Output is correct
2 Correct 3 ms 2384 KB Output is correct
3 Correct 3 ms 2384 KB Output is correct
4 Correct 3 ms 2384 KB Output is correct
5 Correct 3 ms 2596 KB Output is correct
6 Correct 2 ms 2384 KB Output is correct
7 Correct 3 ms 2384 KB Output is correct
8 Incorrect 3 ms 2384 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 2640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 2640 KB Output isn't correct
2 Halted 0 ms 0 KB -