Submission #482621

# Submission time Handle Problem Language Result Execution time Memory
482621 2021-10-25T22:49:13 Z robell Mobile (BOI12_mobile) C++14
100 / 100
396 ms 35228 KB
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
typedef long long ll;
#define pb push_back
#define eb emplace_back
#define countbits __builtin_popcount
#define beg0 __builtin_clz
#define terminal0 __builtin_ctz
#define f first
#define s second
int mod=1e9+7;
void setIO(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
}
void setIO(string f){
	freopen((f+".in").c_str(),"r",stdin);
	freopen((f+".out").c_str(),"w",stdout);
	setIO();
}
ll N, L;
pair<ll,ll> pts[(int)1e6];
int main(){
	setIO(); cin >> N >> L;
	for (int i=0;i<N;i++){cin >> pts[i].f >> pts[i].s;}
	double l=1,r=1.5e9;
	while (abs(r-l)>1e-3){
		double mid = (l+r)/2;
		double pos = 0;
		for (int i=0;i<N;i++){
			double dist = sqrt(mid * mid - pts[i].s * pts[i].s);
			double xm = pts[i].f-dist, xma=pts[i].f+dist;
			if (xm<=pos) pos=max(pos,xma);
		}
		if (pos>=L) r=mid;
		else l=mid;
	}
	cout << fixed << setprecision(10) << l << "\n";
}

Compilation message

mobile.cpp: In function 'void setIO(std::string)':
mobile.cpp:21:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |  freopen((f+".in").c_str(),"r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:22:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |  freopen((f+".out").c_str(),"w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 320 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 460 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 336 KB Output is correct
2 Correct 2 ms 396 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 3 ms 588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 460 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 3 ms 460 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 31 ms 2252 KB Output is correct
2 Correct 22 ms 2592 KB Output is correct
3 Correct 15 ms 1776 KB Output is correct
4 Correct 30 ms 2572 KB Output is correct
5 Correct 14 ms 1496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 2252 KB Output is correct
2 Correct 24 ms 2212 KB Output is correct
3 Correct 27 ms 2556 KB Output is correct
4 Correct 30 ms 2756 KB Output is correct
5 Correct 33 ms 3144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 2252 KB Output is correct
2 Correct 24 ms 2764 KB Output is correct
3 Correct 32 ms 2500 KB Output is correct
4 Correct 40 ms 3788 KB Output is correct
5 Correct 27 ms 2556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 3340 KB Output is correct
2 Correct 28 ms 3272 KB Output is correct
3 Correct 26 ms 2892 KB Output is correct
4 Correct 40 ms 3788 KB Output is correct
5 Correct 34 ms 3120 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 3404 KB Output is correct
2 Correct 27 ms 3240 KB Output is correct
3 Correct 26 ms 2876 KB Output is correct
4 Correct 39 ms 3788 KB Output is correct
5 Correct 33 ms 3056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 118 ms 12356 KB Output is correct
2 Correct 148 ms 15840 KB Output is correct
3 Correct 135 ms 15284 KB Output is correct
4 Correct 199 ms 17672 KB Output is correct
5 Correct 168 ms 14924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 147 ms 14704 KB Output is correct
2 Correct 219 ms 12276 KB Output is correct
3 Correct 170 ms 12256 KB Output is correct
4 Correct 214 ms 12228 KB Output is correct
5 Correct 175 ms 12312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 141 ms 14836 KB Output is correct
2 Correct 166 ms 18956 KB Output is correct
3 Correct 164 ms 18380 KB Output is correct
4 Correct 242 ms 21476 KB Output is correct
5 Correct 198 ms 17572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 169 ms 15936 KB Output is correct
2 Correct 252 ms 13840 KB Output is correct
3 Correct 158 ms 16520 KB Output is correct
4 Correct 237 ms 21368 KB Output is correct
5 Correct 214 ms 18520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 159 ms 17260 KB Output is correct
2 Correct 198 ms 22072 KB Output is correct
3 Correct 210 ms 21416 KB Output is correct
4 Correct 274 ms 24820 KB Output is correct
5 Correct 233 ms 20248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 195 ms 17460 KB Output is correct
2 Correct 283 ms 15300 KB Output is correct
3 Correct 186 ms 19584 KB Output is correct
4 Correct 268 ms 24616 KB Output is correct
5 Correct 249 ms 21380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 184 ms 19412 KB Output is correct
2 Correct 234 ms 25320 KB Output is correct
3 Correct 244 ms 24380 KB Output is correct
4 Correct 315 ms 28356 KB Output is correct
5 Correct 299 ms 24024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 271 ms 19012 KB Output is correct
2 Correct 316 ms 16972 KB Output is correct
3 Correct 260 ms 22412 KB Output is correct
4 Correct 309 ms 28228 KB Output is correct
5 Correct 279 ms 24360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 239 ms 22628 KB Output is correct
2 Correct 315 ms 31476 KB Output is correct
3 Correct 283 ms 30592 KB Output is correct
4 Correct 396 ms 35012 KB Output is correct
5 Correct 346 ms 29508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 281 ms 19928 KB Output is correct
2 Correct 383 ms 20100 KB Output is correct
3 Correct 274 ms 28204 KB Output is correct
4 Correct 388 ms 35228 KB Output is correct
5 Correct 353 ms 30832 KB Output is correct