답안 #990996

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
990996 2024-06-01T03:41:13 Z chanhchuong123 Mobile (BOI12_mobile) C++14
0 / 100
377 ms 27236 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 mini(T1 &a, T2 b) {
	if (a > b) a = b; else return 0; return 1;
}
template<typename T1, typename T2> bool maxi(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 dist) {
    double cur = 0;
    for (int i = 1; i <= n; ++i) {
        double l = x[i] - sqrt(dist * dist - 1LL * y[i] * y[i]), r = x[i] + sqrt(dist * dist + 1LL * y[i] * y[i]);
        if (l <= cur) maxi(cur, r);
    }
    return cur < l;
}

void process(void) {
    cin >> n >> l;
    for (int i = 1; i <= n; ++i) {
        cin >> x[i] >> y[i];
    }
    double l = 1, r = 1.5e9;
    while (r - l > 1e-3) {
        double mid = (l + r) / 2;
        if (ok(mid)) l = mid;
        else r = mid;
    }
    cout << setprecision(6) << fixed << l;
}

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:51:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   51 |   freopen(task".inp", "r",  stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:52:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   52 |   freopen(task".out", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 26 ms 4724 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 4696 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 4696 KB Output is correct
2 Correct 30 ms 4700 KB Output is correct
3 Correct 32 ms 5684 KB Output is correct
4 Incorrect 41 ms 8536 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 6796 KB Output is correct
2 Correct 36 ms 8028 KB Output is correct
3 Correct 35 ms 7800 KB Output is correct
4 Incorrect 40 ms 8732 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 35 ms 6748 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 160 ms 6776 KB Output is correct
2 Correct 173 ms 6748 KB Output is correct
3 Correct 172 ms 6744 KB Output is correct
4 Incorrect 188 ms 6748 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 175 ms 6744 KB Output is correct
2 Incorrect 172 ms 6748 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 188 ms 6744 KB Output is correct
2 Correct 208 ms 6744 KB Output is correct
3 Correct 205 ms 15440 KB Output is correct
4 Incorrect 231 ms 18516 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 218 ms 6748 KB Output is correct
2 Incorrect 229 ms 6796 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 224 ms 6996 KB Output is correct
2 Correct 243 ms 6992 KB Output is correct
3 Correct 241 ms 17236 KB Output is correct
4 Incorrect 285 ms 20600 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 238 ms 7036 KB Output is correct
2 Incorrect 235 ms 6992 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 247 ms 7248 KB Output is correct
2 Correct 267 ms 7308 KB Output is correct
3 Correct 272 ms 19208 KB Output is correct
4 Incorrect 295 ms 23016 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 265 ms 7304 KB Output is correct
2 Incorrect 263 ms 7252 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 307 ms 8020 KB Output is correct
2 Correct 349 ms 8020 KB Output is correct
3 Correct 325 ms 22612 KB Output is correct
4 Incorrect 377 ms 27236 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 338 ms 8016 KB Output is correct
2 Incorrect 346 ms 8056 KB Output isn't correct
3 Halted 0 ms 0 KB -