Submission #946178

# Submission time Handle Problem Language Result Execution time Memory
946178 2024-03-14T11:43:27 Z Ahmed57 Measures (CEOI22_measures) C++17
0 / 100
1500 ms 464 KB
#include "bits/stdc++.h"
using namespace std;

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    int n,m,d;
    cin>>n>>m>>d;
    std::vector<double> v;
    for(int i = 0;i<n;i++){
        double x;cin>>x;
        v.push_back(x);
    }
    for(int i = 0;i<m;i++){
        double x;cin>>x;
        v.push_back(x);
        sort(v.begin(),v.end());
        if(v.size()==1){
            cout<<0<<" ";
            continue;
        }
        long double l = 0.0 , r = 1000000000000.0;
        long double la = -1000000000000.0;
        long double ans = 0;
        for(int j = 0;j<1000;j++){
            long double mid = (l+r)/2;
            long double la = -10000000.0;
            long double ss = 1;
            for(auto e:v){
                long double cur = max(la+d,e-mid);
                if(abs(cur-e)>mid){
                    ss = 0;
                    break;
                }
                la = cur;
            }
            if(ss){
                ans = mid;
                r = mid;
            }else l = mid;
        }
        cout<<ans<<" ";
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:22:21: warning: unused variable 'la' [-Wunused-variable]
   22 |         long double la = -1000000000000.0;
      |                     ^~
# Verdict Execution time Memory Grader output
1 Incorrect 107 ms 464 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 107 ms 464 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1517 ms 436 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1517 ms 436 KB Time limit exceeded
2 Halted 0 ms 0 KB -