Submission #1104367

# Submission time Handle Problem Language Result Execution time Memory
1104367 2024-10-23T14:04:28 Z EkinOnal Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 67380 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 double long 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;

	long double l=0,r=2e9;
	while(r-l>1e-4){
		vector<pair<long double,long double>> arr;
		long double mid=(l+r)/2.0;

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

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

		if(mx<(long double)L) flag=false;

		if(flag) r=mid;
		else l=mid;
	}
	cout << fixed << setprecision(6);
	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 Correct 1 ms 512 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Incorrect 1 ms 336 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 732 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 940 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 940 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 27 ms 944 KB Output is correct
2 Correct 32 ms 1100 KB Output is correct
3 Correct 28 ms 1164 KB Output is correct
4 Incorrect 40 ms 1036 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 544 ms 9336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 696 ms 8920 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 467 ms 9632 KB Output is correct
2 Correct 590 ms 9204 KB Output is correct
3 Correct 687 ms 9836 KB Output is correct
4 Execution timed out 1042 ms 11168 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 551 ms 9304 KB Output is correct
2 Correct 721 ms 10836 KB Output is correct
3 Correct 772 ms 11124 KB Output is correct
4 Execution timed out 1068 ms 11912 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 485 ms 9268 KB Output is correct
2 Correct 682 ms 10916 KB Output is correct
3 Correct 698 ms 10280 KB Output is correct
4 Incorrect 960 ms 11140 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1050 ms 40428 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1029 ms 40364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1050 ms 61140 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1041 ms 61136 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1037 ms 62700 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1055 ms 62672 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1042 ms 64272 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 64348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1049 ms 67380 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1054 ms 67360 KB Time limit exceeded
2 Halted 0 ms 0 KB -