Submission #738444

# Submission time Handle Problem Language Result Execution time Memory
738444 2023-05-08T19:00:57 Z LKR__enjoyer Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 57444 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)
{
    for(int i=0;i<60;i++)
    {
        ld mid=lo+(hi-lo)/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(y>rad)continue; 
    ld x1=x-sqrt(rad*rad-y*y),x2=x+sqrt(rad*rad-y*y); 
    pts.pb({x1,x2});
}
sort(pts.begin(),pts.end());
if(pts[0].f>0||pts[pts.size()-1].s<(ld)l)return 0;    
for(int i=1;i<pts.size();i++)
{if(pts[i].f>pts[i-1].s)return 0; if(pts[i].s>=(ld)l)break;}
    
return 1;    
}

Compilation message

mobile.cpp: In function 'bool spr(ld)':
mobile.cpp:44: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]
   44 | for(int i=1;i<pts.size();i++)
      |             ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 532 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 38 ms 724 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 724 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 788 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 103 ms 7412 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 602 ms 5124 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 562 ms 7992 KB Output is correct
2 Correct 753 ms 7728 KB Output is correct
3 Execution timed out 1080 ms 7776 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 722 ms 8372 KB Output is correct
2 Correct 948 ms 8620 KB Output is correct
3 Execution timed out 1075 ms 8360 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 635 ms 8380 KB Output is correct
2 Correct 953 ms 8444 KB Output is correct
3 Execution timed out 1084 ms 8492 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 36368 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1074 ms 36620 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1076 ms 54380 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1072 ms 54260 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1074 ms 55072 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 55128 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1062 ms 55960 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 55792 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1070 ms 57444 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 57324 KB Time limit exceeded
2 Halted 0 ms 0 KB -