답안 #990997

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
990997 2024-06-01T03:41:46 Z chanhchuong123 Mobile (BOI12_mobile) C++14
0 / 100
385 ms 8276 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(4) << 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 1 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 2392 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 4700 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 28 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 28 ms 4700 KB Output is correct
3 Correct 28 ms 4696 KB Output is correct
4 Incorrect 39 ms 6744 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 6744 KB Output is correct
2 Correct 36 ms 6796 KB Output is correct
3 Correct 33 ms 6744 KB Output is correct
4 Incorrect 44 ms 6776 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 36 ms 6748 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 155 ms 6748 KB Output is correct
2 Correct 166 ms 6744 KB Output is correct
3 Correct 175 ms 6744 KB Output is correct
4 Incorrect 193 ms 6748 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 182 ms 6748 KB Output is correct
2 Incorrect 167 ms 6744 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 186 ms 6748 KB Output is correct
2 Correct 203 ms 6776 KB Output is correct
3 Correct 205 ms 6748 KB Output is correct
4 Incorrect 221 ms 6744 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 209 ms 6748 KB Output is correct
2 Incorrect 202 ms 6748 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 218 ms 6996 KB Output is correct
2 Correct 237 ms 6992 KB Output is correct
3 Correct 230 ms 6992 KB Output is correct
4 Incorrect 253 ms 6992 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 245 ms 7032 KB Output is correct
2 Incorrect 238 ms 7032 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 256 ms 7484 KB Output is correct
2 Correct 265 ms 7308 KB Output is correct
3 Correct 270 ms 7304 KB Output is correct
4 Incorrect 303 ms 7248 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 279 ms 7252 KB Output is correct
2 Incorrect 275 ms 7248 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 315 ms 8072 KB Output is correct
2 Correct 349 ms 8276 KB Output is correct
3 Correct 331 ms 8020 KB Output is correct
4 Incorrect 385 ms 8276 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 341 ms 8264 KB Output is correct
2 Incorrect 353 ms 8264 KB Output isn't correct
3 Halted 0 ms 0 KB -