Submission #494150

# Submission time Handle Problem Language Result Execution time Memory
494150 2021-12-14T12:54:51 Z PikaQ Mobile (BOI12_mobile) C++17
95 / 100
1000 ms 46072 KB
#include<bits/stdc++.h>
#define int ll
#define forn(i,n) for(int i=0;i<(n);i++)
#define Forn(i,n) for(int i=1;i<=(n);i++)
#define ll long long
#define pb push_back
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define vi vector<int>
#define vl vector<long long>
#define vpi vector<pair<int,int> >
#define pii pair<int,int>
#define pll pair<long long,long long>
#define mp make_pair
#define rz resize
#define all(p) p.begin(),p.end()
#define alr(p,q) p+1,p+q+1
#define ull unsigned long long
#define st0(p) memset((p),0,sizeof(p))
#define T(x) ((x)%2 ? s[(x)/2] : '.')
#define lowb(x) x&-x
#define ls(x) (x)*2
#define rs(x) (x)*2+1
using namespace std;
 
inline void USACO(string filename){
	freopen((filename+".in").c_str(),"r",stdin);
	freopen((filename+".out").c_str(),"w",stdout);
}
 
void debug() {cout << endl;}
template <class T, class ...U> void debug(T a, U ... b) { cout << a << " "; debug(b...);}
// template <class T> int max(T a, T ... b) { cout << a << " "; debug(b...);}
const int INF = 1e9+7;
const double eps = 1e-7;
const int N = 8e2+9;
int n;
 
#define double long double
#define pdd pair<double,double> 
int L;
vector<pdd> p;
 
 
bool check(double R){
	vector<pdd> vs;
	double cur = 0;
	for(auto &i : p){
		double dy = abs(i.S);
		if(dy - R > eps) continue;
		double d = sqrt(R*R - dy*dy);
		double l = i.F -d,r = i.F +d;
		if(l <= cur) cur = max(cur,(double)r);
	}
	
	return cur >= L;
}
 
void solve(){
	cin >> n >> L;
	p.rz(n);
	forn(i,n) cin >> p[i].F >> p[i].S;
	sort(all(p));
	double lo = 0,hi = 1e10;
	while(hi - lo > 1e-4){
		double mid = (lo+hi)/2;
		if(check(mid)) hi = mid;
		else lo = mid;
	}
	// debug(check((double)10));
	cout << hi << '\n';
}		 	
 
 
 
signed main(){
	// USACO("angry");
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
 

		cout << fixed << setprecision(4);
	// int t;
	// cin >> t;
	// while(t--)
	solve();
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 332 KB Output is correct
2 Correct 3 ms 460 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 460 KB Output is correct
2 Correct 5 ms 460 KB Output is correct
3 Correct 4 ms 460 KB Output is correct
4 Correct 4 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 460 KB Output is correct
2 Correct 5 ms 460 KB Output is correct
3 Correct 5 ms 452 KB Output is correct
4 Correct 6 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 460 KB Output is correct
2 Correct 7 ms 460 KB Output is correct
3 Correct 5 ms 460 KB Output is correct
4 Correct 5 ms 460 KB Output is correct
5 Correct 4 ms 452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 2892 KB Output is correct
2 Correct 67 ms 2948 KB Output is correct
3 Correct 50 ms 2108 KB Output is correct
4 Correct 63 ms 2804 KB Output is correct
5 Correct 36 ms 1996 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 63 ms 2892 KB Output is correct
2 Correct 62 ms 2764 KB Output is correct
3 Correct 61 ms 3020 KB Output is correct
4 Correct 62 ms 2924 KB Output is correct
5 Correct 66 ms 3160 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 74 ms 3232 KB Output is correct
2 Correct 77 ms 3040 KB Output is correct
3 Correct 65 ms 3140 KB Output is correct
4 Correct 79 ms 3652 KB Output is correct
5 Correct 67 ms 3300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 99 ms 3580 KB Output is correct
2 Correct 94 ms 4292 KB Output is correct
3 Correct 77 ms 4256 KB Output is correct
4 Correct 86 ms 4340 KB Output is correct
5 Correct 85 ms 4240 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 99 ms 3592 KB Output is correct
2 Correct 90 ms 3592 KB Output is correct
3 Correct 83 ms 3572 KB Output is correct
4 Correct 83 ms 3636 KB Output is correct
5 Correct 74 ms 3584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 410 ms 16384 KB Output is correct
2 Correct 469 ms 17716 KB Output is correct
3 Correct 493 ms 17740 KB Output is correct
4 Correct 420 ms 17668 KB Output is correct
5 Correct 419 ms 17724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 495 ms 16252 KB Output is correct
2 Correct 495 ms 17656 KB Output is correct
3 Correct 405 ms 17728 KB Output is correct
4 Correct 414 ms 17684 KB Output is correct
5 Correct 394 ms 17756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 556 ms 19480 KB Output is correct
2 Correct 559 ms 20800 KB Output is correct
3 Correct 575 ms 20764 KB Output is correct
4 Correct 521 ms 20836 KB Output is correct
5 Correct 513 ms 20804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 612 ms 19488 KB Output is correct
2 Correct 614 ms 20804 KB Output is correct
3 Correct 529 ms 20920 KB Output is correct
4 Correct 522 ms 20768 KB Output is correct
5 Correct 455 ms 20852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 590 ms 22516 KB Output is correct
2 Correct 689 ms 23940 KB Output is correct
3 Correct 654 ms 23964 KB Output is correct
4 Correct 592 ms 23948 KB Output is correct
5 Correct 602 ms 23984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 744 ms 22544 KB Output is correct
2 Correct 723 ms 23932 KB Output is correct
3 Correct 607 ms 24028 KB Output is correct
4 Correct 587 ms 24020 KB Output is correct
5 Correct 547 ms 23932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 668 ms 25744 KB Output is correct
2 Correct 778 ms 25832 KB Output is correct
3 Correct 782 ms 25776 KB Output is correct
4 Correct 706 ms 25768 KB Output is correct
5 Correct 638 ms 25792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 744 ms 25752 KB Output is correct
2 Correct 739 ms 27088 KB Output is correct
3 Correct 671 ms 27140 KB Output is correct
4 Correct 700 ms 27072 KB Output is correct
5 Correct 626 ms 27076 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 870 ms 32108 KB Output is correct
2 Correct 930 ms 32524 KB Output is correct
3 Correct 952 ms 46072 KB Output is correct
4 Correct 910 ms 33220 KB Output is correct
5 Correct 883 ms 45176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 32060 KB Time limit exceeded
2 Halted 0 ms 0 KB -