Submission #738451

#TimeUsernameProblemLanguageResultExecution timeMemory
738451LKR__enjoyerMobile (BOI12_mobile)C++17
32 / 100
1090 ms57520 KiB
#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}); } 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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...