답안 #471330

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
471330 2021-09-08T12:43:22 Z XII Mobile (BOI12_mobile) C++17
28 / 100
615 ms 22984 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 = max(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 Correct 1 ms 312 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 316 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 2 ms 332 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 320 KB Output is correct
2 Correct 4 ms 332 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Correct 4 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 400 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 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 Correct 3 ms 332 KB Output is correct
5 Correct 3 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 44 ms 1612 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 37 ms 1560 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 1612 KB Output is correct
2 Correct 51 ms 2124 KB Output is correct
3 Correct 46 ms 1936 KB Output is correct
4 Incorrect 43 ms 3004 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 2636 KB Output is correct
2 Correct 62 ms 2496 KB Output is correct
3 Correct 55 ms 2124 KB Output is correct
4 Correct 49 ms 3012 KB Output is correct
5 Incorrect 44 ms 2240 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 64 ms 2604 KB Output is correct
2 Correct 64 ms 2508 KB Output is correct
3 Correct 55 ms 2112 KB Output is correct
4 Correct 50 ms 3020 KB Output is correct
5 Incorrect 45 ms 2368 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 271 ms 6064 KB Output is correct
2 Correct 308 ms 5624 KB Output is correct
3 Correct 309 ms 5640 KB Output is correct
4 Incorrect 215 ms 5128 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 310 ms 5700 KB Output is correct
2 Incorrect 326 ms 5508 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 333 ms 6620 KB Output is correct
2 Correct 377 ms 5900 KB Output is correct
3 Correct 359 ms 6340 KB Output is correct
4 Correct 264 ms 5924 KB Output is correct
5 Correct 266 ms 12920 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 376 ms 5896 KB Output is correct
2 Correct 377 ms 6412 KB Output is correct
3 Correct 317 ms 11836 KB Output is correct
4 Incorrect 264 ms 16720 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 377 ms 7160 KB Output is correct
2 Correct 424 ms 6700 KB Output is correct
3 Correct 419 ms 6604 KB Output is correct
4 Incorrect 299 ms 6692 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 436 ms 6640 KB Output is correct
2 Correct 411 ms 6608 KB Output is correct
3 Correct 390 ms 14240 KB Output is correct
4 Correct 293 ms 19084 KB Output is correct
5 Correct 302 ms 15908 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 438 ms 7696 KB Output is correct
2 Correct 490 ms 7364 KB Output is correct
3 Correct 498 ms 7180 KB Output is correct
4 Correct 388 ms 7116 KB Output is correct
5 Incorrect 373 ms 17784 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 497 ms 7000 KB Output is correct
2 Incorrect 502 ms 6928 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 569 ms 8292 KB Output is correct
2 Correct 612 ms 8308 KB Output is correct
3 Correct 600 ms 8176 KB Output is correct
4 Correct 427 ms 8264 KB Output is correct
5 Correct 458 ms 21696 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 606 ms 8140 KB Output is correct
2 Correct 615 ms 8140 KB Output is correct
3 Correct 528 ms 20416 KB Output is correct
4 Correct 435 ms 11048 KB Output is correct
5 Incorrect 454 ms 22984 KB Output isn't correct