답안 #1118184

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1118184 2024-11-25T05:07:31 Z Bananabread Measures (CEOI22_measures) C++17
24 / 100
331 ms 8448 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=-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();
}
# 결과 실행 시간 메모리 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 2560 KB Output is correct
5 Correct 3 ms 2552 KB Output is correct
6 Correct 3 ms 2384 KB Output is correct
7 Correct 3 ms 2384 KB Output is correct
8 Correct 5 ms 2384 KB Output is correct
# 결과 실행 시간 메모리 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 2560 KB Output is correct
5 Correct 3 ms 2552 KB Output is correct
6 Correct 3 ms 2384 KB Output is correct
7 Correct 3 ms 2384 KB Output is correct
8 Correct 5 ms 2384 KB Output is correct
9 Correct 288 ms 8388 KB Output is correct
10 Correct 327 ms 8396 KB Output is correct
11 Correct 214 ms 8380 KB Output is correct
12 Correct 331 ms 8388 KB Output is correct
13 Correct 215 ms 7880 KB Output is correct
14 Correct 263 ms 8448 KB Output is correct
15 Correct 263 ms 7364 KB Output is correct
16 Correct 220 ms 8396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 14 ms 2640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 14 ms 2640 KB Output isn't correct
2 Halted 0 ms 0 KB -