Submission #965006

# Submission time Handle Problem Language Result Execution time Memory
965006 2024-04-18T02:54:21 Z pcc Mobile (BOI12_mobile) C++17
50 / 100
511 ms 8244 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>
#define ld double
#define pld pair<ld,ld>

const int mxn = 1e6+10;
ll N,L;
pair<ll,ll> arr[mxn];

inline bool check(ld r){
	vector<pld> v;
	for(int i = 0;i<N;i++){
		if(r<abs(arr[i].sc))continue;
		v.push_back(pld(arr[i].fs-sqrt(r*r-arr[i].sc*arr[i].sc),arr[i].fs+sqrt(r*r-arr[i].sc*arr[i].sc)));
	}
	sort(v.begin(),v.end());
	ld pre = 0;
	for(auto &i:v){
		if(pre>L)return true;
		if(pre<i.fs)return false;
		pre = max(pre,i.sc);
	}
	return pre>L;
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ld l = 0,r = 2e9;
	cin>>N>>L;
	if(N>1e5)exit(0);
	for(int i = 0;i<N;i++)cin>>arr[i].fs>>arr[i].sc;
	for(int i = 0;i<60;i++){
		ld mid = (l+r)/2;
		if(check(mid))r = mid;
		else l = mid;
	}
	cout<<fixed<<setprecision(10)<<l<<'\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 600 KB Output is correct
2 Correct 4 ms 604 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 4 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 796 KB Output is correct
2 Correct 10 ms 820 KB Output is correct
3 Correct 14 ms 796 KB Output is correct
4 Correct 5 ms 812 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 792 KB Output is correct
2 Correct 10 ms 828 KB Output is correct
3 Correct 14 ms 796 KB Output is correct
4 Correct 7 ms 828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 808 KB Output is correct
2 Correct 10 ms 828 KB Output is correct
3 Correct 16 ms 796 KB Output is correct
4 Correct 5 ms 812 KB Output is correct
5 Correct 7 ms 796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 119 ms 6508 KB Output is correct
2 Correct 301 ms 7320 KB Output is correct
3 Correct 182 ms 5188 KB Output is correct
4 Correct 92 ms 7100 KB Output is correct
5 Correct 79 ms 4940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 114 ms 6744 KB Output is correct
2 Correct 94 ms 6680 KB Output is correct
3 Correct 101 ms 7048 KB Output is correct
4 Correct 93 ms 7192 KB Output is correct
5 Correct 84 ms 7524 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 207 ms 7076 KB Output is correct
2 Correct 333 ms 6916 KB Output is correct
3 Correct 377 ms 7076 KB Output is correct
4 Correct 62 ms 8216 KB Output is correct
5 Correct 143 ms 7072 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 294 ms 8092 KB Output is correct
2 Correct 417 ms 7340 KB Output is correct
3 Correct 511 ms 7380 KB Output is correct
4 Correct 62 ms 8244 KB Output is correct
5 Correct 129 ms 7576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 238 ms 7652 KB Output is correct
2 Correct 434 ms 7792 KB Output is correct
3 Correct 498 ms 7364 KB Output is correct
4 Correct 64 ms 8208 KB Output is correct
5 Correct 135 ms 7608 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 632 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 600 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -