Submission #838467

# Submission time Handle Problem Language Result Execution time Memory
838467 2023-08-27T06:47:38 Z fanwen Mobile (BOI12_mobile) C++17
100 / 100
426 ms 27620 KB
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1e6 + 5;

int N, L;
pair <int, int> p[MAXN];

void you_make_it(void) {
	cin >> N >> L;
	for (int i = 0; i < N; ++i) cin >> p[i].first >> p[i].second;

	double l = 0, r = 1.5e9;
	while(r - l > 1e-6) {
		double mid = (l + r) / 2.0, res = 0;
		for (int i = 0; i < N; ++i) {
			double dist = sqrt(mid * mid - 1LL * p[i].second * p[i].second);
			double a = p[i].first - dist, b = p[i].first + dist;
			if(a <= res) res = max(res, b);
		}
		if(res <= L) l = mid;
		else r = mid;
	}
	cout << fixed << setprecision(6) << l;
}

signed main() {

#ifdef LOCAL
    freopen("TASK.inp", "r", stdin);
    freopen("TASK.out", "w", stdout);
#endif
    auto start_time = chrono::steady_clock::now();

    cin.tie(0), cout.tie(0) -> sync_with_stdio(0);

    you_make_it();

    auto end_time = chrono::steady_clock::now();

    cerr << "\nExecution time : " << chrono::duration_cast <chrono::milliseconds> (end_time - start_time).count() << "[ms]" << endl;

    return (0 ^ 0);
}

// Dream it. Wish it. Do it.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 404 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 464 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 31 ms 1620 KB Output is correct
2 Correct 21 ms 2004 KB Output is correct
3 Correct 15 ms 1364 KB Output is correct
4 Correct 26 ms 2004 KB Output is correct
5 Correct 14 ms 1120 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 1620 KB Output is correct
2 Correct 24 ms 1688 KB Output is correct
3 Correct 26 ms 1876 KB Output is correct
4 Correct 27 ms 2132 KB Output is correct
5 Correct 34 ms 2508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 1620 KB Output is correct
2 Correct 26 ms 2176 KB Output is correct
3 Correct 23 ms 1856 KB Output is correct
4 Correct 42 ms 3040 KB Output is correct
5 Correct 28 ms 1876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 2532 KB Output is correct
2 Correct 27 ms 2388 KB Output is correct
3 Correct 27 ms 2132 KB Output is correct
4 Correct 38 ms 3020 KB Output is correct
5 Correct 37 ms 2348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 2516 KB Output is correct
2 Correct 28 ms 2380 KB Output is correct
3 Correct 27 ms 2036 KB Output is correct
4 Correct 39 ms 3020 KB Output is correct
5 Correct 39 ms 2376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 126 ms 8448 KB Output is correct
2 Correct 141 ms 11944 KB Output is correct
3 Correct 136 ms 11340 KB Output is correct
4 Correct 185 ms 13772 KB Output is correct
5 Correct 171 ms 11056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 143 ms 12432 KB Output is correct
2 Correct 244 ms 10740 KB Output is correct
3 Correct 132 ms 9976 KB Output is correct
4 Correct 180 ms 13516 KB Output is correct
5 Correct 164 ms 11536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 144 ms 10092 KB Output is correct
2 Correct 166 ms 14220 KB Output is correct
3 Correct 162 ms 13656 KB Output is correct
4 Correct 223 ms 16912 KB Output is correct
5 Correct 198 ms 13000 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 173 ms 15000 KB Output is correct
2 Correct 277 ms 12828 KB Output is correct
3 Correct 164 ms 11852 KB Output is correct
4 Correct 222 ms 16744 KB Output is correct
5 Correct 201 ms 13820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 183 ms 11864 KB Output is correct
2 Correct 203 ms 16588 KB Output is correct
3 Correct 211 ms 15964 KB Output is correct
4 Correct 263 ms 19340 KB Output is correct
5 Correct 247 ms 14836 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 197 ms 17236 KB Output is correct
2 Correct 316 ms 15044 KB Output is correct
3 Correct 190 ms 14184 KB Output is correct
4 Correct 255 ms 19276 KB Output is correct
5 Correct 234 ms 15932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 192 ms 13392 KB Output is correct
2 Correct 223 ms 18992 KB Output is correct
3 Correct 213 ms 18124 KB Output is correct
4 Correct 311 ms 22240 KB Output is correct
5 Correct 265 ms 17736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 227 ms 19772 KB Output is correct
2 Correct 352 ms 17152 KB Output is correct
3 Correct 213 ms 16032 KB Output is correct
4 Correct 305 ms 22124 KB Output is correct
5 Correct 326 ms 18068 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 241 ms 16832 KB Output is correct
2 Correct 289 ms 23592 KB Output is correct
3 Correct 267 ms 22612 KB Output is correct
4 Correct 364 ms 27280 KB Output is correct
5 Correct 370 ms 21696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 285 ms 24796 KB Output is correct
2 Correct 426 ms 21352 KB Output is correct
3 Correct 281 ms 20432 KB Output is correct
4 Correct 373 ms 27620 KB Output is correct
5 Correct 331 ms 22892 KB Output is correct