Submission #67577

# Submission time Handle Problem Language Result Execution time Memory
67577 2018-08-15T03:41:01 Z thebes Mobile (BOI12_mobile) C++14
0 / 100
842 ms 16376 KB
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,ssse3,sse3,sse4,popcnt,avx,mmx,abm,tune=native")
#include <bits/stdc++.h>
#define sq(x) ((x)*(x))
using namespace std;

#define int long long
const int MN = 1e6+6;
double lo, hi = 1e10, eps = 1e-4;
int N, M, i, j;
pair<int,int> pnt[MN];
inline bool check(double d){
	double mx = 0;
	for(int i=1;i<=N;i++){
		if(abs(pnt[i].second)>d) continue;
		double dx=sqrt(sq(d)-sq(pnt[i].second));
		if(pnt[i].first-dx<=mx) mx=max(mx,pnt[i].first+dx);
		else return 0;
	}
	return mx>=M; 
}

signed main(){
	for(scanf("%lld%lld",&N,&M),i=1;i<=N;i++)
		scanf("%lld%lld",&pnt[i].first,&pnt[i].second);
	sort(pnt+1,pnt+N+1,[](pair<int,int>i,pair<int,int>j){return i.first<j.first;});
	while(lo+eps<hi){
		double m = (lo+hi)/2.0;
		if(check(m)) hi=m;
		else lo=m+eps;
	}
	printf("%.4lf\n",lo);
	return 0;
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:25:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(scanf("%lld%lld",&N,&M),i=1;i<=N;i++)
      ~~~~~~~~~~~~~~~~~~~~~~~^~~~
mobile.cpp:26:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld%lld",&pnt[i].first,&pnt[i].second);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 3 ms 356 KB Output is correct
3 Incorrect 2 ms 356 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 560 KB Output is correct
2 Correct 3 ms 620 KB Output is correct
3 Correct 3 ms 652 KB Output is correct
4 Incorrect 2 ms 696 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 696 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 696 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 696 KB Output is correct
2 Correct 6 ms 696 KB Output is correct
3 Incorrect 6 ms 696 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 696 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 52 ms 1768 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 47 ms 1768 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 87 ms 1896 KB Output is correct
2 Incorrect 73 ms 1900 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 73 ms 2232 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 106 ms 2232 KB Output is correct
2 Incorrect 79 ms 2232 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 459 ms 8496 KB Output is correct
2 Incorrect 337 ms 8556 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 350 ms 8556 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 481 ms 10092 KB Output is correct
2 Incorrect 422 ms 10092 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 396 ms 10092 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 553 ms 11592 KB Output is correct
2 Incorrect 502 ms 11592 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 433 ms 11656 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 660 ms 13280 KB Output is correct
2 Incorrect 528 ms 13280 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 521 ms 13280 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 842 ms 16376 KB Output is correct
2 Incorrect 727 ms 16376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 614 ms 16376 KB Output isn't correct
2 Halted 0 ms 0 KB -