Submission #1013715

# Submission time Handle Problem Language Result Execution time Memory
1013715 2024-07-04T03:08:16 Z nrg_studio Mobile (BOI12_mobile) C++17
0 / 100
809 ms 44372 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);}

	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);
		} return (d>=prev);
	};
	ld l = 0, h = 1e9*5, m = (l+h)/2;
	ld ans;
	cout << fixed << setprecision(4);
	while (l <= h-1e-5) {
		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 0 ms 348 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 456 KB Output is correct
3 Correct 0 ms 348 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 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 600 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 600 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 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 60 ms 3676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 69 ms 3420 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 44 ms 3676 KB Output is correct
2 Incorrect 35 ms 4184 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 4956 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 51 ms 4956 KB Output is correct
2 Incorrect 44 ms 4952 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 251 ms 19536 KB Output is correct
2 Correct 214 ms 22112 KB Output is correct
3 Correct 218 ms 22100 KB Output is correct
4 Incorrect 571 ms 23776 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 215 ms 22608 KB Output is correct
2 Incorrect 428 ms 21448 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 284 ms 23332 KB Output is correct
2 Incorrect 236 ms 26448 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 251 ms 26968 KB Output is correct
2 Incorrect 472 ms 25172 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 351 ms 26988 KB Output is correct
2 Incorrect 293 ms 30800 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 285 ms 31316 KB Output is correct
2 Incorrect 600 ms 29780 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 421 ms 31124 KB Output is correct
2 Incorrect 345 ms 35064 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 368 ms 35724 KB Output is correct
2 Incorrect 667 ms 33936 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 506 ms 38468 KB Output is correct
2 Incorrect 418 ms 43692 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 421 ms 44372 KB Output is correct
2 Incorrect 809 ms 42064 KB Output isn't correct
3 Halted 0 ms 0 KB -