# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1111206 |
2024-11-11T17:14:16 Z |
squatrian |
Mobile (BOI12_mobile) |
C++17 |
|
753 ms |
35292 KB |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
using std::mt19937_64;
using std::random_device;
using std::uniform_int_distribution;
#include <numeric>
#define ff first
#define ss second
#define int long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#define pqb priority_queue<int>
#define pqs priority_queue<int,vi,greater<int> >
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define mk(arr,n,type) type *arr=new type[n];
#define w(x) int x; cin>>x; while(x--)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void c_p_c()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//#ifndef ONLINE_JUDGE
// freopen("milkvisits.in", "r", stdin);
//freopen("milkvisits.out", "w", stdout);
//#endif
}
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int exp(int x, int n, int m) {
if(x == 0 and n == 0) return 1;
x %= m;
int res = 1;
while (n > 0) {
if (n % 2 == 1) { res = res * x % m; }
x = x * x % m;
n /= 2;
}
return res;
}
bool check(double mid,vector<pair<int,int>> &v,int k,int n){
double dist = mid*mid;
double cur = 0;
for(int i = 0 ; i < n; i++){
double disty = v[i].ss*v[i].ss;
if(dist-disty >= 0){
double x = (v[i].ff + sqrtl(dist-disty));
double x2 = (v[i].ff - sqrtl(dist-disty));
if(x2 <= cur){
cur = max(x,cur);
}
}
}
return (cur >= k);
}
signed main()
{
int t=1;
c_p_c();
// cin >> t;
while(t--){
int n,k;
cin >> n >> k;
vector<pair<int,int>> v(n);
for(int i = 0 ; i < n; i++){
cin >> v[i].ff >> v[i].ss;
}
double l = 0, r = 1500000000;
double ans;
while(l <= r){
double mid = l + (r-l)/2;
if(check(mid,v,k,n)){
ans = mid;
r = mid-0.0001;
}
else{
l = mid+0.0001;
}
}
cout<<fixed<<setprecision(4);
cout<<ans<<endl;
}
return 0;
}
# |
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 |
3 ms |
336 KB |
Output is correct |
3 |
Correct |
2 ms |
336 KB |
Output is correct |
4 |
Correct |
2 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
336 KB |
Output is correct |
2 |
Correct |
5 ms |
592 KB |
Output is correct |
3 |
Correct |
4 ms |
336 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 |
4 ms |
592 KB |
Output is correct |
3 |
Correct |
4 ms |
336 KB |
Output is correct |
4 |
Correct |
3 ms |
592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
592 KB |
Output is correct |
2 |
Correct |
5 ms |
592 KB |
Output is correct |
3 |
Correct |
4 ms |
336 KB |
Output is correct |
4 |
Correct |
2 ms |
592 KB |
Output is correct |
5 |
Correct |
3 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
48 ms |
2384 KB |
Output is correct |
2 |
Correct |
59 ms |
2640 KB |
Output is correct |
3 |
Correct |
34 ms |
1872 KB |
Output is correct |
4 |
Correct |
26 ms |
2640 KB |
Output is correct |
5 |
Correct |
25 ms |
1620 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
1616 KB |
Output is correct |
2 |
Correct |
30 ms |
2128 KB |
Output is correct |
3 |
Correct |
32 ms |
2640 KB |
Output is correct |
4 |
Correct |
28 ms |
2896 KB |
Output is correct |
5 |
Correct |
27 ms |
3152 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
63 ms |
2552 KB |
Output is correct |
2 |
Correct |
63 ms |
2220 KB |
Output is correct |
3 |
Correct |
55 ms |
2640 KB |
Output is correct |
4 |
Correct |
26 ms |
3920 KB |
Output is correct |
5 |
Correct |
38 ms |
2640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
80 ms |
3408 KB |
Output is correct |
2 |
Correct |
76 ms |
3408 KB |
Output is correct |
3 |
Correct |
62 ms |
3064 KB |
Output is correct |
4 |
Correct |
27 ms |
3984 KB |
Output is correct |
5 |
Correct |
41 ms |
3152 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
76 ms |
3408 KB |
Output is correct |
2 |
Correct |
78 ms |
3592 KB |
Output is correct |
3 |
Correct |
65 ms |
2896 KB |
Output is correct |
4 |
Correct |
34 ms |
3668 KB |
Output is correct |
5 |
Correct |
41 ms |
3152 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
380 ms |
11732 KB |
Output is correct |
2 |
Correct |
379 ms |
15432 KB |
Output is correct |
3 |
Correct |
374 ms |
14920 KB |
Output is correct |
4 |
Correct |
132 ms |
17612 KB |
Output is correct |
5 |
Correct |
184 ms |
14488 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
376 ms |
15724 KB |
Output is correct |
2 |
Correct |
324 ms |
14440 KB |
Output is correct |
3 |
Correct |
327 ms |
12872 KB |
Output is correct |
4 |
Correct |
139 ms |
17488 KB |
Output is correct |
5 |
Correct |
182 ms |
15448 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
443 ms |
15176 KB |
Output is correct |
2 |
Correct |
456 ms |
18932 KB |
Output is correct |
3 |
Correct |
452 ms |
17788 KB |
Output is correct |
4 |
Correct |
149 ms |
20552 KB |
Output is correct |
5 |
Correct |
220 ms |
17736 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
492 ms |
18300 KB |
Output is correct |
2 |
Correct |
415 ms |
17616 KB |
Output is correct |
3 |
Correct |
391 ms |
16200 KB |
Output is correct |
4 |
Correct |
163 ms |
21480 KB |
Output is correct |
5 |
Correct |
207 ms |
18504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
521 ms |
17200 KB |
Output is correct |
2 |
Correct |
526 ms |
22056 KB |
Output is correct |
3 |
Correct |
541 ms |
21324 KB |
Output is correct |
4 |
Correct |
197 ms |
21824 KB |
Output is correct |
5 |
Correct |
250 ms |
20552 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
530 ms |
20660 KB |
Output is correct |
2 |
Correct |
430 ms |
20552 KB |
Output is correct |
3 |
Correct |
432 ms |
19044 KB |
Output is correct |
4 |
Correct |
207 ms |
21696 KB |
Output is correct |
5 |
Correct |
255 ms |
21536 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
604 ms |
19784 KB |
Output is correct |
2 |
Correct |
600 ms |
24392 KB |
Output is correct |
3 |
Correct |
597 ms |
24596 KB |
Output is correct |
4 |
Correct |
228 ms |
25160 KB |
Output is correct |
5 |
Correct |
285 ms |
23984 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
616 ms |
25492 KB |
Output is correct |
2 |
Correct |
491 ms |
22664 KB |
Output is correct |
3 |
Correct |
495 ms |
22448 KB |
Output is correct |
4 |
Correct |
213 ms |
28080 KB |
Output is correct |
5 |
Correct |
263 ms |
24484 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
685 ms |
24556 KB |
Output is correct |
2 |
Correct |
753 ms |
30096 KB |
Output is correct |
3 |
Correct |
742 ms |
29928 KB |
Output is correct |
4 |
Correct |
274 ms |
33060 KB |
Output is correct |
5 |
Correct |
350 ms |
29164 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
726 ms |
32184 KB |
Output is correct |
2 |
Correct |
584 ms |
26356 KB |
Output is correct |
3 |
Correct |
607 ms |
27088 KB |
Output is correct |
4 |
Correct |
268 ms |
35292 KB |
Output is correct |
5 |
Correct |
335 ms |
30792 KB |
Output is correct |