답안 #459565

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
459565 2021-08-08T16:34:24 Z BackNoob Mobile (BOI12_mobile) C++14
13 / 100
1000 ms 10148 KB
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define endl '\n'
#define mask(i) (1LL << (i))
#define task "name"
#define ld long double
#define ull unsigned long long
using namespace std;
const ll mxN = 220797 + 7;
const ll inf = 1e9 + 277;
const ll mod = 2147483648;
const ll infll = 1e18 + 7;
const ll base = 307;
 
template <typename T1, typename T2> bool minimize(T1 &a, T2 b) {
	if (a > b) {a = b; return true;} return false;
}
template <typename T1, typename T2> bool maximize(T1 &a, T2 b) {
	if (a < b) {a = b; return true;} return false;
}

struct Point{
	int x , y;
} a[mxN];

int n , L;

bool ok(ld x)
{
	vector<pair<ld , ld>> seg;
	for(int i = 1 ; i <= n ; i++) {
		ld h = abs(a[i].y);
		if(h > x) continue;
		if(h == x) seg.push_back({a[i].x , a[i].x});
		if(h < x) {
			ld leng = sqrt(x * x - h * h);
			ld l = a[i].x - leng;
			ld r = a[i].x + leng;
			seg.push_back({l , r});
		}
	}
	sort(seg.begin() , seg.end());

	ld minl = 0;
	for(auto it : seg) {
		ld l = it.fi;
		ld r = it.se;

		if(l > minl) return false;
		else minl = max(minl , r);
		if(minl >= L) return true;
	}
	return true;
}
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   //	freopen("task.inp" , "r" , stdin);
   // freopen("task.out" , "w" , stdout);

   	cin >> n >> L;

   	for(int i = 1 ; i <= n ; i++) cin >> a[i].x >> a[i].y;

   	ld l = 0 , r = 1e18;
   	for(int i = 1 ; i <= 100 ; i++) {
   		ld mid = (l + r) / 2;

   		if(ok(mid)) r = mid;
   		else l = mid; 
   	}

   	cout << fixed << setprecision(6) << l;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Incorrect 1 ms 332 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 584 KB Output is correct
2 Incorrect 18 ms 588 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 832 KB Output is correct
2 Correct 52 ms 980 KB Output is correct
3 Correct 59 ms 828 KB Output is correct
4 Correct 28 ms 864 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 832 KB Output is correct
2 Correct 52 ms 940 KB Output is correct
3 Correct 63 ms 980 KB Output is correct
4 Correct 29 ms 856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 29 ms 836 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 500 ms 8300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 619 ms 8376 KB Output is correct
2 Correct 526 ms 8168 KB Output is correct
3 Correct 559 ms 8652 KB Output is correct
4 Correct 513 ms 8736 KB Output is correct
5 Correct 541 ms 9432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 672 ms 8684 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1090 ms 9924 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1086 ms 10148 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 40 ms 5956 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 57 ms 7716 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 42 ms 5948 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 57 ms 7712 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 40 ms 5872 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 58 ms 7820 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 40 ms 5924 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 58 ms 7684 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 41 ms 5968 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 57 ms 7748 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -