답안 #964053

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
964053 2024-04-16T09:01:21 Z Neco_arc Mobile (BOI12_mobile) C++17
80 / 100
1000 ms 51176 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 = 2e9;

    int T = 50;
    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 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 476 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 2 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 632 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 5 ms 632 KB Output is correct
4 Correct 5 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 604 KB Output is correct
2 Correct 3 ms 636 KB Output is correct
3 Correct 4 ms 604 KB Output is correct
4 Correct 5 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 5 ms 604 KB Output is correct
4 Correct 5 ms 632 KB Output is correct
5 Correct 5 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 47 ms 4732 KB Output is correct
2 Correct 45 ms 4488 KB Output is correct
3 Correct 29 ms 2648 KB Output is correct
4 Correct 84 ms 4732 KB Output is correct
5 Correct 38 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 64 ms 4736 KB Output is correct
2 Correct 70 ms 2648 KB Output is correct
3 Correct 84 ms 4696 KB Output is correct
4 Correct 87 ms 4732 KB Output is correct
5 Correct 106 ms 4732 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 49 ms 4692 KB Output is correct
2 Correct 46 ms 4692 KB Output is correct
3 Correct 50 ms 4732 KB Output is correct
4 Correct 123 ms 4764 KB Output is correct
5 Correct 86 ms 4984 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 59 ms 4696 KB Output is correct
2 Correct 56 ms 4732 KB Output is correct
3 Correct 53 ms 4696 KB Output is correct
4 Correct 122 ms 4752 KB Output is correct
5 Correct 104 ms 4740 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 64 ms 4736 KB Output is correct
2 Correct 56 ms 4732 KB Output is correct
3 Correct 54 ms 4700 KB Output is correct
4 Correct 124 ms 4732 KB Output is correct
5 Correct 107 ms 4732 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 311 ms 17236 KB Output is correct
2 Correct 304 ms 17044 KB Output is correct
3 Correct 288 ms 17280 KB Output is correct
4 Correct 621 ms 17044 KB Output is correct
5 Correct 553 ms 23876 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 289 ms 17032 KB Output is correct
2 Correct 354 ms 17040 KB Output is correct
3 Correct 276 ms 17044 KB Output is correct
4 Correct 604 ms 16980 KB Output is correct
5 Correct 573 ms 24352 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 356 ms 21144 KB Output is correct
2 Correct 400 ms 21156 KB Output is correct
3 Correct 345 ms 21076 KB Output is correct
4 Correct 778 ms 21328 KB Output is correct
5 Correct 657 ms 29152 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 358 ms 21332 KB Output is correct
2 Correct 435 ms 21148 KB Output is correct
3 Correct 389 ms 21372 KB Output is correct
4 Correct 750 ms 21152 KB Output is correct
5 Correct 704 ms 29880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 445 ms 23200 KB Output is correct
2 Correct 469 ms 23164 KB Output is correct
3 Correct 439 ms 23168 KB Output is correct
4 Correct 887 ms 23200 KB Output is correct
5 Correct 741 ms 32248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 432 ms 23424 KB Output is correct
2 Correct 471 ms 23176 KB Output is correct
3 Correct 388 ms 23204 KB Output is correct
4 Correct 900 ms 23200 KB Output is correct
5 Correct 765 ms 33348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 480 ms 27300 KB Output is correct
2 Correct 464 ms 27268 KB Output is correct
3 Correct 468 ms 27308 KB Output is correct
4 Execution timed out 1008 ms 27300 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 484 ms 27220 KB Output is correct
2 Correct 536 ms 27216 KB Output is correct
3 Correct 452 ms 27544 KB Output is correct
4 Execution timed out 1014 ms 27308 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 609 ms 31900 KB Output is correct
2 Correct 607 ms 31756 KB Output is correct
3 Correct 608 ms 31632 KB Output is correct
4 Execution timed out 1056 ms 31568 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 584 ms 31756 KB Output is correct
2 Correct 652 ms 31760 KB Output is correct
3 Correct 584 ms 43920 KB Output is correct
4 Execution timed out 1059 ms 51176 KB Time limit exceeded
5 Halted 0 ms 0 KB -