Submission #605457

#TimeUsernameProblemLanguageResultExecution timeMemory
605457bzhu524Mobile (BOI12_mobile)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#define ll long long 

using namespace std;

pair<ll, ll> p[1000000];


int main() {
	ios_base::sync_with_stdio(false);
	int n, len;

	cin >> n >> len;

	for (int i=0; i<n; i++) cin >> p[i].first >> p[i].second;

	double lower = 1;
	double upper = 1000000000;

	while (upper - lower >= 1e-3) {
		double mid = (upper + lower) / 2;
		double currPoint = 0;
		for (int i=0; i<n; i++) {
			ll x = p[i].first;
			ll y = p[i].second;
			
			double delta = sqrt(mid * mid - y * y);
			double p1 = x - delta;
			double p2 = x + delta;

			if (p1 <= currPoint) {
				currPoint = Math.max(currPoint, p2);
			}
		}

		if (currPoint < len) {
			lower = mid;
		} else {
			upper = mid;
		}
	}

	cout << setprecision(4) << lower << "\n";
}

Compilation message (stderr)

mobile.cpp: In function 'int main()':
mobile.cpp:32:17: error: 'Math' was not declared in this scope
   32 |     currPoint = Math.max(currPoint, p2);
      |                 ^~~~