Submission #459570

# Submission time Handle Problem Language Result Execution time Memory
459570 2021-08-08T16:44:47 Z BackNoob Mobile (BOI12_mobile) C++14
50 / 100
251 ms 3912 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 = 220797 + 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;
	vector<pair<ld , ld>> seg;
	for(int i = 1 ; i <= n ; i++) {
		ld h = abs(a[i].y);
		if(h > x) continue;
		if(h == x) seg.push_back({a[i].x , a[i].x});
		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 <= 100 ; 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 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 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 340 KB Output is correct
2 Correct 7 ms 332 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Correct 6 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 332 KB Output is correct
2 Correct 13 ms 332 KB Output is correct
3 Correct 10 ms 332 KB Output is correct
4 Correct 6 ms 360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 332 KB Output is correct
2 Correct 13 ms 360 KB Output is correct
3 Correct 10 ms 360 KB Output is correct
4 Correct 6 ms 356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 332 KB Output is correct
2 Correct 12 ms 356 KB Output is correct
3 Correct 10 ms 360 KB Output is correct
4 Correct 6 ms 332 KB Output is correct
5 Correct 7 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 147 ms 892 KB Output is correct
2 Correct 187 ms 900 KB Output is correct
3 Correct 106 ms 1344 KB Output is correct
4 Correct 79 ms 2008 KB Output is correct
5 Correct 60 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 94 ms 844 KB Output is correct
2 Correct 80 ms 852 KB Output is correct
3 Correct 87 ms 928 KB Output is correct
4 Correct 85 ms 916 KB Output is correct
5 Correct 85 ms 972 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 221 ms 1044 KB Output is correct
2 Correct 198 ms 2116 KB Output is correct
3 Correct 165 ms 1940 KB Output is correct
4 Correct 94 ms 3012 KB Output is correct
5 Correct 110 ms 2040 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 242 ms 1024 KB Output is correct
2 Correct 244 ms 2492 KB Output is correct
3 Correct 199 ms 2080 KB Output is correct
4 Correct 96 ms 3020 KB Output is correct
5 Correct 109 ms 2336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 251 ms 1068 KB Output is correct
2 Correct 245 ms 2492 KB Output is correct
3 Correct 192 ms 2116 KB Output is correct
4 Correct 97 ms 3012 KB Output is correct
5 Correct 107 ms 2252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 40 ms 3856 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 55 ms 3896 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 40 ms 3912 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 55 ms 3872 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 39 ms 3888 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 59 ms 3860 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 41 ms 3872 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 58 ms 3824 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 40 ms 3820 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 54 ms 3856 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -