Submission #1098716

# Submission time Handle Problem Language Result Execution time Memory
1098716 2024-10-09T19:05:52 Z sano Mobile (BOI12_mobile) C++14
12 / 100
994 ms 9908 KB
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<string>
#include<fstream>
#include<algorithm>
#include <iomanip>
#include<map>
#include <set>
#include <unordered_map>
#include <stack>
#include <unordered_set>
#include <cmath>
#define ll long long
#define For(i, n) for(int i = 0; i < (int)n; i++)
#define ffor(i, a, n) for(int i = (int)a; i < (int)n; i++)
#define rfor(i, n) for(int i = (int)n; i >= (int)0; i--)
#define rffor(i, a, n) for(int i = (int)n; i >= (int)a; i--)
#define vec vector
#define ff first
#define ss second
#define pb push_back
#define shit short int
#define pii pair<int, int>
#define NEK 2147483640
#define mod 1000000007
#define mod2 1000000009
#define rsz resize 
#define prv1 43
#define prv2 47
#define D 8

using namespace std;

int main() {
	double n, asd;
	cin >> n >> asd;
	vec<pii> p;
	For(i, n) {
		double x, y;
		cin >> x >> y;
		if (p.size() > 0) {
			if (x == p.back().ff && y > 0 && p.back().ss > 0) continue;
			if (x == p.back().ff && y < 0) p.pop_back();
		}
		p.push_back({ x, y });
	}
	double l = 0;
	double r = 1414213570;
	while ((r - l) > (0.0000001)) {
		double mid = (l + r) / 2;
		double k = 0;
		For(i, p.size()) {
			double d = sqrt(mid * mid - p[i].ss * p[i].ss);
			double s = p[i].ff - d;
			double e = p[i].ff + d;
			if (s > k) continue;
			k = max(k, e);
		}
		if (k >= asd) r = mid;
		else l = mid;
	}
	cout << fixed << setprecision(3);
	cout << l << '\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 348 KB Output is correct
2 Correct 4 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Incorrect 4 ms 532 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 348 KB Output is correct
2 Correct 7 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Incorrect 4 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 348 KB Output is correct
2 Correct 4 ms 348 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Incorrect 5 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 64 ms 1356 KB Output is correct
2 Incorrect 58 ms 976 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 45 ms 592 KB Output is correct
2 Correct 60 ms 1036 KB Output is correct
3 Incorrect 74 ms 1492 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 52 ms 1416 KB Output is correct
2 Incorrect 63 ms 1012 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 65 ms 976 KB Output is correct
2 Incorrect 78 ms 972 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 76 ms 1492 KB Output is correct
2 Incorrect 61 ms 976 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 306 ms 5820 KB Output is correct
2 Correct 291 ms 596 KB Output is correct
3 Correct 320 ms 596 KB Output is correct
4 Incorrect 640 ms 5740 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 314 ms 436 KB Output is correct
2 Correct 508 ms 4540 KB Output is correct
3 Incorrect 271 ms 1484 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 364 ms 9908 KB Output is correct
2 Correct 375 ms 344 KB Output is correct
3 Incorrect 353 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 403 ms 432 KB Output is correct
2 Correct 585 ms 9168 KB Output is correct
3 Incorrect 315 ms 1476 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 423 ms 8592 KB Output is correct
2 Correct 409 ms 348 KB Output is correct
3 Correct 390 ms 424 KB Output is correct
4 Incorrect 849 ms 9144 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 426 ms 344 KB Output is correct
2 Correct 636 ms 8888 KB Output is correct
3 Incorrect 383 ms 1484 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 473 ms 8888 KB Output is correct
2 Correct 482 ms 428 KB Output is correct
3 Correct 452 ms 344 KB Output is correct
4 Incorrect 994 ms 9100 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 493 ms 468 KB Output is correct
2 Correct 749 ms 9396 KB Output is correct
3 Incorrect 411 ms 1484 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 577 ms 9656 KB Output is correct
2 Correct 568 ms 348 KB Output is correct
3 Incorrect 565 ms 668 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 614 ms 344 KB Output is correct
2 Correct 972 ms 9144 KB Output is correct
3 Incorrect 543 ms 2476 KB Output isn't correct
4 Halted 0 ms 0 KB -