Submission #459571

# Submission time Handle Problem Language Result Execution time Memory
459571 2021-08-08T16:45:20 Z BackNoob Mobile (BOI12_mobile) C++14
50 / 100
1000 ms 8104 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;
	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 1 ms 204 KB Output is correct
2 Correct 0 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 4 ms 332 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 356 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 11 ms 356 KB Output is correct
4 Correct 6 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 360 KB Output is correct
2 Correct 13 ms 356 KB Output is correct
3 Correct 10 ms 332 KB Output is correct
4 Correct 6 ms 332 KB Output is correct
5 Correct 7 ms 360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 147 ms 896 KB Output is correct
2 Correct 182 ms 912 KB Output is correct
3 Correct 109 ms 716 KB Output is correct
4 Correct 80 ms 896 KB Output is correct
5 Correct 60 ms 588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 90 ms 820 KB Output is correct
2 Correct 80 ms 812 KB Output is correct
3 Correct 97 ms 1044 KB Output is correct
4 Correct 83 ms 844 KB Output is correct
5 Correct 86 ms 964 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 222 ms 908 KB Output is correct
2 Correct 211 ms 948 KB Output is correct
3 Correct 164 ms 964 KB Output is correct
4 Correct 107 ms 1076 KB Output is correct
5 Correct 101 ms 976 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 240 ms 1080 KB Output is correct
2 Correct 238 ms 972 KB Output is correct
3 Correct 203 ms 972 KB Output is correct
4 Correct 97 ms 1052 KB Output is correct
5 Correct 108 ms 984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 251 ms 1076 KB Output is correct
2 Correct 240 ms 1084 KB Output is correct
3 Correct 190 ms 1100 KB Output is correct
4 Correct 97 ms 972 KB Output is correct
5 Correct 121 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 4208 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 4104 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1045 ms 4936 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 4932 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1076 ms 5652 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1074 ms 5688 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 6512 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1098 ms 6452 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 8004 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1096 ms 8104 KB Time limit exceeded
2 Halted 0 ms 0 KB -