Submission #853863

# Submission time Handle Problem Language Result Execution time Memory
853863 2023-09-25T11:02:09 Z laurasofia Mobile (BOI12_mobile) C++14
0 / 100
1000 ms 44496 KB
#include <bits/stdc++.h>
using namespace std;
#define vv vector<lli>
#define vvi vector<vector<int>>
#define vii vector<pr>
#define pr pair<double,double>
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define lli long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define mkp make_pair
#define fast ios::sync_with_stdio(false);cin.tie(0);

map<char,int>c;
string s;
int l,n;
vector<pr > v;

pr g(double r, int x, int y){
    pr res={0,0};
    if (abs(y)>=r)return res;
    r=r*r;
    res.first=x-sqrt(r-(y*y));
    res.second=x+sqrt(r-(y*y));
    return res;
}

bool check(double r){

    
    vector<pr> q(n+1);
    //q[n]=make_pair(0,0);
    q[n]=make_pair(l,l);

    FOR(i,0,n){
        q[i]=g(r,v[i].first, v[i].second);
    }
    sort(q.begin(),q.end());

    double last=0;
    FOR(i,0,n){
        if (q[i].first>last)return false;
        last=max(last, q[i].second);
    }
    return true;
   
}

void fun(){

    double l,m, r;
    l=0;
    r=1000000000;

    FOR(i,0,100){
        m=(l+r)/2;
        if (check(m))r=m;
        else l=m;
    }
    if (check(l))r=l;
    cout<<r<<endl;
}

int main(){ 
    ios::sync_with_stdio(0); cin.tie(0);
  //  freopen("out.txt", "w", stdout);
    cin>>n>>l;
    v=vector<pr>(n);

    FOR(i,0,n)cin>>v[i].first>>v[i].second;
    
    fun();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Incorrect 1 ms 452 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 344 KB Output is correct
2 Incorrect 7 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 856 KB Output is correct
2 Incorrect 13 ms 600 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 600 KB Output is correct
2 Incorrect 13 ms 600 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 656 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 255 ms 3920 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 308 ms 3636 KB Output is correct
2 Correct 295 ms 3408 KB Output is correct
3 Incorrect 324 ms 4020 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 282 ms 3876 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 368 ms 5164 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 410 ms 5088 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1041 ms 19656 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1034 ms 22728 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1036 ms 23512 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1036 ms 26800 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1022 ms 27216 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1040 ms 31612 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1039 ms 31096 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1050 ms 35776 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1048 ms 38480 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1027 ms 44496 KB Time limit exceeded
2 Halted 0 ms 0 KB -