Submission #1056884

# Submission time Handle Problem Language Result Execution time Memory
1056884 2024-08-13T12:06:34 Z TimAni Mobile (BOI12_mobile) C++17
60 / 100
477 ms 8276 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() {
    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 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 2396 KB Output is correct
3 Correct 0 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 1 ms 2396 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 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 2 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2392 KB Output is correct
2 Correct 2 ms 2648 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 1 ms 2392 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
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 15 ms 4564 KB Output is correct
3 Incorrect 12 ms 4700 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 4700 KB Output is correct
2 Correct 25 ms 4700 KB Output is correct
3 Correct 30 ms 4700 KB Output is correct
4 Incorrect 34 ms 4700 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 4700 KB Output is correct
2 Correct 16 ms 4700 KB Output is correct
3 Incorrect 15 ms 4696 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 6800 KB Output is correct
2 Correct 24 ms 6796 KB Output is correct
3 Incorrect 20 ms 6748 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 6744 KB Output is correct
2 Correct 21 ms 6780 KB Output is correct
3 Correct 18 ms 6744 KB Output is correct
4 Correct 45 ms 6668 KB Output is correct
5 Correct 38 ms 6748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 88 ms 6780 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 102 ms 6748 KB Output is correct
2 Correct 123 ms 6748 KB Output is correct
3 Correct 84 ms 6748 KB Output is correct
4 Correct 225 ms 6748 KB Output is correct
5 Incorrect 192 ms 6748 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 113 ms 6748 KB Output is correct
2 Correct 118 ms 6776 KB Output is correct
3 Correct 116 ms 6748 KB Output is correct
4 Correct 269 ms 6748 KB Output is correct
5 Correct 226 ms 6748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 120 ms 6744 KB Output is correct
2 Correct 144 ms 6744 KB Output is correct
3 Correct 101 ms 6748 KB Output is correct
4 Correct 275 ms 6748 KB Output is correct
5 Correct 228 ms 6776 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 123 ms 7040 KB Output is correct
2 Correct 139 ms 6996 KB Output is correct
3 Correct 142 ms 7096 KB Output is correct
4 Correct 323 ms 6992 KB Output is correct
5 Correct 244 ms 7044 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 140 ms 7032 KB Output is correct
2 Correct 162 ms 6992 KB Output is correct
3 Correct 119 ms 7036 KB Output is correct
4 Correct 316 ms 7248 KB Output is correct
5 Correct 269 ms 6992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 143 ms 7252 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 169 ms 7256 KB Output is correct
2 Correct 178 ms 7304 KB Output is correct
3 Correct 138 ms 7304 KB Output is correct
4 Correct 394 ms 7252 KB Output is correct
5 Incorrect 310 ms 7288 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 176 ms 8016 KB Output is correct
2 Correct 196 ms 8016 KB Output is correct
3 Correct 203 ms 8272 KB Output is correct
4 Correct 477 ms 8016 KB Output is correct
5 Correct 387 ms 8020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 202 ms 8068 KB Output is correct
2 Correct 220 ms 8260 KB Output is correct
3 Correct 175 ms 8276 KB Output is correct
4 Correct 444 ms 8020 KB Output is correct
5 Correct 386 ms 8260 KB Output is correct