Submission #670276

# Submission time Handle Problem Language Result Execution time Memory
670276 2022-12-08T14:28:42 Z RadicaI Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 131072 KB
#include <bits/stdc++.h>
using namespace std;
using ld = long double;
int main(){
	cout.precision(10);
	int n,siz; cin >> n>>siz;
	pair<ld, ld> stations[n];
	for(int i=0; i<n; i++) cin >> stations[i].first >> stations[i].second;
	ld l = 1e-5; ld r = 3e9;
	int random=0;
	ld ans=0;
	while(l<=r && random<=2){
		ld m = (l+r)/2.0;
		ld lowest=0.0; ld highest=l+0.0;
		set<pair<ld, int> > endp;
		for(int i=0; i<n; i++){
			if(abs(stations[i].second) <=m){
				ld ph = stations[i].first + sqrt(m*m-stations[i].second*stations[i].second);
				ld pl = stations[i].first - sqrt(m*m-stations[i].second*stations[i].second);
				endp.insert(make_pair(pl,0));
				endp.insert(make_pair(ph,1));
			}
		}
		bool check=true;
		int count=0;
		for(auto thing: endp){
			if(thing.second == 0) count++;
			else count--;
			if(thing.first <siz && count==0) check=false;
		}
		if(check){
			ans=m; if(r==m) random++; r=m;
		}else{
			if(l==m) random++; l=m;
		}
	}
	cout << ans;
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:34:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   34 |    if(l==m) random++; l=m;
      |    ^~
mobile.cpp:34:23: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   34 |    if(l==m) random++; l=m;
      |                       ^
mobile.cpp:14:6: warning: unused variable 'lowest' [-Wunused-variable]
   14 |   ld lowest=0.0; ld highest=l+0.0;
      |      ^~~~~~
mobile.cpp:14:21: warning: unused variable 'highest' [-Wunused-variable]
   14 |   ld lowest=0.0; ld highest=l+0.0;
      |                     ^~~~~~~
# 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 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 28 ms 808 KB Output is correct
2 Incorrect 25 ms 724 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 47 ms 1268 KB Output is correct
2 Incorrect 52 ms 1236 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 51 ms 1276 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 1236 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 15028 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 15564 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 17364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 20568 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 20560 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 98412 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 102372 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1097 ms 118128 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 122736 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 861 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 131048 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 918 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1074 ms 105604 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1062 ms 131072 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 56524 KB Time limit exceeded
2 Halted 0 ms 0 KB -