Submission #654945

# Submission time Handle Problem Language Result Execution time Memory
654945 2022-11-02T06:25:04 Z Koful123 Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 15956 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
//#define endl "\n"
#define pb push_back
#define ff first
#define ss second
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

const double eps = 0.0000000000000001;

double dis(pair<double,double> x,pair<double,double> y){
	return sqrt(pow(x.ff - y.ff,2) + pow(x.ss - y.ss,2));
}

void solve(){

	double n,k;
	cin >> n >> k;

	vector<pair<double,double>> v(n);
	for(auto &[x,y] : v){
		cin >> x >> y;
	}

	auto check = [&](double m,int i,int ty){
		double d = 1e18,e = 1e18;
		for(int j=0;j<i;j++){
			d = min(d,dis({m,0},v[j]));
		}
		for(int j=i;j<n;j++){
			e = min(e,dis({m,0},v[j]));	
		}
		if(ty == 3) return d;
		if(ty == 2) return double(d <= e);
		if(ty == 1) return double(d <= e);
		return double(d >= e);
	};

	double ans = 0;
	for(int i=1;i<n;i++){
		double l = 0,r = k;
		int ty = check(v[i-1].ff,i,2);
		for(int j=1;j<=66;j++){
			double m = (l + r + eps) / 2;
			if(check(m,i,ty)) l = m;
			else r = m - eps;
		}
		ans = max(ans,check(l,i,3));
	}

	cout << fixed << setprecision(10);
	cout << ans << endl;
}	

signed main(){

	ios::sync_with_stdio(0);
	cin.tie(0);

	int t = 1;
//	cin >> t;

	while(t--)
		solve();

	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 340 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 340 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 340 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 340 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1077 ms 1492 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 1492 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 1620 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 1876 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 1876 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 8148 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1097 ms 8148 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 9684 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 9684 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 11220 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 11220 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 12756 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 12756 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 15956 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 15956 KB Time limit exceeded
2 Halted 0 ms 0 KB -