Submission #639127

# Submission time Handle Problem Language Result Execution time Memory
639127 2022-09-08T16:20:01 Z luanaamorim Mobile (BOI12_mobile) C++14
0 / 100
732 ms 31460 KB
#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring>
#include <set>
#include <stack>
#include <bitset>
#define dbug(x) cout << (#x) << " -> " << x << endl
#define ll long long
#define INF (1e12)
#define MAX (int) (2e6 + 5)
#define MOD 1000000007
#define par pair<int, int>
#define all(v) v.begin(), v.end()
#define sz(x) (int) ((x).size())
#define esq(x) (x<<1)
#define dir(x) ((x<<1)|1)
#define lsb(x) (x & -x)
#define W(x) cout << #x << ": " << x << endl
#define Wii(x) cout << x.first << ' ' << x.second << endl
#define _ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

double l, n, a[MAX], b[MAX];

int check(double raio)
{
	double fim = 0;
	for (int i = 0; i < n; i++)
	{
		double prox_fim = a[i] + sqrt((raio*raio) - (b[i]*b[i]));
		double prox_ini = a[i] - (sqrt((raio*raio) - (b[i]*b[i])));
		if (prox_ini <= fim) fim = prox_fim;
		else return 0;
	}

	return (fim >= l);
}

int main()
{_
	cin >> n >> l;
	for (int i = 0; i < n; i++)
		cin >> a[i] >> b[i];

	int cnt = 100;
	double meio, ini = 0, fim = INF;
	while (cnt--)
	{
		meio = (ini+fim)/2;
		if (check(meio)) fim = meio;
		else ini = meio;
	}

	cout << fixed << setprecision(6) << fim << endl;
}















# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 48 ms 1424 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 1436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 73 ms 1652 KB Output is correct
2 Incorrect 60 ms 1544 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 59 ms 1848 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 81 ms 1788 KB Output is correct
2 Incorrect 68 ms 1884 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 342 ms 10476 KB Output is correct
2 Correct 358 ms 15860 KB Output is correct
3 Correct 339 ms 15332 KB Output is correct
4 Incorrect 392 ms 17700 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 364 ms 11800 KB Output is correct
2 Incorrect 317 ms 14640 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 410 ms 13008 KB Output is correct
2 Incorrect 358 ms 18980 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 386 ms 13532 KB Output is correct
2 Incorrect 407 ms 17580 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 458 ms 15420 KB Output is correct
2 Incorrect 414 ms 22092 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 432 ms 15288 KB Output is correct
2 Incorrect 459 ms 20572 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 518 ms 17488 KB Output is correct
2 Incorrect 545 ms 25280 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 574 ms 17264 KB Output is correct
2 Incorrect 548 ms 23404 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 657 ms 20948 KB Output is correct
2 Incorrect 694 ms 31460 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 732 ms 23596 KB Output is correct
2 Incorrect 660 ms 29368 KB Output isn't correct
3 Halted 0 ms 0 KB -