Submission #494135

# Submission time Handle Problem Language Result Execution time Memory
494135 2021-12-14T12:42:52 Z PikaQ Mobile (BOI12_mobile) C++17
50 / 100
1000 ms 80984 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;
	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;
		// debug(d,l,r);
		l = max((double)0,l);
		vs.pb({l,r});
	}
	double cur = 0;
	for(auto &i : vs){
		if(i.F <= cur) cur = max(cur,(double)i.S);
	}
	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 = 1e18;
	while(hi - lo > 1e-7){
		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 0 ms 204 KB Output is correct
2 Correct 1 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 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 628 KB Output is correct
2 Correct 11 ms 644 KB Output is correct
3 Correct 6 ms 452 KB Output is correct
4 Correct 11 ms 644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 908 KB Output is correct
2 Correct 20 ms 1284 KB Output is correct
3 Correct 20 ms 1008 KB Output is correct
4 Correct 13 ms 976 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 984 KB Output is correct
2 Correct 20 ms 972 KB Output is correct
3 Correct 15 ms 952 KB Output is correct
4 Correct 12 ms 976 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 1180 KB Output is correct
2 Correct 20 ms 976 KB Output is correct
3 Correct 18 ms 948 KB Output is correct
4 Correct 13 ms 992 KB Output is correct
5 Correct 14 ms 944 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 308 ms 9216 KB Output is correct
2 Correct 369 ms 10420 KB Output is correct
3 Correct 231 ms 6504 KB Output is correct
4 Correct 213 ms 10384 KB Output is correct
5 Correct 154 ms 6020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 290 ms 9412 KB Output is correct
2 Correct 228 ms 9844 KB Output is correct
3 Correct 243 ms 10652 KB Output is correct
4 Correct 235 ms 10700 KB Output is correct
5 Correct 216 ms 11480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 435 ms 10144 KB Output is correct
2 Correct 383 ms 9736 KB Output is correct
3 Correct 291 ms 10772 KB Output is correct
4 Correct 236 ms 12696 KB Output is correct
5 Correct 266 ms 11032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 486 ms 11004 KB Output is correct
2 Correct 482 ms 12180 KB Output is correct
3 Correct 388 ms 11792 KB Output is correct
4 Correct 264 ms 12884 KB Output is correct
5 Correct 272 ms 12032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 512 ms 10808 KB Output is correct
2 Correct 455 ms 12220 KB Output is correct
3 Correct 401 ms 11820 KB Output is correct
4 Correct 253 ms 12872 KB Output is correct
5 Correct 307 ms 12104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 48204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 48192 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1098 ms 68436 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 68424 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 71536 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 71648 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1063 ms 74656 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 74676 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 80912 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1101 ms 80984 KB Time limit exceeded
2 Halted 0 ms 0 KB -