답안 #841614

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
841614 2023-09-01T18:35:25 Z a5a7 Mobile (BOI12_mobile) C++14
4 / 100
1000 ms 90980 KB
#include <bits/stdc++.h>
#define ALL(x) (x).begin(), (x).end()
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define READ(arr, n) for (int i = 0; i < (n); i++) cin >> arr[i];
#define ABS(a) (max((a), -(a)))
using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; ld l;
    cin >> n >> l;
    pair<ld, ld> stations[n];
    ld r = 0;
    for (int i = 0; i < n; i++) {
        cin >> stations[i].first >> stations[i].second;
        r = max(r, sqrtl(max((ld) 0, (l-stations[i].first)*(l-stations[i].first)-stations[i].second*stations[i].second)));
    }
    ld le = 0;
    while ((r-le)>0.0001){
        ld m = (le+r)/2;
        vector<pair<ld, ld>> ranges;
        for (int i = 0; i < n; i++){
            if (ABS(stations[i].second) >= m) continue;
            ld sq = sqrtl(m * m - stations[i].second * stations[i].second);
            ranges.push_back({stations[i].first-sq, stations[i].first+sq});
        }
        sort(ALL(ranges));
        ld loc = 0;
        for (int i = 0; i < ranges.size(); i++){
            if (loc > ranges[i].first){
                loc = max(loc, ranges[i].second);
            }
        }
        if (loc >= l){
            r = m;
        }else{
            le = m;
        }
    }
    cout << le << endl;
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:32:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long double, long double> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |         for (int i = 0; i < ranges.size(); i++){
      |                         ~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 604 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 5 ms 780 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Incorrect 7 ms 792 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 860 KB Output is correct
2 Incorrect 13 ms 1120 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 860 KB Output is correct
2 Incorrect 13 ms 1104 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 1080 KB Output is correct
2 Incorrect 15 ms 1100 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 146 ms 10952 KB Output is correct
2 Incorrect 159 ms 6040 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 59 ms 8740 KB Output is correct
2 Correct 60 ms 8792 KB Output is correct
3 Incorrect 68 ms 9740 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 268 ms 12020 KB Output is correct
2 Incorrect 149 ms 6040 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 133 ms 6836 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 397 ms 13404 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1025 ms 52652 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 249 ms 24636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1088 ms 74236 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 287 ms 29348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1068 ms 78884 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 330 ms 34252 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1053 ms 82076 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 367 ms 38884 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1031 ms 90980 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 464 ms 48480 KB Output isn't correct
2 Halted 0 ms 0 KB -