답안 #964051

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
964051 2024-04-16T09:00:08 Z Neco_arc Mobile (BOI12_mobile) C++17
50 / 100
1000 ms 50960 KB
#include <bits/stdc++.h>

#define ll long long
#define all(x) x.begin(), x.end()
#define Neco "Mobile"
#define resp(x) sort(all(x)), x.resize(unique(all(x)) - x.begin())
#define getbit(x,i) ((x >> i)&1)
#define _left id * 2, l, mid
#define _right id * 2 + 1, mid + 1, r
#define cntbit(x) __builtin_popcountll(x)
#define fi(i, a, b) for(int i = a; i <= b; i++)
#define fid(i, a, b) for(int i = a; i >= b; i--)
#define maxn (int) 1e6 + 7

using namespace std;

const ll mod = 1e9 + 7; //972663749
const ll base = 911382323;
typedef long double ld;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll GetRandom(ll l, ll r)
{
    return uniform_int_distribution<ll> (l, r)(rng);
}

int n, L;
pair<ld, ld> a[maxn];

void solve()
{

    cin >> n >> L;
    fi(i, 1, n) cin >> a[i].first >> a[i].second;

    ld l = 1, r = 3e9;

    int T = 100;
    while(T--)
    {
        ld mid = (l + r) / 2;

        ld Curr = 0;
        fi(i, 1, n) {
            ld L, R;
            if(mid < a[i].second) L = R = 0;
            else {
                ld len = sqrt( (mid * mid) - (a[i].second * a[i].second) );
                L = a[i].first - len, R = a[i].first + len;
            }
            if(Curr >= L) Curr = max(Curr, R);
        }

        if(Curr >= L) r = mid;
        else l = mid;
    }

    cout << fixed << setprecision(5) << r;

}


int main()
{

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    if(fopen(Neco".inp", "r")) {
        freopen(Neco".inp", "r", stdin);
        freopen(Neco".out", "w", stdout);
    }


    int nTest = 1;
//    cin >> nTest;


    while(nTest--)
    {
        solve();
    }


    return 0;
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:72:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   72 |         freopen(Neco".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:73:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   73 |         freopen(Neco".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 600 KB Output is correct
2 Correct 4 ms 356 KB Output is correct
3 Correct 3 ms 600 KB Output is correct
4 Correct 4 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 604 KB Output is correct
2 Correct 5 ms 604 KB Output is correct
3 Correct 4 ms 580 KB Output is correct
4 Correct 9 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 604 KB Output is correct
2 Correct 5 ms 860 KB Output is correct
3 Correct 4 ms 604 KB Output is correct
4 Correct 10 ms 856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 616 KB Output is correct
2 Correct 7 ms 604 KB Output is correct
3 Correct 7 ms 604 KB Output is correct
4 Correct 9 ms 712 KB Output is correct
5 Correct 8 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 86 ms 5460 KB Output is correct
2 Correct 63 ms 5808 KB Output is correct
3 Correct 48 ms 3292 KB Output is correct
4 Correct 167 ms 5908 KB Output is correct
5 Correct 69 ms 3076 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 117 ms 5456 KB Output is correct
2 Correct 158 ms 3420 KB Output is correct
3 Correct 166 ms 5764 KB Output is correct
4 Correct 164 ms 5716 KB Output is correct
5 Correct 188 ms 6120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 75 ms 5420 KB Output is correct
2 Correct 73 ms 5896 KB Output is correct
3 Correct 64 ms 5456 KB Output is correct
4 Correct 223 ms 6528 KB Output is correct
5 Correct 161 ms 5664 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 87 ms 6128 KB Output is correct
2 Correct 87 ms 6148 KB Output is correct
3 Correct 75 ms 5760 KB Output is correct
4 Correct 208 ms 6700 KB Output is correct
5 Correct 189 ms 5892 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 88 ms 6256 KB Output is correct
2 Correct 85 ms 6144 KB Output is correct
3 Correct 75 ms 5764 KB Output is correct
4 Correct 216 ms 6680 KB Output is correct
5 Correct 193 ms 6016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 439 ms 21344 KB Output is correct
2 Correct 446 ms 24596 KB Output is correct
3 Correct 423 ms 24276 KB Output is correct
4 Execution timed out 1065 ms 26452 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 457 ms 25208 KB Output is correct
2 Correct 588 ms 23656 KB Output is correct
3 Correct 423 ms 22804 KB Output is correct
4 Execution timed out 1059 ms 26264 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 557 ms 26328 KB Output is correct
2 Correct 545 ms 30444 KB Output is correct
3 Correct 520 ms 30036 KB Output is correct
4 Execution timed out 1039 ms 32848 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 563 ms 31084 KB Output is correct
2 Correct 661 ms 29088 KB Output is correct
3 Correct 474 ms 27760 KB Output is correct
4 Execution timed out 1033 ms 32776 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 602 ms 29260 KB Output is correct
2 Correct 596 ms 33940 KB Output is correct
3 Correct 633 ms 33176 KB Output is correct
4 Execution timed out 1032 ms 36528 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 603 ms 34744 KB Output is correct
2 Correct 784 ms 32464 KB Output is correct
3 Correct 591 ms 31592 KB Output is correct
4 Execution timed out 1026 ms 36432 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 769 ms 34128 KB Output is correct
2 Correct 694 ms 39724 KB Output is correct
3 Correct 720 ms 38952 KB Output is correct
4 Execution timed out 1055 ms 42836 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 714 ms 40516 KB Output is correct
2 Correct 836 ms 37884 KB Output is correct
3 Correct 621 ms 36840 KB Output is correct
4 Execution timed out 1050 ms 42744 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 965 ms 40464 KB Output is correct
2 Correct 873 ms 47220 KB Output is correct
3 Correct 843 ms 46328 KB Output is correct
4 Execution timed out 1054 ms 50960 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 871 ms 48296 KB Output is correct
2 Execution timed out 1035 ms 44988 KB Time limit exceeded
3 Halted 0 ms 0 KB -