Submission #459573

# Submission time Handle Problem Language Result Execution time Memory
459573 2021-08-08T16:47:13 Z BackNoob Mobile (BOI12_mobile) C++14
100 / 100
754 ms 27480 KB
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define endl '\n'
#define mask(i) (1LL << (i))
#define task "name"
#define ld long double
#define ull unsigned long long
using namespace std;
const ll mxN = 1e6 + 7;
const ll inf = 1e9 + 277;
const ll mod = 2147483648;
const ll infll = 1e18 + 7;
const ll base = 307;
 
template <typename T1, typename T2> bool minimize(T1 &a, T2 b) {
	if (a > b) {a = b; return true;} return false;
}
template <typename T1, typename T2> bool maximize(T1 &a, T2 b) {
	if (a < b) {a = b; return true;} return false;
}
 
struct Point{
	int x , y;
} a[mxN];
 
int n , L;
 
bool ok(ld x)
{
	ld minl = 0;
	for(int i = 1 ; i <= n ; i++) {
		ld h = abs(a[i].y);
		if(h > x) continue;
		if(h <= x) {
			ld leng = sqrt(x * x - h * h);
			ld l = a[i].x - leng;
			ld r = a[i].x + leng;
			if(l <= minl) minl = max(minl , r);
		}
	}
	return minl >= L;
	
}
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   //	freopen("task.inp" , "r" , stdin);
   // freopen("task.out" , "w" , stdout);
 
   	cin >> n >> L;
 
   	for(int i = 1 ; i <= n ; i++) cin >> a[i].x >> a[i].y;
 
   	ld l = 0 , r = 1.5e9;
   	for(int i = 1 ; i <= 50 ; i++) {
   		ld mid = (l + r) / 2;
 
   		if(ok(mid)) r = mid;
   		else l = mid; 
   	}
 
   	cout << fixed << setprecision(6) << l;
    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 0 ms 204 KB Output is correct
4 Correct 0 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 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 3 ms 332 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 3 ms 332 KB Output is correct
2 Correct 4 ms 332 KB Output is correct
3 Correct 4 ms 332 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 356 KB Output is correct
2 Correct 4 ms 332 KB Output is correct
3 Correct 4 ms 332 KB Output is correct
4 Correct 3 ms 328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 244 KB Output is correct
2 Correct 4 ms 320 KB Output is correct
3 Correct 4 ms 332 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
5 Correct 3 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 784 KB Output is correct
2 Correct 58 ms 888 KB Output is correct
3 Correct 35 ms 708 KB Output is correct
4 Correct 36 ms 808 KB Output is correct
5 Correct 26 ms 716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 912 KB Output is correct
2 Correct 36 ms 844 KB Output is correct
3 Correct 41 ms 844 KB Output is correct
4 Correct 37 ms 924 KB Output is correct
5 Correct 43 ms 1072 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 63 ms 972 KB Output is correct
2 Correct 70 ms 844 KB Output is correct
3 Correct 55 ms 916 KB Output is correct
4 Correct 44 ms 972 KB Output is correct
5 Correct 50 ms 984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 78 ms 996 KB Output is correct
2 Correct 76 ms 1084 KB Output is correct
3 Correct 65 ms 1100 KB Output is correct
4 Correct 44 ms 1268 KB Output is correct
5 Correct 55 ms 1016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 78 ms 1088 KB Output is correct
2 Correct 76 ms 1228 KB Output is correct
3 Correct 64 ms 992 KB Output is correct
4 Correct 44 ms 1088 KB Output is correct
5 Correct 48 ms 1060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 363 ms 4304 KB Output is correct
2 Correct 368 ms 11824 KB Output is correct
3 Correct 373 ms 11588 KB Output is correct
4 Correct 245 ms 13788 KB Output is correct
5 Correct 248 ms 10948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 389 ms 4216 KB Output is correct
2 Correct 398 ms 10948 KB Output is correct
3 Correct 356 ms 9968 KB Output is correct
4 Correct 229 ms 13436 KB Output is correct
5 Correct 241 ms 11576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 492 ms 4932 KB Output is correct
2 Correct 474 ms 14288 KB Output is correct
3 Correct 448 ms 13704 KB Output is correct
4 Correct 264 ms 16836 KB Output is correct
5 Correct 302 ms 12992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 479 ms 5084 KB Output is correct
2 Correct 465 ms 12936 KB Output is correct
3 Correct 410 ms 11876 KB Output is correct
4 Correct 283 ms 16708 KB Output is correct
5 Correct 279 ms 13728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 505 ms 5780 KB Output is correct
2 Correct 524 ms 16640 KB Output is correct
3 Correct 529 ms 15952 KB Output is correct
4 Correct 325 ms 19300 KB Output is correct
5 Correct 362 ms 14824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 540 ms 5780 KB Output is correct
2 Correct 538 ms 15036 KB Output is correct
3 Correct 445 ms 14176 KB Output is correct
4 Correct 308 ms 19172 KB Output is correct
5 Correct 326 ms 15928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 580 ms 6560 KB Output is correct
2 Correct 599 ms 18976 KB Output is correct
3 Correct 593 ms 18196 KB Output is correct
4 Correct 345 ms 22256 KB Output is correct
5 Correct 392 ms 17728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 604 ms 6572 KB Output is correct
2 Correct 586 ms 17220 KB Output is correct
3 Correct 557 ms 15988 KB Output is correct
4 Correct 351 ms 21932 KB Output is correct
5 Correct 371 ms 18088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 736 ms 8124 KB Output is correct
2 Correct 754 ms 23744 KB Output is correct
3 Correct 747 ms 22696 KB Output is correct
4 Correct 452 ms 27280 KB Output is correct
5 Correct 500 ms 21668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 750 ms 8124 KB Output is correct
2 Correct 720 ms 21400 KB Output is correct
3 Correct 657 ms 20428 KB Output is correct
4 Correct 449 ms 27480 KB Output is correct
5 Correct 461 ms 22884 KB Output is correct