# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1111062 |
2024-11-11T11:51:44 Z |
vjudge1 |
Mobile (BOI12_mobile) |
C++17 |
|
1000 ms |
28488 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;
}
Compilation message
mobile.cpp: In function 'void c_p_c()':
mobile.cpp:36:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
36 | freopen("milkvisits.in", "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:37:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
37 | freopen("milkvisits.out", "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
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 |
504 KB |
Output is correct |
4 |
Correct |
1 ms |
444 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 |
3 ms |
336 KB |
Output is correct |
2 |
Correct |
3 ms |
336 KB |
Output is correct |
3 |
Correct |
3 ms |
336 KB |
Output is correct |
4 |
Correct |
3 ms |
508 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
336 KB |
Output is correct |
2 |
Correct |
6 ms |
592 KB |
Output is correct |
3 |
Correct |
6 ms |
336 KB |
Output is correct |
4 |
Correct |
5 ms |
760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
336 KB |
Output is correct |
2 |
Correct |
6 ms |
336 KB |
Output is correct |
3 |
Correct |
5 ms |
336 KB |
Output is correct |
4 |
Correct |
5 ms |
588 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
336 KB |
Output is correct |
2 |
Correct |
6 ms |
592 KB |
Output is correct |
3 |
Correct |
5 ms |
556 KB |
Output is correct |
4 |
Correct |
4 ms |
592 KB |
Output is correct |
5 |
Correct |
4 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
64 ms |
1600 KB |
Output is correct |
2 |
Correct |
81 ms |
2680 KB |
Output is correct |
3 |
Correct |
47 ms |
1896 KB |
Output is correct |
4 |
Correct |
52 ms |
2632 KB |
Output is correct |
5 |
Correct |
39 ms |
1476 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
1616 KB |
Output is correct |
2 |
Correct |
50 ms |
2344 KB |
Output is correct |
3 |
Correct |
54 ms |
2640 KB |
Output is correct |
4 |
Correct |
57 ms |
2640 KB |
Output is correct |
5 |
Correct |
57 ms |
3180 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
82 ms |
2384 KB |
Output is correct |
2 |
Correct |
94 ms |
1616 KB |
Output is correct |
3 |
Correct |
77 ms |
2640 KB |
Output is correct |
4 |
Correct |
65 ms |
3912 KB |
Output is correct |
5 |
Correct |
60 ms |
2656 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
123 ms |
3156 KB |
Output is correct |
2 |
Correct |
110 ms |
3400 KB |
Output is correct |
3 |
Correct |
91 ms |
2888 KB |
Output is correct |
4 |
Correct |
65 ms |
3912 KB |
Output is correct |
5 |
Correct |
67 ms |
3144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
107 ms |
3516 KB |
Output is correct |
2 |
Correct |
106 ms |
2000 KB |
Output is correct |
3 |
Correct |
84 ms |
2888 KB |
Output is correct |
4 |
Correct |
69 ms |
3776 KB |
Output is correct |
5 |
Correct |
66 ms |
3144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
482 ms |
11244 KB |
Output is correct |
2 |
Correct |
521 ms |
12280 KB |
Output is correct |
3 |
Correct |
508 ms |
15288 KB |
Output is correct |
4 |
Correct |
294 ms |
17736 KB |
Output is correct |
5 |
Correct |
301 ms |
15032 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
554 ms |
12868 KB |
Output is correct |
2 |
Correct |
455 ms |
14920 KB |
Output is correct |
3 |
Correct |
412 ms |
14004 KB |
Output is correct |
4 |
Correct |
307 ms |
17712 KB |
Output is correct |
5 |
Correct |
320 ms |
15432 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
538 ms |
12072 KB |
Output is correct |
2 |
Correct |
617 ms |
10580 KB |
Output is correct |
3 |
Correct |
620 ms |
18508 KB |
Output is correct |
4 |
Correct |
370 ms |
21576 KB |
Output is correct |
5 |
Correct |
373 ms |
17736 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
686 ms |
17736 KB |
Output is correct |
2 |
Correct |
539 ms |
17504 KB |
Output is correct |
3 |
Correct |
514 ms |
16596 KB |
Output is correct |
4 |
Correct |
373 ms |
21536 KB |
Output is correct |
5 |
Correct |
357 ms |
18532 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
638 ms |
16712 KB |
Output is correct |
2 |
Correct |
763 ms |
19444 KB |
Output is correct |
3 |
Correct |
709 ms |
21488 KB |
Output is correct |
4 |
Correct |
432 ms |
24904 KB |
Output is correct |
5 |
Correct |
437 ms |
20164 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
750 ms |
13288 KB |
Output is correct |
2 |
Correct |
631 ms |
20628 KB |
Output is correct |
3 |
Correct |
609 ms |
19760 KB |
Output is correct |
4 |
Correct |
446 ms |
24940 KB |
Output is correct |
5 |
Correct |
421 ms |
21320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
721 ms |
17812 KB |
Output is correct |
2 |
Correct |
848 ms |
16796 KB |
Output is correct |
3 |
Correct |
838 ms |
24456 KB |
Output is correct |
4 |
Correct |
514 ms |
28488 KB |
Output is correct |
5 |
Correct |
498 ms |
23880 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
853 ms |
24192 KB |
Output is correct |
2 |
Correct |
708 ms |
23312 KB |
Output is correct |
3 |
Correct |
698 ms |
22344 KB |
Output is correct |
4 |
Correct |
514 ms |
28304 KB |
Output is correct |
5 |
Correct |
503 ms |
24392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
897 ms |
24640 KB |
Output is correct |
2 |
Execution timed out |
1056 ms |
22220 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1043 ms |
22344 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |