답안 #471327

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
471327 2021-09-08T12:29:42 Z XII Mobile (BOI12_mobile) C++17
0 / 100
639 ms 24628 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#define fi first
#define se second
#define mp make_pair
#define eb emplace_back
#define ALL(x) (x).begin(), (x).end()

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORU(i, a, b) for(int i = (a); i <= (b); ++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)

#define IOS cin.tie(0)->sync_with_stdio(false);
#define PROB "BOI12_mobile"
void Fi(){
    if(fopen(PROB".inp", "r")){
        freopen(PROB".inp", "r", stdin);
        freopen(PROB".out", "w", stdout);
    }
}

template<typename T>
T SQ(const T &x){
    return x * x;
}

const ll NONE = -2e9;

ll Round(const double &x){
    return (x * 1000 + 0.5);
}

double firstTrue(double lo, double hi, function<bool(double)> f){
    while(Round(lo) < Round(hi)){
        double mid = lo + (hi - lo) / 2;
        if(f(mid)) hi = mid;
        else lo = mid;
    }
    return hi;
}

int main(){
    IOS;
    Fi();
    int n, l; cin >> n >> l;
    vector<int> x(n), y(n);
    FOR(i, 0, n) cin >> x[i] >> y[i];

    const auto check = [&](const double &r) -> bool{
        double L = NONE, R = NONE;
        FOR(i, 0, n) if(abs(y[i]) <= r){
            double D = sqrt(SQ(r) - SQ(1LL * y[i]));
            if(L == NONE){
                L = x[i] - D;
                R = x[i] + D;
            } else{
                L = min(L, x[i] - D);
                if(x[i] - D <= R) R = x[i] + D;
            }
        }
        return (L <= 0 && l <= R);
    };

    cout << fixed << setprecision(3) << firstTrue(0, 2e9, check);

    return 0;
}

Compilation message

mobile.cpp: In function 'void Fi()':
mobile.cpp:20:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         freopen(PROB".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:21:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |         freopen(PROB".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 312 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Incorrect 1 ms 332 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 332 KB Output is correct
2 Correct 4 ms 332 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Incorrect 3 ms 332 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 48 ms 1668 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 36 ms 1612 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 1672 KB Output is correct
2 Correct 50 ms 2124 KB Output is correct
3 Correct 45 ms 1868 KB Output is correct
4 Incorrect 45 ms 3020 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 63 ms 2644 KB Output is correct
2 Correct 63 ms 2500 KB Output is correct
3 Correct 54 ms 2124 KB Output is correct
4 Incorrect 45 ms 3000 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 63 ms 2504 KB Output is correct
2 Correct 65 ms 2372 KB Output is correct
3 Correct 55 ms 2112 KB Output is correct
4 Incorrect 45 ms 3020 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 276 ms 8632 KB Output is correct
2 Correct 313 ms 11896 KB Output is correct
3 Correct 314 ms 11516 KB Output is correct
4 Incorrect 218 ms 13692 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 309 ms 12404 KB Output is correct
2 Incorrect 336 ms 10808 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 331 ms 10164 KB Output is correct
2 Correct 369 ms 14208 KB Output is correct
3 Correct 373 ms 13560 KB Output is correct
4 Incorrect 260 ms 16764 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 378 ms 14932 KB Output is correct
2 Incorrect 397 ms 12864 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 389 ms 11828 KB Output is correct
2 Correct 423 ms 16524 KB Output is correct
3 Correct 421 ms 15876 KB Output is correct
4 Incorrect 301 ms 19304 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 441 ms 17300 KB Output is correct
2 Incorrect 458 ms 15116 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 433 ms 13496 KB Output is correct
2 Correct 490 ms 18844 KB Output is correct
3 Correct 501 ms 18164 KB Output is correct
4 Incorrect 346 ms 22084 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 505 ms 19708 KB Output is correct
2 Incorrect 519 ms 17124 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 558 ms 16824 KB Output is correct
2 Correct 639 ms 23656 KB Output is correct
3 Correct 615 ms 22668 KB Output is correct
4 Incorrect 443 ms 11436 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 613 ms 24628 KB Output is correct
2 Incorrect 599 ms 21436 KB Output isn't correct
3 Halted 0 ms 0 KB -