답안 #1033373

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1033373 2024-07-24T17:24:06 Z vjudge1 Mobile (BOI12_mobile) C++17
100 / 100
788 ms 27540 KB
#include<bits/stdc++.h>
using namespace std;

const bool multiTest = false;
#define task ""
#define fi first
#define se second
#define MASK(i) (1LL << (i))
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define BIT(mask, i) ((mask) >> (i) & 1)

template<typename T1, typename T2> bool minimize(T1 &a, T2 b) {
	if (a > b) a = b; else return 0; return 1;
}
template<typename T1, typename T2> bool maximize(T1 &a, T2 b) {
	if (a < b) a = b; else return 0; return 1;
}

const int MAX = 1000100;
int n, L;
int x[MAX];
int y[MAX];

bool ok(double r) {
    double c = 0;
    for (int i = 1; i <= n; ++i) {
        double delta = sqrt(r * r - 1LL * y[i] * y[i]);
        if (x[i] - delta <= c) {
            maximize(c, x[i] + delta);
        }
    }
    return c >= L;
}

void process(void) {
    cin >> n >> L;
    for (int i = 1; i <= n; ++i) {
        cin >> x[i] >> y[i];
    }
    double l = 0, r = 1.5e9;
    for (int t = 0; t < 100; ++t) {
        double mid = (l + r) / 2;
        if (ok(mid)) r = mid;
        else l = mid;
    }
    cout << setprecision(12) << fixed << r;
}

int main(void) {
	ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	if (fopen(task".inp", "r")) {
		freopen(task".inp", "r",  stdin);
		freopen(task".out", "w", stdout);
	}

	int nTest = 1; if (multiTest) cin >> nTest;
	while (nTest--) {
		process();
	}

	return 0;
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:53:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   53 |   freopen(task".inp", "r",  stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:54:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   54 |   freopen(task".out", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 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 348 KB Output is correct
2 Correct 0 ms 348 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 1 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 3 ms 344 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 70 ms 860 KB Output is correct
2 Correct 31 ms 856 KB Output is correct
3 Correct 22 ms 860 KB Output is correct
4 Correct 40 ms 1108 KB Output is correct
5 Correct 22 ms 860 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 856 KB Output is correct
2 Correct 34 ms 860 KB Output is correct
3 Correct 51 ms 1112 KB Output is correct
4 Correct 39 ms 1084 KB Output is correct
5 Correct 45 ms 1128 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 1368 KB Output is correct
2 Correct 33 ms 1112 KB Output is correct
3 Correct 34 ms 1112 KB Output is correct
4 Correct 54 ms 1116 KB Output is correct
5 Correct 42 ms 956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 1112 KB Output is correct
2 Correct 40 ms 1112 KB Output is correct
3 Correct 40 ms 1112 KB Output is correct
4 Correct 52 ms 1116 KB Output is correct
5 Correct 50 ms 1112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 40 ms 1116 KB Output is correct
2 Correct 43 ms 1112 KB Output is correct
3 Correct 40 ms 1112 KB Output is correct
4 Correct 52 ms 1116 KB Output is correct
5 Correct 48 ms 1236 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 189 ms 7504 KB Output is correct
2 Correct 244 ms 12048 KB Output is correct
3 Correct 206 ms 11496 KB Output is correct
4 Correct 250 ms 13904 KB Output is correct
5 Correct 236 ms 11088 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 206 ms 10580 KB Output is correct
2 Correct 500 ms 11088 KB Output is correct
3 Correct 196 ms 10064 KB Output is correct
4 Correct 265 ms 13708 KB Output is correct
5 Correct 240 ms 11600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 231 ms 9136 KB Output is correct
2 Correct 249 ms 14376 KB Output is correct
3 Correct 231 ms 13644 KB Output is correct
4 Correct 333 ms 17224 KB Output is correct
5 Correct 293 ms 13152 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 251 ms 12884 KB Output is correct
2 Correct 571 ms 12972 KB Output is correct
3 Correct 250 ms 11992 KB Output is correct
4 Correct 316 ms 16668 KB Output is correct
5 Correct 329 ms 13832 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 287 ms 10800 KB Output is correct
2 Correct 304 ms 16720 KB Output is correct
3 Correct 289 ms 15940 KB Output is correct
4 Correct 400 ms 19476 KB Output is correct
5 Correct 360 ms 14968 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 290 ms 15556 KB Output is correct
2 Correct 634 ms 15132 KB Output is correct
3 Correct 290 ms 14272 KB Output is correct
4 Correct 378 ms 19228 KB Output is correct
5 Correct 396 ms 15952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 305 ms 12628 KB Output is correct
2 Correct 329 ms 19028 KB Output is correct
3 Correct 306 ms 18256 KB Output is correct
4 Correct 409 ms 22356 KB Output is correct
5 Correct 371 ms 17780 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 329 ms 18004 KB Output is correct
2 Correct 635 ms 17264 KB Output is correct
3 Correct 332 ms 16240 KB Output is correct
4 Correct 395 ms 22180 KB Output is correct
5 Correct 413 ms 18260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 372 ms 15788 KB Output is correct
2 Correct 403 ms 23632 KB Output is correct
3 Correct 381 ms 22608 KB Output is correct
4 Correct 501 ms 27372 KB Output is correct
5 Correct 492 ms 21740 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 408 ms 22956 KB Output is correct
2 Correct 788 ms 21328 KB Output is correct
3 Correct 414 ms 20572 KB Output is correct
4 Correct 525 ms 27540 KB Output is correct
5 Correct 520 ms 22808 KB Output is correct