Submission #1104579

# Submission time Handle Problem Language Result Execution time Memory
1104579 2024-10-24T05:15:53 Z EkinOnal Mobile (BOI12_mobile) C++17
50 / 100
1000 ms 50152 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 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=2e9;
	while(r-l>1e-6){
		vector<pair<double,double>> arr;
		double mid=(l+r)/2.0;

		for(int i=1;i<=n;i++){
			if(v[i].s*v[i].s>mid*mid) continue;
			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(),[&](auto l, auto r){return l.s < r.s;});
		double mx=0.0;
		for(auto u : arr){
			if(u.f<=mx) mx=max(mx,u.s);
		}		

		if(mx<(double)L) l=mid;
		else r=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 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 508 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 592 KB Output is correct
2 Correct 4 ms 592 KB Output is correct
3 Correct 2 ms 336 KB Output is correct
4 Correct 3 ms 592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 736 KB Output is correct
2 Correct 9 ms 816 KB Output is correct
3 Correct 8 ms 784 KB Output is correct
4 Correct 6 ms 816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 736 KB Output is correct
2 Correct 12 ms 816 KB Output is correct
3 Correct 8 ms 952 KB Output is correct
4 Correct 5 ms 816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 940 KB Output is correct
2 Correct 9 ms 816 KB Output is correct
3 Correct 7 ms 784 KB Output is correct
4 Correct 5 ms 800 KB Output is correct
5 Correct 7 ms 784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 107 ms 5696 KB Output is correct
2 Correct 287 ms 6052 KB Output is correct
3 Correct 100 ms 3796 KB Output is correct
4 Correct 83 ms 6040 KB Output is correct
5 Correct 78 ms 3468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 135 ms 5148 KB Output is correct
2 Correct 107 ms 5580 KB Output is correct
3 Correct 114 ms 6016 KB Output is correct
4 Correct 90 ms 6172 KB Output is correct
5 Correct 84 ms 6648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 217 ms 5404 KB Output is correct
2 Correct 309 ms 6296 KB Output is correct
3 Correct 116 ms 6164 KB Output is correct
4 Correct 65 ms 7476 KB Output is correct
5 Correct 144 ms 6252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 327 ms 5724 KB Output is correct
2 Correct 399 ms 7092 KB Output is correct
3 Correct 212 ms 6700 KB Output is correct
4 Correct 62 ms 7536 KB Output is correct
5 Correct 138 ms 6932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 229 ms 6076 KB Output is correct
2 Correct 408 ms 7088 KB Output is correct
3 Correct 212 ms 6704 KB Output is correct
4 Correct 69 ms 7456 KB Output is correct
5 Correct 137 ms 6936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 878 ms 26836 KB Output is correct
2 Execution timed out 1044 ms 32032 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1103 ms 28940 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 906 ms 43452 KB Output is correct
2 Execution timed out 1038 ms 47964 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1018 ms 36164 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1045 ms 39892 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1067 ms 39488 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1038 ms 43980 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1034 ms 50152 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1054 ms 48208 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1032 ms 48812 KB Time limit exceeded
2 Halted 0 ms 0 KB -