Submission #738460

# Submission time Handle Problem Language Result Execution time Memory
738460 2023-05-08T19:38:03 Z LKR__enjoyer Mobile (BOI12_mobile) C++17
50 / 100
1000 ms 57748 KB
#include <iostream>
#include<bits/stdc++.h>
#define pb push_back
#define f first
#define s second
typedef long long ll;
typedef long double ld;
using namespace std;
int n,l;
vector<pair<int,int>> pkt;
bool spr(long double rad);
long double bin(ld lo,ld hi)
{
    while(hi-lo>1e-3)
    {
        ld mid=(lo+hi)/2; 
        if(spr(mid))hi=mid; else lo=mid;
    }
    return lo;
}

int main()
{ 
    cin>>n>>l;
    for(int i=0;i<n;i++)
    {int a,b; cin>>a>>b;
    pkt.pb({a,b});    
    }
    cout<<fixed<<setprecision(4)<<bin(0,(ld)(2*l));
    
    return 0;
}
bool spr(ld rad){
vector<pair<ld,ld>> pts={};
for(auto p : pkt)
{
    ld x=(ld)p.f,y=(ld)p.s;
    if(rad<abs(y))continue; 
    ld del=(ld)sqrt(rad*rad-y*y);
    ld x1=x-del,x2=x+del; 
    pts.pb({x1,x2});
}
if(pts.empty())return 0;
ld curr_min=1.5e9+1,curr_max=-1.5e9-1;
for(auto i : pts)
{ ld a=i.f,b=i.s; if(b<0)continue; 
if(curr_min==1.5e9+1&&curr_max==-1.5e9-1){curr_min=a; curr_max=b; continue;}
if(a<=curr_max)curr_max=max(curr_max,b);
if(b>=curr_min)curr_min=min(curr_min,a);
}
if(curr_min>0||curr_max<(ld)l)return 0;
return 1;    
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 468 KB Output is correct
2 Correct 4 ms 564 KB Output is correct
3 Correct 3 ms 440 KB Output is correct
4 Correct 5 ms 568 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 724 KB Output is correct
2 Correct 10 ms 824 KB Output is correct
3 Correct 6 ms 692 KB Output is correct
4 Correct 4 ms 724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 724 KB Output is correct
2 Correct 10 ms 944 KB Output is correct
3 Correct 4 ms 724 KB Output is correct
4 Correct 4 ms 724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 796 KB Output is correct
2 Correct 11 ms 820 KB Output is correct
3 Correct 4 ms 724 KB Output is correct
4 Correct 4 ms 724 KB Output is correct
5 Correct 4 ms 724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 99 ms 7628 KB Output is correct
2 Correct 164 ms 7976 KB Output is correct
3 Correct 78 ms 4384 KB Output is correct
4 Correct 61 ms 5296 KB Output is correct
5 Correct 28 ms 3104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 49 ms 5380 KB Output is correct
2 Correct 52 ms 5488 KB Output is correct
3 Correct 65 ms 5508 KB Output is correct
4 Correct 72 ms 5452 KB Output is correct
5 Correct 75 ms 5564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 150 ms 8364 KB Output is correct
2 Correct 220 ms 8024 KB Output is correct
3 Correct 87 ms 7360 KB Output is correct
4 Correct 92 ms 5500 KB Output is correct
5 Correct 56 ms 5484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 280 ms 8716 KB Output is correct
2 Correct 214 ms 8656 KB Output is correct
3 Correct 152 ms 7876 KB Output is correct
4 Correct 99 ms 5568 KB Output is correct
5 Correct 69 ms 5544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 229 ms 8688 KB Output is correct
2 Correct 222 ms 8700 KB Output is correct
3 Correct 135 ms 7880 KB Output is correct
4 Correct 124 ms 5560 KB Output is correct
5 Correct 75 ms 5476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1022 ms 36780 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1054 ms 36760 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1063 ms 54728 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 54708 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1059 ms 55368 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1029 ms 55416 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 56452 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1054 ms 56140 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1047 ms 57748 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 57508 KB Time limit exceeded
2 Halted 0 ms 0 KB -