Submission #738451

# Submission time Handle Problem Language Result Execution time Memory
738451 2023-05-08T19:23:46 Z LKR__enjoyer Mobile (BOI12_mobile) C++17
32 / 100
1000 ms 57520 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});
}
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 0 ms 212 KB Output is correct
2 Correct 0 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 Runtime error 1 ms 340 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 468 KB Output is correct
2 Runtime error 4 ms 724 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 724 KB Output is correct
2 Correct 18 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 5 ms 724 KB Output is correct
2 Correct 16 ms 968 KB Output is correct
3 Correct 14 ms 724 KB Output is correct
4 Correct 5 ms 724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 788 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 105 ms 7380 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 74 ms 5056 KB Output is correct
2 Correct 89 ms 5332 KB Output is correct
3 Correct 79 ms 5384 KB Output is correct
4 Correct 90 ms 5304 KB Output is correct
5 Correct 104 ms 5420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 298 ms 7944 KB Output is correct
2 Correct 441 ms 7644 KB Output is correct
3 Correct 541 ms 7140 KB Output is correct
4 Correct 118 ms 5568 KB Output is correct
5 Correct 80 ms 5252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 499 ms 8360 KB Output is correct
2 Correct 561 ms 8488 KB Output is correct
3 Correct 605 ms 7656 KB Output is correct
4 Correct 128 ms 5648 KB Output is correct
5 Correct 103 ms 5424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 416 ms 8348 KB Output is correct
2 Correct 576 ms 8400 KB Output is correct
3 Correct 649 ms 7664 KB Output is correct
4 Correct 121 ms 5468 KB Output is correct
5 Correct 111 ms 5364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 36520 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1074 ms 36276 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 54364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 54420 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1072 ms 55152 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1075 ms 55092 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1075 ms 56032 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1076 ms 55860 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 57520 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 57448 KB Time limit exceeded
2 Halted 0 ms 0 KB -