Submission #639128

# Submission time Handle Problem Language Result Execution time Memory
639128 2022-09-08T16:21:50 Z luanaamorim Mobile (BOI12_mobile) C++14
0 / 100
736 ms 16092 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++)
	{
		if (raio < b[i]) return 0;
		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 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 368 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 49 ms 1568 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 57 ms 1564 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 83 ms 1692 KB Output is correct
2 Incorrect 67 ms 1644 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 69 ms 1792 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 75 ms 1784 KB Output is correct
2 Incorrect 68 ms 1868 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 330 ms 8072 KB Output is correct
2 Correct 352 ms 8148 KB Output is correct
3 Correct 398 ms 8244 KB Output is correct
4 Incorrect 386 ms 8140 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 375 ms 8272 KB Output is correct
2 Incorrect 323 ms 8100 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 406 ms 9868 KB Output is correct
2 Incorrect 356 ms 9712 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 436 ms 9620 KB Output is correct
2 Incorrect 401 ms 9716 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 482 ms 11204 KB Output is correct
2 Incorrect 428 ms 11280 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 431 ms 11280 KB Output is correct
2 Incorrect 510 ms 11380 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 522 ms 12756 KB Output is correct
2 Incorrect 551 ms 12748 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 638 ms 12844 KB Output is correct
2 Incorrect 552 ms 12784 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 657 ms 15904 KB Output is correct
2 Incorrect 688 ms 16092 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 736 ms 16060 KB Output is correct
2 Incorrect 673 ms 15976 KB Output isn't correct
3 Halted 0 ms 0 KB -