Submission #1056885

# Submission time Handle Problem Language Result Execution time Memory
1056885 2024-08-13T12:07:30 Z TimAni Mobile (BOI12_mobile) C++17
100 / 100
487 ms 8024 KB
#include <bits/stdc++.h>
#define long long long
 
using namespace std;
 
const double eps = 1E-4;
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() {
    cin.tie(0)->sync_with_stdio(0);
    double T = 1;
    //cin >> T;
    while(T--) solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2392 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 0 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 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 1 ms 2396 KB Output is correct
2 Correct 2 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 2 ms 2600 KB Output is correct
3 Correct 1 ms 2484 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 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 2 ms 2536 KB Output is correct
5 Correct 2 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 4700 KB Output is correct
2 Correct 16 ms 4696 KB Output is correct
3 Correct 10 ms 4748 KB Output is correct
4 Correct 32 ms 4700 KB Output is correct
5 Correct 10 ms 4696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 4700 KB Output is correct
2 Correct 27 ms 4700 KB Output is correct
3 Correct 32 ms 4696 KB Output is correct
4 Correct 34 ms 4700 KB Output is correct
5 Correct 39 ms 4696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 4700 KB Output is correct
2 Correct 17 ms 4748 KB Output is correct
3 Correct 19 ms 4700 KB Output is correct
4 Correct 52 ms 6796 KB Output is correct
5 Correct 28 ms 4696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 6748 KB Output is correct
2 Correct 21 ms 6792 KB Output is correct
3 Correct 19 ms 6744 KB Output is correct
4 Correct 48 ms 6748 KB Output is correct
5 Correct 43 ms 6748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 6744 KB Output is correct
2 Correct 22 ms 6796 KB Output is correct
3 Correct 18 ms 6744 KB Output is correct
4 Correct 48 ms 6748 KB Output is correct
5 Correct 39 ms 6748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 94 ms 6748 KB Output is correct
2 Correct 102 ms 6748 KB Output is correct
3 Correct 122 ms 6772 KB Output is correct
4 Correct 246 ms 6780 KB Output is correct
5 Correct 212 ms 6776 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 105 ms 6748 KB Output is correct
2 Correct 152 ms 6776 KB Output is correct
3 Correct 89 ms 6744 KB Output is correct
4 Correct 256 ms 6992 KB Output is correct
5 Correct 212 ms 6744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 114 ms 6772 KB Output is correct
2 Correct 123 ms 6748 KB Output is correct
3 Correct 139 ms 6676 KB Output is correct
4 Correct 292 ms 6744 KB Output is correct
5 Correct 237 ms 6748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 125 ms 6744 KB Output is correct
2 Correct 157 ms 6748 KB Output is correct
3 Correct 110 ms 6748 KB Output is correct
4 Correct 293 ms 6776 KB Output is correct
5 Correct 250 ms 6748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 128 ms 7044 KB Output is correct
2 Correct 164 ms 6992 KB Output is correct
3 Correct 140 ms 6996 KB Output is correct
4 Correct 340 ms 7088 KB Output is correct
5 Correct 266 ms 6992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 148 ms 6996 KB Output is correct
2 Correct 173 ms 6996 KB Output is correct
3 Correct 123 ms 6996 KB Output is correct
4 Correct 334 ms 7032 KB Output is correct
5 Correct 297 ms 7032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 165 ms 7256 KB Output is correct
2 Correct 165 ms 7248 KB Output is correct
3 Correct 165 ms 7308 KB Output is correct
4 Correct 401 ms 7248 KB Output is correct
5 Correct 327 ms 7308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 174 ms 7484 KB Output is correct
2 Correct 197 ms 7296 KB Output is correct
3 Correct 150 ms 7304 KB Output is correct
4 Correct 417 ms 7300 KB Output is correct
5 Correct 350 ms 7308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 207 ms 8020 KB Output is correct
2 Correct 204 ms 8020 KB Output is correct
3 Correct 208 ms 8020 KB Output is correct
4 Correct 484 ms 8020 KB Output is correct
5 Correct 391 ms 8020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 223 ms 8020 KB Output is correct
2 Correct 237 ms 8024 KB Output is correct
3 Correct 176 ms 8016 KB Output is correct
4 Correct 487 ms 8016 KB Output is correct
5 Correct 449 ms 8016 KB Output is correct