답안 #570481

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
570481 2022-05-30T07:08:48 Z lam Mobile (BOI12_mobile) C++14
50 / 100
43 ms 3788 KB
#include <bits/stdc++.h>
#define int long long
#define maxn 100010
using namespace std;
int n,L;
pair<int,int> a[maxn];
typedef long double ld;
const ld eps=1e-3;
bool cmp(pair<ld,ld> x, pair<ld,ld> y)
{
    if (x.second!=y.second) return x.second<y.second;
    return x.first<y.first;
}
bool check(ld val)
{
    vector <pair<ld,ld>> b;
    b.clear();
    val*=val;
    ld curr=0.0;
    for (int i=1; i<=n; i++)
    {
        ld temp=a[i].second;
        temp=1.0*temp*temp;
        if (temp>val) continue;
        temp=val-temp;
        temp=1.0*sqrt(temp);
        ld l=a[i].first-temp;
        ld r=a[i].first+temp;
        if (l<=curr) curr=max(curr,r);
    }
    return curr>=L;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    cin>>n>>L;
    for (int i=1; i<=n; i++)
    {
        cin>>a[i].first>>a[i].second;
    }
    ld l=0.0;
    ld r=2*1e9;
    ld ans=-1;
    while (r-l>eps)
    {
        ld mid=l+(r-l)/2;
        if (check(mid))
        {
            r=mid;
        }
        else
            l=mid;
    }
    cout<<fixed<<setprecision(4)<<l;
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:44:8: warning: unused variable 'ans' [-Wunused-variable]
   44 |     ld ans=-1;
      |        ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 1476 KB Output is correct
2 Correct 28 ms 1472 KB Output is correct
3 Correct 18 ms 1036 KB Output is correct
4 Correct 22 ms 1484 KB Output is correct
5 Correct 14 ms 988 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 1492 KB Output is correct
2 Correct 21 ms 2240 KB Output is correct
3 Correct 32 ms 2672 KB Output is correct
4 Correct 28 ms 2728 KB Output is correct
5 Correct 29 ms 3060 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 1620 KB Output is correct
2 Correct 30 ms 1600 KB Output is correct
3 Correct 29 ms 1620 KB Output is correct
4 Correct 30 ms 1888 KB Output is correct
5 Correct 26 ms 1620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 1868 KB Output is correct
2 Correct 43 ms 1884 KB Output is correct
3 Correct 34 ms 2784 KB Output is correct
4 Correct 31 ms 3788 KB Output is correct
5 Correct 32 ms 3116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 40 ms 1876 KB Output is correct
2 Correct 39 ms 1836 KB Output is correct
3 Correct 37 ms 1868 KB Output is correct
4 Correct 36 ms 3788 KB Output is correct
5 Correct 29 ms 3072 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 1876 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 1848 KB Output is correct
2 Incorrect 16 ms 1788 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 15 ms 1840 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 22 ms 3528 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 17 ms 1840 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 23 ms 3532 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 1876 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 22 ms 3568 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 14 ms 1800 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 1876 KB Output is correct
2 Incorrect 25 ms 1892 KB Output isn't correct
3 Halted 0 ms 0 KB -