Submission #388965

# Submission time Handle Problem Language Result Execution time Memory
388965 2021-04-13T11:52:22 Z tostes Mobile (BOI12_mobile) C++17
0 / 100
918 ms 35280 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.0001){
		double mid=(lo+hi)/2;
		if(pos(mid)) hi=mid;
		else lo=mid;
	}
	printf("%.5lf\n", (lo+hi)/2);
}

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 360 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Incorrect 2 ms 332 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 4 ms 308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 312 KB Output is correct
2 Correct 4 ms 332 KB Output is correct
3 Correct 4 ms 412 KB Output is correct
4 Incorrect 5 ms 440 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 48 ms 2216 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 51 ms 2276 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 61 ms 2300 KB Output is correct
2 Correct 64 ms 2628 KB Output is correct
3 Correct 50 ms 2492 KB Output is correct
4 Incorrect 96 ms 3752 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 70 ms 3516 KB Output is correct
2 Correct 66 ms 3248 KB Output is correct
3 Correct 57 ms 2880 KB Output is correct
4 Incorrect 93 ms 3780 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 65 ms 3368 KB Output is correct
2 Correct 71 ms 3256 KB Output is correct
3 Correct 57 ms 2884 KB Output is correct
4 Incorrect 91 ms 3804 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 285 ms 12416 KB Output is correct
2 Correct 329 ms 15916 KB Output is correct
3 Correct 328 ms 15280 KB Output is correct
4 Incorrect 448 ms 17696 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 347 ms 16324 KB Output is correct
2 Incorrect 344 ms 14728 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 340 ms 14860 KB Output is correct
2 Correct 388 ms 19012 KB Output is correct
3 Correct 388 ms 18380 KB Output is correct
4 Incorrect 555 ms 21712 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 429 ms 19556 KB Output is correct
2 Incorrect 424 ms 17616 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 405 ms 17304 KB Output is correct
2 Correct 450 ms 22084 KB Output is correct
3 Correct 462 ms 21520 KB Output is correct
4 Incorrect 656 ms 24800 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 461 ms 22852 KB Output is correct
2 Incorrect 478 ms 20424 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 457 ms 19752 KB Output is correct
2 Correct 521 ms 25228 KB Output is correct
3 Correct 512 ms 24452 KB Output is correct
4 Incorrect 727 ms 28440 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 524 ms 26192 KB Output is correct
2 Incorrect 538 ms 23388 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 563 ms 24648 KB Output is correct
2 Correct 644 ms 31432 KB Output is correct
3 Correct 633 ms 30532 KB Output is correct
4 Incorrect 918 ms 35280 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 655 ms 32604 KB Output is correct
2 Incorrect 663 ms 29172 KB Output isn't correct
3 Halted 0 ms 0 KB -