# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
91773 |
2018-12-30T02:30:16 Z |
updown1 |
Mobile (BOI12_mobile) |
C++17 |
|
1000 ms |
63712 KB |
/*
binary search on the answer
to test a value x, for all the circles come up with ranges of the line that is covered if the circle has a radius x
find the minimum value x s.t. the whole line is covered
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i, a, b) for(int i=a; i<b; i++)
#define ffi For(i, 0, N)
#define ffj For(j, 0, N)
#define ffa ffi ffj
#define s <<" "<<
#define c <<" : "<<
#define w cout
#define e endl//"\n"
#define pb push_back
#define mp make_pair
#define a first
#define b second
#define int ll
#define double long double
const int MAXN=1000000, INF=1000000000000000000;
///500,000,000
int N, L;
pair<double, double> pts[MAXN], rng[MAXN];
bool full(double rr) {
/// make the ranges
ffi {
int x = pts[i].a, y = pts[i].b;
if (y*y > rr*rr) {rng[i] = mp(0, 0); continue;}
double l = x - sqrt(rr*rr-y*y); double r = x + sqrt(rr*rr-y*y);
l = max(l, (double) 0); l = min(l, (double)L);
r = max(r, (double) 0); r = min(r, (double)L);
rng[i] = mp(l, r);
}
//exit(0);
sort(rng, rng+N);
//w<< rr<<e; ffi w<< rng[i].a s rng[i].b<<e;
/// see if the whole range is covered
double far = 0;
ffi {
if (rng[i].a > far) return false;
far = max(far, rng[i].b);
}
return far >=L;
}
main() {
//ifstream cin("test.in");
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> N >> L;
ffi cin >> pts[i].a >> pts[i].b;
double a = 0, b = 2236067978;
while (b-a > .001) {
double mid = (a+b)/2;
if (full(mid)) b = mid;
else a = mid;
}
w<< fixed << setprecision(4) <<a<<e;
}
Compilation message
mobile.cpp:50:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main() {
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
504 KB |
Output is correct |
2 |
Correct |
14 ms |
504 KB |
Output is correct |
3 |
Correct |
10 ms |
504 KB |
Output is correct |
4 |
Correct |
10 ms |
508 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
632 KB |
Output is correct |
2 |
Correct |
19 ms |
788 KB |
Output is correct |
3 |
Correct |
28 ms |
760 KB |
Output is correct |
4 |
Correct |
25 ms |
760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
760 KB |
Output is correct |
2 |
Correct |
19 ms |
760 KB |
Output is correct |
3 |
Correct |
27 ms |
760 KB |
Output is correct |
4 |
Correct |
25 ms |
760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
760 KB |
Output is correct |
2 |
Correct |
18 ms |
632 KB |
Output is correct |
3 |
Correct |
27 ms |
844 KB |
Output is correct |
4 |
Correct |
27 ms |
760 KB |
Output is correct |
5 |
Correct |
26 ms |
692 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
441 ms |
5248 KB |
Output is correct |
2 |
Correct |
421 ms |
5368 KB |
Output is correct |
3 |
Correct |
349 ms |
3832 KB |
Output is correct |
4 |
Correct |
459 ms |
5240 KB |
Output is correct |
5 |
Correct |
281 ms |
3576 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
473 ms |
5496 KB |
Output is correct |
2 |
Correct |
425 ms |
4984 KB |
Output is correct |
3 |
Correct |
492 ms |
5752 KB |
Output is correct |
4 |
Correct |
481 ms |
5468 KB |
Output is correct |
5 |
Correct |
543 ms |
6008 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
466 ms |
6140 KB |
Output is correct |
2 |
Correct |
478 ms |
5624 KB |
Output is correct |
3 |
Correct |
607 ms |
5752 KB |
Output is correct |
4 |
Correct |
621 ms |
6776 KB |
Output is correct |
5 |
Correct |
554 ms |
6160 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
466 ms |
6852 KB |
Output is correct |
2 |
Correct |
584 ms |
6904 KB |
Output is correct |
3 |
Correct |
717 ms |
6836 KB |
Output is correct |
4 |
Correct |
621 ms |
6904 KB |
Output is correct |
5 |
Correct |
628 ms |
6936 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
510 ms |
6836 KB |
Output is correct |
2 |
Correct |
601 ms |
6908 KB |
Output is correct |
3 |
Correct |
754 ms |
6904 KB |
Output is correct |
4 |
Correct |
611 ms |
6904 KB |
Output is correct |
5 |
Correct |
627 ms |
6776 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1063 ms |
32396 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1068 ms |
32212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1068 ms |
38560 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1086 ms |
38392 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1060 ms |
44840 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1063 ms |
44712 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1090 ms |
51064 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1072 ms |
50936 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1084 ms |
63712 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1073 ms |
63560 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |