Submission #638431

# Submission time Handle Problem Language Result Execution time Memory
638431 2022-09-06T00:36:31 Z LeticiaFCS Mobile (BOI12_mobile) C++17
55 / 100
1000 ms 35188 KB
#include "bits/stdc++.h"
#define st first
#define nd second
using lint = int64_t;
constexpr int MOD = int(1e9) + 7;
constexpr int INF = 0x3f3f3f3f;
constexpr int NINF = 0xcfcfcfcf;
constexpr lint LINF = 0x3f3f3f3f3f3f3f3f;
const long double PI = acosl(-1.0);
// Returns -1 if a < b, 0 if a = b and 1 if a > b.
int cmp_double(double a, double b = 0, double eps = 1e-9) {
	return a + eps > b ? b + eps > a ? 0 : 1 : -1;
}
using namespace std;

using ld = long double;

int main() {
	cin.tie(nullptr)->sync_with_stdio(false);
	int n;
	lint length;
	cin>>n>>length;
	vector<lint> x(n), y(n);
	for(int i=0; i<n; i++)
		cin>>x[i]>>y[i];
	
	ld l = 0, r = length;
	int it = 100;
	while(it--){
		ld mid = (l+r)/2;
		ld lastX = 0;
		for(int i=0; i<n; i++){
			ld xaux = sqrtl(mid*mid - y[i]*y[i]);
			ld a = x[i] - xaux;
			ld b = x[i] + xaux;
			if(a <= lastX + 1e-9)
				lastX = max(lastX, b);
		}
				
		if(length <= lastX + 1e-9) r = mid;
		else l = mid;
	}
	cout<<fixed<<setprecision(5)<<r<<"\n";
	

	return 0;
}
/*
[  ]Leu o problema certo???
[  ]Ver se precisa de long long
[  ]Viu o limite dos fors (é n? é m?)
[  ]Tamanho do vetor, será que é 2e5 em vez de 1e5??
[  ]Testar sample
[  ]Testar casos de  borda
[  ]1LL no 1LL << i
[  ]Testar mod (é 1e9+7, mesmo?, será que o mod não ficou negativo?)
*/
# 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 320 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 6 ms 380 KB Output is correct
2 Correct 2 ms 284 KB Output is correct
3 Correct 4 ms 332 KB Output is correct
4 Correct 2 ms 328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 332 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 5 ms 340 KB Output is correct
4 Correct 10 ms 476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 452 KB Output is correct
2 Correct 6 ms 468 KB Output is correct
3 Correct 8 ms 468 KB Output is correct
4 Correct 12 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 340 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 6 ms 340 KB Output is correct
4 Correct 11 ms 480 KB Output is correct
5 Correct 11 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 163 ms 1748 KB Output is correct
2 Correct 44 ms 1776 KB Output is correct
3 Correct 50 ms 1364 KB Output is correct
4 Correct 165 ms 1756 KB Output is correct
5 Correct 98 ms 1352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 154 ms 1748 KB Output is correct
2 Correct 143 ms 1680 KB Output is correct
3 Correct 173 ms 1844 KB Output is correct
4 Correct 156 ms 1748 KB Output is correct
5 Correct 169 ms 1876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 52 ms 1932 KB Output is correct
2 Correct 52 ms 1748 KB Output is correct
3 Correct 76 ms 1876 KB Output is correct
4 Correct 195 ms 2132 KB Output is correct
5 Correct 169 ms 1960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 79 ms 2140 KB Output is correct
2 Correct 56 ms 2132 KB Output is correct
3 Correct 95 ms 2116 KB Output is correct
4 Correct 195 ms 2132 KB Output is correct
5 Correct 191 ms 2100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 62 ms 2132 KB Output is correct
2 Correct 57 ms 2132 KB Output is correct
3 Correct 91 ms 2132 KB Output is correct
4 Correct 196 ms 2132 KB Output is correct
5 Correct 207 ms 2252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 294 ms 8328 KB Output is correct
2 Correct 290 ms 8396 KB Output is correct
3 Correct 294 ms 8404 KB Output is correct
4 Correct 967 ms 8396 KB Output is correct
5 Correct 968 ms 14976 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 294 ms 8524 KB Output is correct
2 Execution timed out 1035 ms 8400 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 348 ms 9932 KB Output is correct
2 Correct 369 ms 9964 KB Output is correct
3 Correct 352 ms 9932 KB Output is correct
4 Execution timed out 1065 ms 9904 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 349 ms 10004 KB Output is correct
2 Execution timed out 1076 ms 9864 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 425 ms 11532 KB Output is correct
2 Correct 402 ms 22132 KB Output is correct
3 Correct 436 ms 21516 KB Output is correct
4 Execution timed out 1052 ms 24780 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 409 ms 11596 KB Output is correct
2 Execution timed out 1084 ms 11428 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 479 ms 13096 KB Output is correct
2 Correct 489 ms 25400 KB Output is correct
3 Correct 492 ms 24524 KB Output is correct
4 Execution timed out 1043 ms 28492 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 480 ms 13100 KB Output is correct
2 Execution timed out 1079 ms 23372 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 587 ms 16232 KB Output is correct
2 Correct 607 ms 31532 KB Output is correct
3 Correct 610 ms 30584 KB Output is correct
4 Execution timed out 1043 ms 35188 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 562 ms 15992 KB Output is correct
2 Execution timed out 1044 ms 29164 KB Time limit exceeded
3 Halted 0 ms 0 KB -