# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1108154 |
2024-11-03T04:01:23 Z |
akamizane |
Mobile (BOI12_mobile) |
C++17 |
|
520 ms |
36284 KB |
#include<bits/stdc++.h>
using namespace std;
#define debug(...) 40
using ll = long long;
using pii = pair<int,int>;
using db = double;
#define el cout << '\n'
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FOD(i, a, b) for (int i = (a); i >= (b); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
template <class T1, class T2>bool chmax(T1 &a, T2 b){return a < b ? a = b, 1 : 0;}
template <class T1, class T2>bool chmin(T1 &a, T2 b){return a > b ? a = b, 1 : 0;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int maxn = 2e5 + 5;
const ll mod = 1e9 + 7;
void solve(){
int n, len;
cin >> n >> len;
vector<pair<ll, ll>> a;
for (int i = 0; i < n; i++){
double x, y;
cin >> x >> y;
a.pb({x, y});
}
debug(a);
auto check = [&] (double mid){
double right = 0;
for (int i = 0; i < n; i++){
auto [x, y] = a[i];
auto d = sqrt(mid * mid - y * y);
debug(d);
double x1 = x - d, x2 = x + d;
if (x1 <= right){
chmax(right, x2);
}
}
return right >= len;
};
double l = 1, r = 1.5e9;
while(r - l > 1e-3){
double m = (l + r) / 2;
if (check(m)) r = m;
else l = m;
}
cout << setprecision(4) << fixed << r;
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int tests = 1;
// cin >> tests;
for (int _ = 1; _ <= tests; _++){
cerr << "- Case #" << _ << ": \n";
solve();
el;
}
return 0;
}
Compilation message
mobile.cpp: In function 'void solve()':
mobile.cpp:6:20: warning: statement has no effect [-Wunused-value]
6 | #define debug(...) 40
| ^~
mobile.cpp:39:3: note: in expansion of macro 'debug'
39 | debug(a);
| ^~~~~
mobile.cpp: In lambda function:
mobile.cpp:6:20: warning: statement has no effect [-Wunused-value]
6 | #define debug(...) 40
| ^~
mobile.cpp:45:7: note: in expansion of macro 'debug'
45 | debug(d);
| ^~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
336 KB |
Output is correct |
2 |
Correct |
2 ms |
592 KB |
Output is correct |
3 |
Correct |
2 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
592 KB |
Output is correct |
2 |
Correct |
3 ms |
592 KB |
Output is correct |
3 |
Correct |
3 ms |
480 KB |
Output is correct |
4 |
Correct |
4 ms |
592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
592 KB |
Output is correct |
2 |
Correct |
3 ms |
592 KB |
Output is correct |
3 |
Correct |
3 ms |
608 KB |
Output is correct |
4 |
Correct |
3 ms |
592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
592 KB |
Output is correct |
2 |
Correct |
3 ms |
592 KB |
Output is correct |
3 |
Correct |
3 ms |
592 KB |
Output is correct |
4 |
Correct |
4 ms |
592 KB |
Output is correct |
5 |
Correct |
3 ms |
764 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
4300 KB |
Output is correct |
2 |
Correct |
31 ms |
3532 KB |
Output is correct |
3 |
Correct |
23 ms |
2256 KB |
Output is correct |
4 |
Correct |
48 ms |
4680 KB |
Output is correct |
5 |
Correct |
20 ms |
2000 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
40 ms |
4044 KB |
Output is correct |
2 |
Correct |
34 ms |
3532 KB |
Output is correct |
3 |
Correct |
39 ms |
3532 KB |
Output is correct |
4 |
Correct |
40 ms |
4552 KB |
Output is correct |
5 |
Correct |
45 ms |
3600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
33 ms |
3532 KB |
Output is correct |
2 |
Correct |
31 ms |
3488 KB |
Output is correct |
3 |
Correct |
34 ms |
4556 KB |
Output is correct |
4 |
Correct |
53 ms |
4984 KB |
Output is correct |
5 |
Correct |
40 ms |
4568 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
41 ms |
3532 KB |
Output is correct |
2 |
Correct |
42 ms |
4812 KB |
Output is correct |
3 |
Correct |
39 ms |
4556 KB |
Output is correct |
4 |
Correct |
59 ms |
5068 KB |
Output is correct |
5 |
Correct |
47 ms |
4632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
47 ms |
3432 KB |
Output is correct |
2 |
Correct |
41 ms |
3532 KB |
Output is correct |
3 |
Correct |
37 ms |
4356 KB |
Output is correct |
4 |
Correct |
59 ms |
5060 KB |
Output is correct |
5 |
Correct |
47 ms |
4612 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
175 ms |
10832 KB |
Output is correct |
2 |
Correct |
200 ms |
16304 KB |
Output is correct |
3 |
Correct |
190 ms |
15792 KB |
Output is correct |
4 |
Correct |
269 ms |
18352 KB |
Output is correct |
5 |
Correct |
226 ms |
15536 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
194 ms |
10680 KB |
Output is correct |
2 |
Correct |
303 ms |
15204 KB |
Output is correct |
3 |
Correct |
192 ms |
14492 KB |
Output is correct |
4 |
Correct |
251 ms |
18092 KB |
Output is correct |
5 |
Correct |
245 ms |
16052 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
208 ms |
20612 KB |
Output is correct |
2 |
Correct |
238 ms |
27316 KB |
Output is correct |
3 |
Correct |
240 ms |
26684 KB |
Output is correct |
4 |
Correct |
310 ms |
29608 KB |
Output is correct |
5 |
Correct |
274 ms |
26192 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
242 ms |
24088 KB |
Output is correct |
2 |
Correct |
320 ms |
26052 KB |
Output is correct |
3 |
Correct |
214 ms |
25296 KB |
Output is correct |
4 |
Correct |
290 ms |
29432 KB |
Output is correct |
5 |
Correct |
262 ms |
26812 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
234 ms |
22208 KB |
Output is correct |
2 |
Correct |
263 ms |
27312 KB |
Output is correct |
3 |
Correct |
264 ms |
26816 KB |
Output is correct |
4 |
Correct |
346 ms |
29360 KB |
Output is correct |
5 |
Correct |
308 ms |
25776 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
280 ms |
19036 KB |
Output is correct |
2 |
Correct |
371 ms |
25604 KB |
Output is correct |
3 |
Correct |
268 ms |
25292 KB |
Output is correct |
4 |
Correct |
376 ms |
29184 KB |
Output is correct |
5 |
Correct |
323 ms |
26708 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
277 ms |
18864 KB |
Output is correct |
2 |
Correct |
330 ms |
27312 KB |
Output is correct |
3 |
Correct |
326 ms |
26816 KB |
Output is correct |
4 |
Correct |
405 ms |
30396 KB |
Output is correct |
5 |
Correct |
376 ms |
26768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
310 ms |
18864 KB |
Output is correct |
2 |
Correct |
443 ms |
25404 KB |
Output is correct |
3 |
Correct |
306 ms |
25268 KB |
Output is correct |
4 |
Correct |
400 ms |
30376 KB |
Output is correct |
5 |
Correct |
398 ms |
26684 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
358 ms |
23476 KB |
Output is correct |
2 |
Correct |
397 ms |
32540 KB |
Output is correct |
3 |
Correct |
386 ms |
31336 KB |
Output is correct |
4 |
Correct |
520 ms |
36024 KB |
Output is correct |
5 |
Correct |
436 ms |
30436 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
390 ms |
18864 KB |
Output is correct |
2 |
Correct |
506 ms |
28508 KB |
Output is correct |
3 |
Correct |
378 ms |
29168 KB |
Output is correct |
4 |
Correct |
500 ms |
36284 KB |
Output is correct |
5 |
Correct |
461 ms |
31656 KB |
Output is correct |