답안 #1013730

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1013730 2024-07-04T04:30:57 Z nrg_studio Mobile (BOI12_mobile) C++17
90 / 100
1000 ms 51028 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-3) {
		if (check(m)) {
			l = m; ans = m;
		} else {h = m;}
		m = (l+h)/2;
	}
	cout << ans << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 2 ms 564 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 3 ms 600 KB Output is correct
4 Correct 5 ms 692 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 604 KB Output is correct
2 Correct 3 ms 616 KB Output is correct
3 Correct 5 ms 604 KB Output is correct
4 Correct 6 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 600 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 3 ms 600 KB Output is correct
4 Correct 6 ms 604 KB Output is correct
5 Correct 4 ms 644 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 57 ms 2652 KB Output is correct
2 Correct 38 ms 3744 KB Output is correct
3 Correct 34 ms 2652 KB Output is correct
4 Correct 82 ms 3924 KB Output is correct
5 Correct 40 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 2904 KB Output is correct
2 Correct 81 ms 3288 KB Output is correct
3 Correct 93 ms 4184 KB Output is correct
4 Correct 86 ms 3932 KB Output is correct
5 Correct 98 ms 4432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 45 ms 3164 KB Output is correct
2 Correct 40 ms 2904 KB Output is correct
3 Correct 58 ms 3928 KB Output is correct
4 Correct 128 ms 5456 KB Output is correct
5 Correct 87 ms 4076 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 49 ms 3416 KB Output is correct
2 Correct 49 ms 4956 KB Output is correct
3 Correct 62 ms 4600 KB Output is correct
4 Correct 118 ms 5456 KB Output is correct
5 Correct 101 ms 4692 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 59 ms 3668 KB Output is correct
2 Correct 51 ms 3576 KB Output is correct
3 Correct 61 ms 4444 KB Output is correct
4 Correct 126 ms 5516 KB Output is correct
5 Correct 100 ms 4696 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 252 ms 15960 KB Output is correct
2 Correct 240 ms 16092 KB Output is correct
3 Correct 237 ms 15964 KB Output is correct
4 Correct 600 ms 15964 KB Output is correct
5 Correct 494 ms 22992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 253 ms 15964 KB Output is correct
2 Correct 446 ms 16092 KB Output is correct
3 Correct 313 ms 21840 KB Output is correct
4 Correct 619 ms 25172 KB Output is correct
5 Correct 505 ms 23380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 295 ms 19100 KB Output is correct
2 Correct 304 ms 19228 KB Output is correct
3 Correct 272 ms 27916 KB Output is correct
4 Correct 752 ms 30860 KB Output is correct
5 Correct 622 ms 27200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 283 ms 19036 KB Output is correct
2 Correct 581 ms 19228 KB Output is correct
3 Correct 371 ms 26192 KB Output is correct
4 Correct 729 ms 30800 KB Output is correct
5 Correct 631 ms 27984 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 356 ms 22360 KB Output is correct
2 Correct 336 ms 22364 KB Output is correct
3 Correct 353 ms 32592 KB Output is correct
4 Correct 843 ms 35776 KB Output is correct
5 Correct 747 ms 31312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 343 ms 22360 KB Output is correct
2 Correct 606 ms 22368 KB Output is correct
3 Correct 434 ms 30520 KB Output is correct
4 Correct 820 ms 35724 KB Output is correct
5 Correct 712 ms 32324 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 380 ms 25432 KB Output is correct
2 Correct 357 ms 25492 KB Output is correct
3 Correct 372 ms 36996 KB Output is correct
4 Correct 903 ms 41124 KB Output is correct
5 Correct 778 ms 36488 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 397 ms 25432 KB Output is correct
2 Correct 645 ms 25488 KB Output is correct
3 Correct 510 ms 34900 KB Output is correct
4 Correct 980 ms 40788 KB Output is correct
5 Correct 825 ms 37056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 479 ms 31576 KB Output is correct
2 Correct 497 ms 31580 KB Output is correct
3 Correct 492 ms 46200 KB Output is correct
4 Execution timed out 1097 ms 50768 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 469 ms 31580 KB Output is correct
2 Correct 853 ms 31752 KB Output is correct
3 Correct 590 ms 44116 KB Output is correct
4 Execution timed out 1050 ms 51028 KB Time limit exceeded
5 Halted 0 ms 0 KB -