답안 #1111065

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1111065 2024-11-11T11:54:00 Z vjudge1 Mobile (BOI12_mobile) C++17
100 / 100
803 ms 35400 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;
}
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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 336 KB Output is correct
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 336 KB Output is correct
2 Correct 5 ms 336 KB Output is correct
3 Correct 4 ms 336 KB Output is correct
4 Correct 3 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 336 KB Output is correct
2 Correct 5 ms 336 KB Output is correct
3 Correct 4 ms 336 KB Output is correct
4 Correct 4 ms 544 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 336 KB Output is correct
2 Correct 5 ms 336 KB Output is correct
3 Correct 4 ms 336 KB Output is correct
4 Correct 2 ms 336 KB Output is correct
5 Correct 4 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 1616 KB Output is correct
2 Correct 62 ms 1616 KB Output is correct
3 Correct 35 ms 1104 KB Output is correct
4 Correct 27 ms 1788 KB Output is correct
5 Correct 27 ms 1104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 1616 KB Output is correct
2 Correct 31 ms 1360 KB Output is correct
3 Correct 34 ms 1616 KB Output is correct
4 Correct 32 ms 1784 KB Output is correct
5 Correct 28 ms 1616 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 67 ms 1616 KB Output is correct
2 Correct 66 ms 1616 KB Output is correct
3 Correct 54 ms 1616 KB Output is correct
4 Correct 27 ms 1872 KB Output is correct
5 Correct 39 ms 1620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 79 ms 2016 KB Output is correct
2 Correct 81 ms 1872 KB Output is correct
3 Correct 69 ms 1872 KB Output is correct
4 Correct 33 ms 2020 KB Output is correct
5 Correct 43 ms 2044 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 79 ms 1872 KB Output is correct
2 Correct 78 ms 2020 KB Output is correct
3 Correct 66 ms 2024 KB Output is correct
4 Correct 31 ms 1872 KB Output is correct
5 Correct 47 ms 1872 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 377 ms 8272 KB Output is correct
2 Correct 387 ms 8272 KB Output is correct
3 Correct 385 ms 8292 KB Output is correct
4 Correct 148 ms 8272 KB Output is correct
5 Correct 203 ms 8284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 394 ms 8280 KB Output is correct
2 Correct 329 ms 8272 KB Output is correct
3 Correct 337 ms 8272 KB Output is correct
4 Correct 143 ms 8272 KB Output is correct
5 Correct 195 ms 8272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 450 ms 9852 KB Output is correct
2 Correct 454 ms 9848 KB Output is correct
3 Correct 448 ms 9844 KB Output is correct
4 Correct 141 ms 9808 KB Output is correct
5 Correct 231 ms 9808 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 411 ms 9852 KB Output is correct
2 Correct 368 ms 9808 KB Output is correct
3 Correct 376 ms 9976 KB Output is correct
4 Correct 175 ms 9808 KB Output is correct
5 Correct 221 ms 9984 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 524 ms 11512 KB Output is correct
2 Correct 559 ms 11344 KB Output is correct
3 Correct 520 ms 11344 KB Output is correct
4 Correct 190 ms 11344 KB Output is correct
5 Correct 256 ms 11344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 528 ms 11344 KB Output is correct
2 Correct 442 ms 11344 KB Output is correct
3 Correct 456 ms 11420 KB Output is correct
4 Correct 181 ms 11516 KB Output is correct
5 Correct 231 ms 11344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 579 ms 12976 KB Output is correct
2 Correct 567 ms 12980 KB Output is correct
3 Correct 601 ms 12976 KB Output is correct
4 Correct 232 ms 12880 KB Output is correct
5 Correct 308 ms 12980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 597 ms 12880 KB Output is correct
2 Correct 517 ms 12880 KB Output is correct
3 Correct 509 ms 12880 KB Output is correct
4 Correct 225 ms 12976 KB Output is correct
5 Correct 290 ms 12880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 757 ms 15952 KB Output is correct
2 Correct 730 ms 15952 KB Output is correct
3 Correct 767 ms 30536 KB Output is correct
4 Correct 305 ms 35144 KB Output is correct
5 Correct 388 ms 29544 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 803 ms 16208 KB Output is correct
2 Correct 632 ms 29272 KB Output is correct
3 Correct 670 ms 28392 KB Output is correct
4 Correct 329 ms 35400 KB Output is correct
5 Correct 371 ms 30684 KB Output is correct