답안 #470012

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
470012 2021-09-02T15:11:02 Z Shogun3103 Mobile (BOI12_mobile) C++17
13 / 100
1000 ms 15928 KB
#include <bits/stdc++.h>
 
using namespace std;

void setIO(string fileName = ""){
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);        
    if(fileName.length()){
        freopen((fileName+".in").c_str(), "r", stdin);
        freopen((fileName+".out").c_str(), "w", stdout);
    }
}

#define ll long long
#define ld long double
#define FOR(i,a,b) for(__typeof(b) i=a; i<=b; i++)
#define FOD(i,a,b) for(__typeof(b) i=b; i>=a; i--)
#define EACH(u, v) for(auto& u : v)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define ii pair<int,int>
#define iii pair<int,ii>
#define ld2 pair<ld, ld>
#define ll2 pair<ll, ll>
#define X first
#define Y second
#define ed "\n"
#define sp " "
const int oo = 1e9 + 7;
const int N = 1e6 + 10;

int n, len;
ll2 a[N];

void solve()
{
    cin >> n >> len;
    FOR(i, 1, n) cin >> a[i].X >> a[i].Y;

    ld l = 1, r = 1.5e9;
    while(r - l > 1e-3) {
        ld m = (l + r) * 0.5, cur = 0;
        FOR(i, 1, n) {
            ld delta = sqrt(m * m - a[i].Y * a[i].Y);
            ld x = a[i].X - delta, y = a[i].X + delta;
            if(x <= cur) cur = max(cur, y);
        }
        if(cur >= len) r = m - 0.001;
        else l = m + 0.001;   
    }
    cout << fixed << setprecision(4) << l; 
}   

int main()
{ 
    //setIO("");
    int t; 
    t = 1;
    //cin >> t;
    FOR(i, 1, t) {
        solve();
    }
    return 0;
}

Compilation message

mobile.cpp: In function 'void setIO(std::string)':
mobile.cpp:8:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |         freopen((fileName+".in").c_str(), "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:9:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |         freopen((fileName+".out").c_str(), "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 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 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 0 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 332 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Incorrect 3 ms 332 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 368 KB Output is correct
2 Correct 5 ms 332 KB Output is correct
3 Correct 5 ms 332 KB Output is correct
4 Correct 9 ms 368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 332 KB Output is correct
2 Correct 5 ms 332 KB Output is correct
3 Correct 5 ms 332 KB Output is correct
4 Correct 9 ms 332 KB Output is correct
5 Correct 7 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 93 ms 1448 KB Output is correct
2 Correct 78 ms 1468 KB Output is correct
3 Incorrect 61 ms 1116 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 103 ms 1380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 71 ms 1608 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 103 ms 1788 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 104 ms 1840 KB Output is correct
2 Incorrect 100 ms 1772 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 404 ms 8104 KB Output is correct
2 Correct 489 ms 8024 KB Output is correct
3 Correct 484 ms 8100 KB Output is correct
4 Execution timed out 1035 ms 8104 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 526 ms 8164 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 502 ms 9612 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 625 ms 9756 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 589 ms 11236 KB Output is correct
2 Correct 694 ms 11204 KB Output is correct
3 Correct 690 ms 11204 KB Output is correct
4 Execution timed out 1094 ms 11204 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 727 ms 11204 KB Output is correct
2 Correct 968 ms 11352 KB Output is correct
3 Correct 753 ms 11184 KB Output is correct
4 Execution timed out 1091 ms 11252 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 653 ms 12740 KB Output is correct
2 Correct 779 ms 12740 KB Output is correct
3 Correct 773 ms 12804 KB Output is correct
4 Execution timed out 1097 ms 12800 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 814 ms 12796 KB Output is correct
2 Execution timed out 1089 ms 12892 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 817 ms 15928 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1006 ms 15816 KB Time limit exceeded
2 Halted 0 ms 0 KB -