Submission #1112827

# Submission time Handle Problem Language Result Execution time Memory
1112827 2024-11-15T02:30:23 Z erentor353 Mobile (BOI12_mobile) C++17
0 / 100
314 ms 32584 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 = 50;
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;
		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 = 1e13;
	int cnt = 0;
	while(lo < hi && cnt++ <= MAXM){
		double mid = (hi + lo)/2;
		if(check(mid)){
			hi = mid;
		}else{
			lo = mid + 0.001;
		}
	}
	
	printf("%.4f\n", hi);
}
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 Incorrect 1 ms 336 KB Output isn't correct
2 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 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 592 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 592 KB Output is correct
2 Incorrect 3 ms 604 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 592 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 2332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 24 ms 2384 KB Output is correct
2 Incorrect 21 ms 2896 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 3408 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 3376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 138 ms 12360 KB Output is correct
2 Incorrect 127 ms 15944 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 120 ms 16280 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 149 ms 14940 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 141 ms 19528 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 178 ms 17224 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 170 ms 22856 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 231 ms 19784 KB Output is correct
2 Incorrect 229 ms 25368 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 194 ms 25928 KB Output is correct
2 Incorrect 314 ms 23344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 278 ms 24788 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 263 ms 32584 KB Output isn't correct
2 Halted 0 ms 0 KB -