Submission #1104207

# Submission time Handle Problem Language Result Execution time Memory
1104207 2024-10-23T08:57:22 Z EkinOnal Mobile (BOI12_mobile) C++17
0 / 100
708 ms 48192 KB
//#pragma GCC optimize("O3,unroll-loops,Ofast")
//#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;
 
#define MAX 200005
#define pb push_back
#define mp make_pair 
#define int long long
#define f first
#define s second
#define vi vector<int>
#define pii pair<int,int>
#define si set<int>
#define vpii vector<pair<int,int>> 
const int mod = 1e9+7;
const int INF = 1e18;
// myMap.begin()->first :  key
// myMap.begin()->second : value
#define ldouble double

int epow(int a,int b){int ans=1;while(b){if(b&1) ans*=a;a*=a;b>>=1;a%=mod;ans%=mod;}return ans%=mod;}
int gcd(int a,int b) {if(a<b)swap(a,b);while(b){int tmp=b;b=a%b;a=tmp;}return a;}
int mul(long long a,long long b){return ((a%mod)*(b%mod))%mod;}
int sum(long long a,long long b){return ((a%mod)+(b%mod))%mod;}
 // typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
// typedef
// tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_multiset;


void solve(){
	int n,L; cin>>n>>L;
	vpii v(n+2); for(int i=1;i<=n;i++) cin>>v[i].f>>v[i].s;

	double l=0,r=15;
	while(r-l>1e-3){
		vector<pair<double,double>> arr;
		double mid=(l+r)/2.0;

		for(int i=1;i<=n;i++){
			double a = sqrt(pow(mid,2)-pow(v[i].s,2));
			arr.pb({v[i].f-a,v[i].f+a});
		}

		sort(arr.begin(),arr.end());
		double mx=0.0; bool flag=true;
		for(auto u : arr){
			if(u.f>mx) {flag=false;break;}
			mx=max(mx,u.s);
		}	

		if(flag) r=mid;
		else l=mid;
	//	cout<<"23 "<<endl;
	//	for(auto u : arr) cout<<u.f<<" "<<u.s<<endl;
	}
	cout<<l<<endl;

  					
	return;
}
 
int32_t main(/*int32_t argc, char* argv[]*/){
	ios_base::sync_with_stdio(0); cin.tie(0);
	// freopen("dining.in", "r", stdin);
	// freopen("dining.out", "w", stdout);		
 
	int t=1;
//	cin >> t;
	while (t--) solve();
 
	return 0;	 			
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 1 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 760 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 736 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 736 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 860 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 59 ms 5768 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 79 ms 4976 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 76 ms 5292 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 84 ms 5696 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 91 ms 5680 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 382 ms 24328 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 355 ms 24332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 412 ms 36844 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 429 ms 37108 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 462 ms 40708 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 483 ms 40540 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 568 ms 43296 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 601 ms 43520 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 682 ms 48192 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 708 ms 48192 KB Output isn't correct
2 Halted 0 ms 0 KB -