Submission #654828

# Submission time Handle Problem Language Result Execution time Memory
654828 2022-11-01T17:47:04 Z Koful123 Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 31604 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
//#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.000000000000001;

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,l;
	cin >> n >> l;

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

	double ans = 0;
	for(int i=1;i<n;i++){
		if(v[i-1].ff < 0 || v[i].ss > l) continue;
		double l = v[i-1].ff,r = v[i].ff;
		for(int j=1;j<=100;j++){
			double m = (l + r + eps) / 2;
			if(dis({m,0},v[i-1]) <= dis({m,0},v[i])) l = m;
			else r = m - eps;
		}
		ans = max(ans,dis({l,0},v[i-1]));
	}

	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 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 616 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 97 ms 2664 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 99 ms 2772 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 149 ms 3072 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 186 ms 3452 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 146 ms 3460 KB Output is correct
2 Incorrect 180 ms 3452 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 844 ms 15976 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 777 ms 15980 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1055 ms 19112 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 923 ms 19108 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 22228 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1042 ms 22240 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 25308 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 25372 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 31604 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 31572 KB Time limit exceeded
2 Halted 0 ms 0 KB -