답안 #946226

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
946226 2024-03-14T12:27:55 Z Ahmed57 Measures (CEOI22_measures) C++17
0 / 100
1500 ms 748 KB
#include "bits/stdc++.h"
using namespace std;
 
signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    int n,m;
    long long d;
    cin>>n>>m>>d;
    std::multiset<long long> v;
    for(int i = 0;i<n;i++){
        long long x;cin>>x;
        v.insert(x);
    }
    for(int i = 0;i<m;i++){
        long long x;cin>>x;
        v.insert(x);
        if(v.size()==1){
            cout<<0<<" ";
            continue;
        }
        long long l = 0 , r = 1e9 , ans = 0;
        while(l<=r){
            long long mid = (l+r)/2; 
            long long la = -1e18;
            bool ss = 1;
            for(auto e:v){
                long long cur = max(la+d,e-mid);
                if(abs(cur-e)>mid){
                    ss = 0;
                    break;
                }
                la = cur;
            }
            if(ss){
                ans = mid;
                r = mid-1;
            }else l = mid+1;
        }
        if(ans==0){
            cout<<0<<" ";
            continue;
        }
        bool ss = 1;
        long double la = -100000000000.0 , an = ans , dd = d;
        for(auto e:v){
            long double na = e;
            long double cur = max(la+dd,na-an+0.5);
            if(abs(cur-na)>an){
                ss = 0;
                break;
            }
            la = cur;
        }
        if(ss)cout<<ans-1<<".5 ";
        else cout<<ans<<endl;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 344 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 600 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 4 ms 348 KB Output is correct
8 Incorrect 1 ms 348 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 344 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 600 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 4 ms 348 KB Output is correct
8 Incorrect 1 ms 348 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1544 ms 748 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1544 ms 748 KB Time limit exceeded
2 Halted 0 ms 0 KB -