Submission #459567

# Submission time Handle Problem Language Result Execution time Memory
459567 2021-08-08T16:40:41 Z BackNoob Mobile (BOI12_mobile) C++14
21 / 100
1000 ms 8572 KB
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define endl '\n'
#define mask(i) (1LL << (i))
#define task "name"
#define ld long double
#define ull unsigned long long
using namespace std;
const ll mxN = 220797 + 7;
const ll inf = 1e9 + 277;
const ll mod = 2147483648;
const ll infll = 1e18 + 7;
const ll base = 307;
 
template <typename T1, typename T2> bool minimize(T1 &a, T2 b) {
	if (a > b) {a = b; return true;} return false;
}
template <typename T1, typename T2> bool maximize(T1 &a, T2 b) {
	if (a < b) {a = b; return true;} return false;
}
 
struct Point{
	int x , y;
} a[mxN];
 
int n , L;
 
bool ok(ld x)
{
	vector<pair<ld , ld>> seg;
	for(int i = 1 ; i <= n ; i++) {
		ld h = abs(a[i].y);
		if(h > x) continue;
		if(h == x) seg.push_back({a[i].x , a[i].x});
		if(h < x) {
			ld leng = sqrt(x * x - h * h);
			ld l = a[i].x - leng;
			ld r = a[i].x + leng;
			seg.push_back({l , r});
		}
	}
	sort(seg.begin() , seg.end());
 
	ld minl = 0;
	for(auto it : seg) {
		ld l = it.fi;
		ld r = it.se;
 
		if(l > minl) return false;
		else minl = max(minl , r);
		if(minl >= L) return true;
	}
	return true;
}
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   //	freopen("task.inp" , "r" , stdin);
   // freopen("task.out" , "w" , stdout);
 
   	cin >> n >> L;
 
   	for(int i = 1 ; i <= n ; i++) cin >> a[i].x >> a[i].y;
 
   	ld l = 0 , r = 1.5e9;
   	for(int i = 1 ; i <= 100 ; i++) {
   		ld mid = (l + r) / 2;
 
   		if(ok(mid)) r = mid;
   		else l = mid; 
   	}
 
   	cout << fixed << setprecision(6) << l;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 560 KB Output is correct
2 Incorrect 9 ms 664 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 824 KB Output is correct
2 Correct 52 ms 1016 KB Output is correct
3 Correct 64 ms 780 KB Output is correct
4 Correct 15 ms 788 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 784 KB Output is correct
2 Correct 59 ms 916 KB Output is correct
3 Correct 66 ms 792 KB Output is correct
4 Correct 14 ms 820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 784 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 242 ms 7368 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 329 ms 7728 KB Output is correct
2 Correct 269 ms 7344 KB Output is correct
3 Correct 278 ms 7624 KB Output is correct
4 Correct 243 ms 7548 KB Output is correct
5 Correct 245 ms 7820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 379 ms 8088 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 8572 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 8512 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 40 ms 3840 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 58 ms 3844 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 40 ms 3908 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 58 ms 3924 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 44 ms 3856 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 56 ms 3936 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 41 ms 3848 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 58 ms 3908 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 41 ms 3868 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 56 ms 3868 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -