답안 #656299

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
656299 2022-11-06T18:42:55 Z chjiao Mobile (BOI12_mobile) C++14
0 / 100
494 ms 15956 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-9;
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(0, 4e9, [&](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) return false;
			mx = max(mx, station.first+xx);
		}
		return mx>=L;
	});
	cout <<  fixed << setprecision(6) << ans << endl;

}


# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 320 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Incorrect 2 ms 444 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 39 ms 1492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 22 ms 1492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 1620 KB Output is correct
2 Incorrect 29 ms 1492 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 1876 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 1876 KB Output is correct
2 Incorrect 41 ms 1876 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 208 ms 8148 KB Output is correct
2 Correct 151 ms 8148 KB Output is correct
3 Correct 168 ms 8148 KB Output is correct
4 Incorrect 150 ms 8148 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 143 ms 8148 KB Output is correct
2 Incorrect 293 ms 8148 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 249 ms 9800 KB Output is correct
2 Incorrect 208 ms 9684 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 166 ms 9684 KB Output is correct
2 Incorrect 333 ms 9684 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 291 ms 11220 KB Output is correct
2 Incorrect 206 ms 11220 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 215 ms 11220 KB Output is correct
2 Incorrect 367 ms 11220 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 312 ms 12756 KB Output is correct
2 Incorrect 246 ms 12756 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 214 ms 12756 KB Output is correct
2 Incorrect 435 ms 12756 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 386 ms 15956 KB Output is correct
2 Incorrect 364 ms 15956 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 265 ms 15956 KB Output is correct
2 Incorrect 494 ms 15956 KB Output isn't correct
3 Halted 0 ms 0 KB -