Submission #1112842

# Submission time Handle Problem Language Result Execution time Memory
1112842 2024-11-15T02:45:35 Z erentor353 Mobile (BOI12_mobile) C++17
8 / 100
266 ms 18504 KB
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
template<typename T> using oset = 
__gnu_pbds::tree<T, __gnu_pbds::null_type, greater<T>, 
__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>; 
#define vt vector
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define ll long long
#define ull unsigned ll
#define ld long double
#define okey order_of_key
#define oget find_by_order
typedef vt<int> vi;
typedef pair<int,int> pi;
typedef pair<ll, ll> pll;
const ll MAXN = 1e6;
const ll MAXM = 60;
const ll MAXL = 31;
const ll MOD = 1e9 + 7;
ll N, L, x[MAXN], y[MAXN];
bool check(double r){
	double maximum = 0;
	for(int i = 0; i<N; ++i){
		double diff = r*r-(double)(y[i]*y[i]);
		if(diff < 0) continue;
		double sqt = sqrt(diff);
		double x1 = x[i] - sqt;
		double x2 = sqt + x[i];
		//if(x1 > maximum) return false;
		if(x1 <= maximum) maximum = max(maximum, x2);
	}
	
	return maximum >= L;
}
void solve(){
	cin>>N>>L;
	for(int i = 0; i<N; ++i){
		cin>>x[i]>>y[i];
	}
	
	double lo = 0, hi = 2e9;
	while(lo <= hi){
		double mid = (hi + lo)/2;
		if(check(mid)){
			hi = mid-0.0001;
		}else{
			lo = mid+0.0001;
		}
	}
	
	cout<<lo<<"\n";
	//printf("%.5f\n", 50.122324);
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int t = 1;
	//cin>>t;
	while(t--) solve();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2384 KB Output is correct
2 Correct 1 ms 2384 KB Output is correct
3 Correct 1 ms 2384 KB Output is correct
4 Correct 1 ms 2384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2384 KB Output is correct
2 Correct 1 ms 2384 KB Output is correct
3 Correct 1 ms 2384 KB Output is correct
4 Correct 1 ms 2384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2384 KB Output is correct
2 Correct 1 ms 2384 KB Output is correct
3 Correct 2 ms 2384 KB Output is correct
4 Incorrect 1 ms 2384 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2384 KB Output is correct
2 Incorrect 2 ms 2384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2384 KB Output is correct
2 Incorrect 2 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 336 KB Output is correct
2 Incorrect 2 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 24 ms 1616 KB Output is correct
2 Incorrect 22 ms 1616 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 26 ms 1616 KB Output is correct
2 Correct 16 ms 1360 KB Output is correct
3 Incorrect 18 ms 1628 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 1616 KB Output is correct
2 Incorrect 24 ms 1620 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 4432 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 4944 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 114 ms 10824 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 128 ms 9544 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 143 ms 11328 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 156 ms 11104 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 164 ms 12800 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 198 ms 16268 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 193 ms 15796 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 210 ms 14408 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 225 ms 18504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 266 ms 16008 KB Output isn't correct
2 Halted 0 ms 0 KB -