답안 #1093059

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1093059 2024-09-25T18:59:24 Z TommasoUlian Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 48416 KB
#include <bits/stdc++.h>
#define PB push_back
#define MP makepair
#ifndef ONLINE_JUDGE
#define DEBUG(x) cout << #x << " = " << (x) << endl
#else
#define DEBUG(x)
#endif
#define FOR(n) for(int i = 0; i < (n); i++)
#define SORTA(v) sort((v).begin(), (v).end())
#define SORTD(v) sort((v).rbegin(), (v).rend())
#define PRINT(v) for(auto x: (v))cout << x << " "; cout << endl;
#define TWO(n) (1 << (n))
#define INPUT(v) for(auto &x : (v))cin >> x;
 
typedef long long ll;
 
using namespace std;
 
vector<pair<double,double>> torri;
ll n,L;
 
bool good(double r){
    queue<pair<double,double>> s;
    
    for(auto a:torri){
        double x = a.first, y = a.second;
        if (abs(y) <= r-1e-6)s.push({x-sqrt((r+y)*(r-y)),x+sqrt((r+y)*(r-y))});
       
    }
    double curr = 0;
    while(!s.empty()){
        if(curr >= L)return true;
        auto seg = s.front();
        s.pop();
        if(seg.first- 1e-6 <= curr){
            curr = max(seg.second,curr);
        }
        else return false;
    }
    if(curr < L)return false;
    return true;
}
 
void solve(){
    cin >> n >> L;
    torri = vector<pair<double,double>>(n);
    for(int i = 0; i < n; i++){
        cin >> torri[i].first >> torri[i].second;
 
    }
    double l = 1, r = 2e9;
    double ans = r;
    while(r-l >= 1e-6){
        double c = (r + l) / 2;        //cout << c << endl;
        if(good(c)){
            r = c;
            ans = min(ans,r);
        }
        else{
            l = c;
        }
 
    }
    
    cout << setprecision(log10(ans)+6) << (l + r) / 2 << endl;
    
}
 
int main(){
    solve();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 1 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 600 KB Output is correct
2 Correct 4 ms 604 KB Output is correct
3 Incorrect 4 ms 604 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 71 ms 3676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 53 ms 3716 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 74 ms 3912 KB Output is correct
2 Incorrect 79 ms 4220 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 99 ms 5304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 120 ms 5308 KB Output is correct
2 Incorrect 104 ms 5204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 432 ms 20844 KB Output is correct
2 Correct 496 ms 24244 KB Output is correct
3 Correct 489 ms 23720 KB Output is correct
4 Incorrect 372 ms 25944 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 521 ms 24660 KB Output is correct
2 Incorrect 526 ms 23152 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 562 ms 24960 KB Output is correct
2 Incorrect 616 ms 28996 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 615 ms 29484 KB Output is correct
2 Incorrect 619 ms 27516 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 624 ms 29008 KB Output is correct
2 Incorrect 710 ms 33676 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 729 ms 34224 KB Output is correct
2 Incorrect 687 ms 32148 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 730 ms 33092 KB Output is correct
2 Incorrect 815 ms 38248 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 866 ms 38992 KB Output is correct
2 Incorrect 769 ms 36612 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 883 ms 41084 KB Output is correct
2 Execution timed out 1002 ms 47860 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1027 ms 48416 KB Time limit exceeded
2 Halted 0 ms 0 KB -