답안 #656300

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
656300 2022-11-06T18:47:51 Z chjiao Mobile (BOI12_mobile) C++14
100 / 100
460 ms 16084 KB
#include <bits/stdc++.h>
using namespace std;

#define fastio	ios_base::sync_with_stdio(false);cin.tie(0)
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

#define FOR(i,a,b) for(ll i=a;i<=b;i++)
#define FORB(i,a,b) for(ll i=a;i>=b;i--)

#define getbit(mask,i) ((mask>>(i))&1)
#define getnum(i) (1<<(i))

#define endl "\n"
#define sz(x) (int)size(x)
#define mp make_pair
using ll = long long;
const ll MOD1 = 1e9+7;
const ll MOD2 = 998244353;
const ll MN = 1e5;


//first true float/double
long double FLOAT_ERR = 1e-5;
long double first_true_float(long double lo, long double hi, function<bool(long double)> f) {
	// if none of the values in the range work, return hi + 1
	lo--;
	hi++;
	while (hi-lo > FLOAT_ERR) {
		long double mid =  (lo + hi) / 2.0f;
		if (f(mid)) {
			hi = mid;
		} else {
			lo = mid;
		}
	}
	return lo;
}

int main() {
    fastio;
	//freopen("XXX.in","r",stdin);
	// freopen("XXX.out","w",stdout);
	
	ll N, L;
	cin >> N >> L;
	vector<pair<ll, ll>> stations(N);
	FOR(i,0,N-1) {
		ll y;
		cin >> stations[i].first >> y;
		stations[i].second = y*y;
	}
	long double ans = first_true_float(1, 1.5e9, [&](long double mid) { 
		long double mx=0;
		long double dd=mid*mid, xx;
		for(auto station:stations) {
			if(dd-station.second<0) continue;
			xx=sqrt(dd-station.second);
			if(station.first-xx<=mx) 
				mx = max(mx, station.first+xx);
		}
		return mx>=L;
	});
	cout <<  fixed << setprecision(6) << ans << endl;

}


# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 2 ms 328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 396 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 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 3 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 3 ms 460 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 464 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 1492 KB Output is correct
2 Correct 28 ms 1620 KB Output is correct
3 Correct 18 ms 1236 KB Output is correct
4 Correct 23 ms 1632 KB Output is correct
5 Correct 15 ms 1220 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 1492 KB Output is correct
2 Correct 27 ms 1492 KB Output is correct
3 Correct 30 ms 1620 KB Output is correct
4 Correct 28 ms 1608 KB Output is correct
5 Correct 25 ms 1748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 1620 KB Output is correct
2 Correct 32 ms 1620 KB Output is correct
3 Correct 38 ms 1668 KB Output is correct
4 Correct 34 ms 1928 KB Output is correct
5 Correct 26 ms 1748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 1876 KB Output is correct
2 Correct 39 ms 2004 KB Output is correct
3 Correct 32 ms 1908 KB Output is correct
4 Correct 32 ms 2004 KB Output is correct
5 Correct 29 ms 1992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 1876 KB Output is correct
2 Correct 37 ms 1876 KB Output is correct
3 Correct 34 ms 2004 KB Output is correct
4 Correct 30 ms 1996 KB Output is correct
5 Correct 33 ms 1904 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 176 ms 8148 KB Output is correct
2 Correct 183 ms 8148 KB Output is correct
3 Correct 181 ms 8148 KB Output is correct
4 Correct 143 ms 8148 KB Output is correct
5 Correct 142 ms 8284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 188 ms 8148 KB Output is correct
2 Correct 244 ms 8148 KB Output is correct
3 Correct 176 ms 8280 KB Output is correct
4 Correct 145 ms 8260 KB Output is correct
5 Correct 139 ms 8224 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 205 ms 9684 KB Output is correct
2 Correct 244 ms 9684 KB Output is correct
3 Correct 237 ms 9804 KB Output is correct
4 Correct 173 ms 9812 KB Output is correct
5 Correct 173 ms 9836 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 224 ms 9684 KB Output is correct
2 Correct 281 ms 9684 KB Output is correct
3 Correct 195 ms 9812 KB Output is correct
4 Correct 181 ms 9756 KB Output is correct
5 Correct 167 ms 9812 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 244 ms 11220 KB Output is correct
2 Correct 279 ms 11220 KB Output is correct
3 Correct 252 ms 11288 KB Output is correct
4 Correct 233 ms 11348 KB Output is correct
5 Correct 199 ms 11392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 278 ms 11220 KB Output is correct
2 Correct 341 ms 11220 KB Output is correct
3 Correct 222 ms 11352 KB Output is correct
4 Correct 211 ms 11296 KB Output is correct
5 Correct 212 ms 11348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 291 ms 12756 KB Output is correct
2 Correct 297 ms 12756 KB Output is correct
3 Correct 285 ms 12876 KB Output is correct
4 Correct 250 ms 12884 KB Output is correct
5 Correct 225 ms 12884 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 311 ms 12756 KB Output is correct
2 Correct 381 ms 12756 KB Output is correct
3 Correct 268 ms 12884 KB Output is correct
4 Correct 235 ms 12872 KB Output is correct
5 Correct 225 ms 12884 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 356 ms 15956 KB Output is correct
2 Correct 376 ms 15896 KB Output is correct
3 Correct 359 ms 16016 KB Output is correct
4 Correct 314 ms 15956 KB Output is correct
5 Correct 283 ms 16000 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 410 ms 15956 KB Output is correct
2 Correct 460 ms 15956 KB Output is correct
3 Correct 346 ms 16084 KB Output is correct
4 Correct 290 ms 15956 KB Output is correct
5 Correct 287 ms 15956 KB Output is correct