Submission #738453

# Submission time Handle Problem Language Result Execution time Memory
738453 2023-05-08T19:25:48 Z LKR__enjoyer Mobile (BOI12_mobile) C++17
50 / 100
1000 ms 57672 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;
sort(pts.begin(),pts.end());
if(pts[0].f>0)return 0;    
ld maxi=pts[0].s;
for(int i=1;i<pts.size();i++)
{if(pts[i].f>maxi&&pts[i].f>0)return 0; maxi=max(maxi,pts[i].s); if(pts[i].s>=(ld)l)return 1;}
    if(maxi<ld(l))return 0;
return 1;    
}

Compilation message

mobile.cpp: In function 'bool spr(ld)':
mobile.cpp:47:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long double, long double> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 | for(int i=1;i<pts.size();i++)
      |             ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 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 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 468 KB Output is correct
2 Correct 5 ms 544 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 10 ms 692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 724 KB Output is correct
2 Correct 15 ms 752 KB Output is correct
3 Correct 13 ms 724 KB Output is correct
4 Correct 5 ms 724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 724 KB Output is correct
2 Correct 15 ms 752 KB Output is correct
3 Correct 16 ms 724 KB Output is correct
4 Correct 7 ms 724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 756 KB Output is correct
2 Correct 17 ms 816 KB Output is correct
3 Correct 17 ms 724 KB Output is correct
4 Correct 6 ms 692 KB Output is correct
5 Correct 5 ms 696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 154 ms 7368 KB Output is correct
2 Correct 434 ms 7708 KB Output is correct
3 Correct 215 ms 4164 KB Output is correct
4 Correct 103 ms 5208 KB Output is correct
5 Correct 41 ms 2884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 66 ms 5144 KB Output is correct
2 Correct 68 ms 5060 KB Output is correct
3 Correct 76 ms 5064 KB Output is correct
4 Correct 92 ms 5056 KB Output is correct
5 Correct 99 ms 5208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 282 ms 8008 KB Output is correct
2 Correct 467 ms 7936 KB Output is correct
3 Correct 513 ms 7068 KB Output is correct
4 Correct 120 ms 5248 KB Output is correct
5 Correct 78 ms 5220 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 500 ms 8480 KB Output is correct
2 Correct 581 ms 8364 KB Output is correct
3 Correct 641 ms 7568 KB Output is correct
4 Correct 128 ms 5256 KB Output is correct
5 Correct 97 ms 5264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 415 ms 8460 KB Output is correct
2 Correct 545 ms 8352 KB Output is correct
3 Correct 598 ms 7652 KB Output is correct
4 Correct 147 ms 5292 KB Output is correct
5 Correct 100 ms 5264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 36428 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1049 ms 36464 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1076 ms 54588 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1039 ms 54296 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1076 ms 55136 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1076 ms 55048 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 55912 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1075 ms 55936 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1068 ms 57672 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 57396 KB Time limit exceeded
2 Halted 0 ms 0 KB -