Submission #1013728

# Submission time Handle Problem Language Result Execution time Memory
1013728 2024-07-04T04:29:09 Z nrg_studio Mobile (BOI12_mobile) C++17
0 / 100
883 ms 48244 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define pb push_back
#define FOR(i, a, b, s) for (int i = (a); i < (b); i += s)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define pii pair<ld,ld>
#define mp make_pair
#define f first
#define s second

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	
	int n, d; cin >> n >> d;
	pii a[n];
	F0R(i,n) {cin >> a[i].f >> a[i].s; a[i].s=abs(a[i].s);}
	sort(a,a+n);

	auto check = [&](ld m)->bool {
		ld prev = 0;
		F0R(i,n) {
			ld dist = sqrt(m*m-(a[i].s)*(a[i].s));
			ld x1 = a[i].f-dist, x2 = a[i].f+dist;
			if (x1 > d) {return (d>=prev);}
			else if (x1 >= prev) {return true;}
			prev = max(prev, x2);
			//if (x1 < prev) {prev = max(prev,x2);}
		} return (d>=prev);
	};
	ld l = 0, h = 1e9*3, m = (l+h)/2;
	ld ans;
	cout << fixed << setprecision(4);
	while (l <= h-1e-4) {
		if (check(m)) {
			l = m; ans = m;
		} else {h = m;}
		m = (l+h)/2;
	}
	cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 456 KB Output is correct
4 Incorrect 1 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 604 KB Output is correct
2 Correct 3 ms 464 KB Output is correct
3 Incorrect 3 ms 604 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 672 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 60 ms 3572 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 76 ms 3536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 48 ms 3676 KB Output is correct
2 Incorrect 42 ms 4184 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 48 ms 4976 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 54 ms 4964 KB Output is correct
2 Incorrect 47 ms 4948 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 285 ms 20560 KB Output is correct
2 Correct 229 ms 23632 KB Output is correct
3 Correct 244 ms 23312 KB Output is correct
4 Incorrect 589 ms 25424 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 261 ms 24144 KB Output is correct
2 Incorrect 409 ms 22628 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 315 ms 24152 KB Output is correct
2 Incorrect 293 ms 28244 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 293 ms 29036 KB Output is correct
2 Incorrect 456 ms 26964 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 392 ms 28372 KB Output is correct
2 Incorrect 338 ms 33104 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 358 ms 33872 KB Output is correct
2 Incorrect 552 ms 31564 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 448 ms 32340 KB Output is correct
2 Incorrect 397 ms 37968 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 408 ms 38532 KB Output is correct
2 Incorrect 616 ms 35924 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 524 ms 40440 KB Output is correct
2 Incorrect 520 ms 47188 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 487 ms 48244 KB Output is correct
2 Incorrect 883 ms 44884 KB Output isn't correct
3 Halted 0 ms 0 KB -