Submission #388967

# Submission time Handle Problem Language Result Execution time Memory
388967 2021-04-13T11:57:32 Z tostes Mobile (BOI12_mobile) C++17
0 / 100
978 ms 15952 KB
#include<bits/stdc++.h>
//#include<iostream>
//#include<vector>
using namespace std;
#define _ << ' ' <<
#define pb push_back
#define all(x) begin(x), end(x)
#define mp make_pair
#define f first
#define s second
#define sz(x) int((x).size())
using ll = long long;
using db = long double;
using pl = pair<ll,ll>;
using pi = pair<int,int>;

vector < pair<double,double> > pt;
int n; 
double l;

bool pos(double k){
	double sm=0;
	for(int i=0; i<n; i++){
		if(pt[i].s>=k) continue;
		double sq = sqrt(k*k-pt[i].s*pt[i].s);
		if(pt[i].f-sq<=sm) sm=pt[i].f+sq;
	}
	return sm>=l;
}

int main(){
//	ios::sync_with_stdio(false);
 //	cin.tie(0);
	//freopen("loan.in", "r", stdin);
	//freopen("loan.out", "w", stdout);
	scanf("%d %lf", &n, &l);
	pt.resize(n);
	for(auto &x: pt) scanf("%lf %lf", &x.f, &x.s);
	double lo=0, hi=1e10;

	while((hi-lo)>0.00001){
		double mid=(lo+hi)/2;
		if(pos(mid)) hi=mid;
		else lo=mid;
	}
	printf("%.6lf\n", lo);
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:36:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   36 |  scanf("%d %lf", &n, &l);
      |  ~~~~~^~~~~~~~~~~~~~~~~~
mobile.cpp:38:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   38 |  for(auto &x: pt) scanf("%lf %lf", &x.f, &x.s);
      |                   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Incorrect 2 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 332 KB Output is correct
2 Correct 4 ms 332 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Incorrect 5 ms 332 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 49 ms 1456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 48 ms 1488 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 50 ms 1660 KB Output is correct
2 Correct 52 ms 1572 KB Output is correct
3 Correct 49 ms 1612 KB Output is correct
4 Incorrect 97 ms 1852 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 65 ms 1740 KB Output is correct
2 Correct 63 ms 1868 KB Output is correct
3 Correct 57 ms 1868 KB Output is correct
4 Incorrect 94 ms 1848 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 65 ms 1868 KB Output is correct
2 Correct 64 ms 1848 KB Output is correct
3 Correct 56 ms 1740 KB Output is correct
4 Incorrect 102 ms 1868 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 306 ms 8012 KB Output is correct
2 Correct 339 ms 8116 KB Output is correct
3 Correct 319 ms 8120 KB Output is correct
4 Incorrect 461 ms 8132 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 328 ms 8012 KB Output is correct
2 Incorrect 357 ms 8120 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 347 ms 9676 KB Output is correct
2 Correct 393 ms 9676 KB Output is correct
3 Correct 387 ms 9680 KB Output is correct
4 Incorrect 559 ms 9680 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 389 ms 9676 KB Output is correct
2 Incorrect 427 ms 9676 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 410 ms 11248 KB Output is correct
2 Correct 470 ms 11212 KB Output is correct
3 Correct 451 ms 11252 KB Output is correct
4 Incorrect 653 ms 11216 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 487 ms 11240 KB Output is correct
2 Incorrect 513 ms 11332 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 482 ms 12808 KB Output is correct
2 Correct 576 ms 12812 KB Output is correct
3 Correct 532 ms 12808 KB Output is correct
4 Incorrect 765 ms 12812 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 559 ms 12812 KB Output is correct
2 Incorrect 648 ms 12804 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 665 ms 15948 KB Output is correct
2 Correct 670 ms 15948 KB Output is correct
3 Correct 666 ms 15952 KB Output is correct
4 Incorrect 978 ms 15948 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 680 ms 15948 KB Output is correct
2 Incorrect 665 ms 15948 KB Output isn't correct
3 Halted 0 ms 0 KB -