답안 #735101

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
735101 2023-05-03T14:45:03 Z ace_in_the_hole Mobile (BOI12_mobile) C++17
90 / 100
1000 ms 27432 KB
#include<bits/stdc++.h>
using namespace std;

typedef long long Int;
typedef long double Real;
const Real EPS = 1e-6;
bool leq(Real x, Real y) { return x-EPS <= y; }

const int N = 1e6 + 50;
int n,L, x[N], y[N];

bool check(Real dis) {
	Real rightmost = 0;
	for (int i = 1; i <= n; i++) {
		if (leq(dis, y[i])) continue;
		Real lef = x[i] - sqrt(dis*dis - 1ll*y[i]*y[i]);
		Real rig = 2*x[i] - lef;
		if (leq(lef, rightmost))
			rightmost = max(rightmost, rig);
	}
	return leq(L,rightmost);
}

void solve() 
{
	cin >> n >> L;
	for (int i = 1; i <= n; i++) cin >> x[i] >> y[i];
	const Real DEL = 1e-3;
	Real ans = 0;
	for (Real low = 0, high = 1e9 * sqrt(5); high - low >= DEL; ) {
		Real mid = (low + high) / 2;
		if (check(mid)) high = mid;
		else ans = low = mid;
	}
	cout << fixed << setprecision(15) << ans;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	#define task "WF"
	if (fopen(task".inp", "r")) {
		freopen(task".inp", "r", stdin);
		freopen(task".out", "w", stdout);
	}
	solve();
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:45:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   45 |   freopen(task".inp", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:46:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   46 |   freopen(task".out", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 324 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 340 KB Output is correct
2 Correct 3 ms 412 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 5 ms 448 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 396 KB Output is correct
2 Correct 4 ms 340 KB Output is correct
3 Correct 3 ms 336 KB Output is correct
4 Correct 5 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 3 ms 440 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 5 ms 340 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 1716 KB Output is correct
2 Correct 44 ms 1996 KB Output is correct
3 Correct 27 ms 1364 KB Output is correct
4 Correct 70 ms 2036 KB Output is correct
5 Correct 25 ms 1028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 1620 KB Output is correct
2 Correct 60 ms 1684 KB Output is correct
3 Correct 68 ms 1944 KB Output is correct
4 Correct 73 ms 2136 KB Output is correct
5 Correct 79 ms 2388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 1628 KB Output is correct
2 Correct 42 ms 2132 KB Output is correct
3 Correct 33 ms 1852 KB Output is correct
4 Correct 98 ms 3024 KB Output is correct
5 Correct 60 ms 1940 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 2640 KB Output is correct
2 Correct 43 ms 2436 KB Output is correct
3 Correct 45 ms 2108 KB Output is correct
4 Correct 110 ms 3056 KB Output is correct
5 Correct 80 ms 2368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 47 ms 2536 KB Output is correct
2 Correct 42 ms 2472 KB Output is correct
3 Correct 41 ms 2132 KB Output is correct
4 Correct 107 ms 3052 KB Output is correct
5 Correct 84 ms 2368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 254 ms 8524 KB Output is correct
2 Correct 210 ms 11940 KB Output is correct
3 Correct 200 ms 11492 KB Output is correct
4 Correct 508 ms 13792 KB Output is correct
5 Correct 442 ms 10960 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 220 ms 12424 KB Output is correct
2 Correct 262 ms 10820 KB Output is correct
3 Correct 184 ms 9932 KB Output is correct
4 Correct 529 ms 13676 KB Output is correct
5 Correct 435 ms 11536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 284 ms 10188 KB Output is correct
2 Correct 248 ms 14280 KB Output is correct
3 Correct 270 ms 13644 KB Output is correct
4 Correct 656 ms 16892 KB Output is correct
5 Correct 512 ms 12996 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 270 ms 14800 KB Output is correct
2 Correct 309 ms 12932 KB Output is correct
3 Correct 243 ms 11840 KB Output is correct
4 Correct 620 ms 16744 KB Output is correct
5 Correct 542 ms 13724 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 296 ms 11892 KB Output is correct
2 Correct 297 ms 16508 KB Output is correct
3 Correct 294 ms 16056 KB Output is correct
4 Correct 757 ms 19316 KB Output is correct
5 Correct 582 ms 14936 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 356 ms 17284 KB Output is correct
2 Correct 340 ms 15032 KB Output is correct
3 Correct 283 ms 14168 KB Output is correct
4 Correct 723 ms 19156 KB Output is correct
5 Correct 617 ms 15884 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 339 ms 13500 KB Output is correct
2 Correct 405 ms 18880 KB Output is correct
3 Correct 338 ms 18092 KB Output is correct
4 Correct 905 ms 22288 KB Output is correct
5 Correct 704 ms 17740 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 353 ms 19756 KB Output is correct
2 Correct 414 ms 17020 KB Output is correct
3 Correct 304 ms 16100 KB Output is correct
4 Correct 898 ms 22040 KB Output is correct
5 Correct 704 ms 18180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 453 ms 16884 KB Output is correct
2 Correct 491 ms 23652 KB Output is correct
3 Correct 423 ms 22668 KB Output is correct
4 Execution timed out 1037 ms 27260 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 412 ms 24628 KB Output is correct
2 Correct 466 ms 21400 KB Output is correct
3 Correct 391 ms 20460 KB Output is correct
4 Execution timed out 1010 ms 27432 KB Time limit exceeded
5 Halted 0 ms 0 KB -