Submission #1056880

# Submission time Handle Problem Language Result Execution time Memory
1056880 2024-08-13T12:05:39 Z TimAni Mobile (BOI12_mobile) C++17
100 / 100
561 ms 8272 KB
#include <bits/stdc++.h>
#define long long long
 
using namespace std;
 
const double eps = 1E-6;
const int N = (int) 1E6;
 
int n, k;
int x[N], y[N];
 
bool valid(double a) {
	double t = 0;
	for (int i = 0; i < n; i++) {
		if (a < y[i]) {
			continue;
		} 
		double l = x[i] - sqrt(1.0 * a * a - 1.0 * y[i] * y[i]);
		double r = x[i] + sqrt(1.0 * a * a - 1.0 * y[i] * y[i]);
		if (l <= t && r >= t) {
			t = r;
		}
	}
	return t >= k;
}
 
void solve() {
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
	}
	
    double l = 0, r = 4E9;
    while(r - l > eps) {
        double R = (r + l) / 2;
        if(valid(R)) {
            r = R;
        }
        else {
            l = R;
        }
        
    }
    cout << fixed << setprecision(-log10(eps)) << r << endl;
}
 
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int t;
	t = 1;
	for (int i = 0; i < t; i++) {
		solve();
	}
	return 0;
}

// time-limit: 3000
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 0 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 2 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 2 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 2 ms 2396 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 2 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 4700 KB Output is correct
2 Correct 17 ms 4748 KB Output is correct
3 Correct 11 ms 4700 KB Output is correct
4 Correct 37 ms 4748 KB Output is correct
5 Correct 11 ms 4700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 4696 KB Output is correct
2 Correct 31 ms 4696 KB Output is correct
3 Correct 37 ms 4672 KB Output is correct
4 Correct 39 ms 4700 KB Output is correct
5 Correct 44 ms 4700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 4688 KB Output is correct
2 Correct 18 ms 4676 KB Output is correct
3 Correct 17 ms 4700 KB Output is correct
4 Correct 53 ms 6804 KB Output is correct
5 Correct 34 ms 4948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 6744 KB Output is correct
2 Correct 22 ms 6748 KB Output is correct
3 Correct 19 ms 6796 KB Output is correct
4 Correct 54 ms 6796 KB Output is correct
5 Correct 52 ms 6748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 6748 KB Output is correct
2 Correct 22 ms 6744 KB Output is correct
3 Correct 19 ms 6748 KB Output is correct
4 Correct 56 ms 6796 KB Output is correct
5 Correct 46 ms 6744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 101 ms 6776 KB Output is correct
2 Correct 113 ms 6748 KB Output is correct
3 Correct 111 ms 6748 KB Output is correct
4 Correct 275 ms 6744 KB Output is correct
5 Correct 227 ms 6748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 122 ms 6780 KB Output is correct
2 Correct 158 ms 6748 KB Output is correct
3 Correct 98 ms 6744 KB Output is correct
4 Correct 265 ms 6996 KB Output is correct
5 Correct 233 ms 6772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 123 ms 6748 KB Output is correct
2 Correct 136 ms 6792 KB Output is correct
3 Correct 132 ms 6776 KB Output is correct
4 Correct 354 ms 6780 KB Output is correct
5 Correct 271 ms 6744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 135 ms 6744 KB Output is correct
2 Correct 178 ms 6776 KB Output is correct
3 Correct 115 ms 6748 KB Output is correct
4 Correct 321 ms 6744 KB Output is correct
5 Correct 279 ms 6748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 145 ms 6992 KB Output is correct
2 Correct 153 ms 7000 KB Output is correct
3 Correct 169 ms 7032 KB Output is correct
4 Correct 375 ms 7000 KB Output is correct
5 Correct 303 ms 7040 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 159 ms 6996 KB Output is correct
2 Correct 195 ms 6996 KB Output is correct
3 Correct 138 ms 6992 KB Output is correct
4 Correct 397 ms 6996 KB Output is correct
5 Correct 328 ms 6992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 174 ms 7304 KB Output is correct
2 Correct 182 ms 7248 KB Output is correct
3 Correct 177 ms 7300 KB Output is correct
4 Correct 440 ms 7484 KB Output is correct
5 Correct 374 ms 7252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 183 ms 7252 KB Output is correct
2 Correct 219 ms 7304 KB Output is correct
3 Correct 152 ms 7292 KB Output is correct
4 Correct 426 ms 7252 KB Output is correct
5 Correct 406 ms 7252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 198 ms 8016 KB Output is correct
2 Correct 218 ms 8056 KB Output is correct
3 Correct 243 ms 8016 KB Output is correct
4 Correct 531 ms 8064 KB Output is correct
5 Correct 456 ms 8016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 221 ms 8016 KB Output is correct
2 Correct 267 ms 8272 KB Output is correct
3 Correct 222 ms 8052 KB Output is correct
4 Correct 561 ms 8056 KB Output is correct
5 Correct 490 ms 8076 KB Output is correct