Submission #1056881

# Submission time Handle Problem Language Result Execution time Memory
1056881 2024-08-13T12:06:02 Z TimAni Mobile (BOI12_mobile) C++17
60 / 100
470 ms 8256 KB
#include <bits/stdc++.h>
#define long long long
 
using namespace std;
 
const double eps = 1E-3;
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 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 0 ms 2396 KB Output is correct
3 Correct 0 ms 2392 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 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 2512 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2536 KB Output is correct
4 Correct 2 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 2440 KB Output is correct
3 Correct 2 ms 2392 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
5 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 4700 KB Output is correct
2 Correct 18 ms 4748 KB Output is correct
3 Incorrect 10 ms 4696 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 4700 KB Output is correct
2 Correct 25 ms 4696 KB Output is correct
3 Correct 29 ms 4700 KB Output is correct
4 Incorrect 31 ms 4696 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 4700 KB Output is correct
2 Correct 22 ms 4748 KB Output is correct
3 Incorrect 17 ms 4700 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 6748 KB Output is correct
2 Correct 20 ms 6792 KB Output is correct
3 Incorrect 17 ms 6796 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 6808 KB Output is correct
2 Correct 20 ms 6748 KB Output is correct
3 Correct 21 ms 7008 KB Output is correct
4 Correct 48 ms 6744 KB Output is correct
5 Correct 37 ms 6780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 91 ms 6748 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 99 ms 6744 KB Output is correct
2 Correct 137 ms 6744 KB Output is correct
3 Correct 84 ms 6744 KB Output is correct
4 Correct 220 ms 6744 KB Output is correct
5 Incorrect 194 ms 6992 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 122 ms 6744 KB Output is correct
2 Correct 131 ms 6744 KB Output is correct
3 Correct 117 ms 6772 KB Output is correct
4 Correct 269 ms 6744 KB Output is correct
5 Correct 219 ms 6744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 123 ms 6776 KB Output is correct
2 Correct 146 ms 6744 KB Output is correct
3 Correct 101 ms 6748 KB Output is correct
4 Correct 274 ms 6748 KB Output is correct
5 Correct 228 ms 6748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 144 ms 7044 KB Output is correct
2 Correct 139 ms 7000 KB Output is correct
3 Correct 142 ms 6992 KB Output is correct
4 Correct 322 ms 7048 KB Output is correct
5 Correct 245 ms 6992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 138 ms 6996 KB Output is correct
2 Correct 160 ms 6992 KB Output is correct
3 Correct 117 ms 6996 KB Output is correct
4 Correct 311 ms 6996 KB Output is correct
5 Correct 271 ms 6948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 154 ms 7252 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 158 ms 7468 KB Output is correct
2 Correct 181 ms 7248 KB Output is correct
3 Correct 134 ms 7292 KB Output is correct
4 Correct 358 ms 7288 KB Output is correct
5 Incorrect 306 ms 7284 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 175 ms 8016 KB Output is correct
2 Correct 194 ms 8072 KB Output is correct
3 Correct 190 ms 8056 KB Output is correct
4 Correct 470 ms 8056 KB Output is correct
5 Correct 377 ms 8256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 201 ms 8060 KB Output is correct
2 Correct 219 ms 8016 KB Output is correct
3 Correct 174 ms 8016 KB Output is correct
4 Correct 453 ms 8020 KB Output is correct
5 Correct 388 ms 8020 KB Output is correct