# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
735119 | 2023-05-03T15:02:20 Z | ace_in_the_hole | Mobile (BOI12_mobile) | C++17 | 280 ms | 13584 KB |
#include<bits/stdc++.h> using namespace std; typedef long long Int; typedef double Real; const Real EPS = 1e-6; bool leq(Real x, Real y) { return x-EPS <= y; } const int N = 1e6 + 50; int n,L, x[N]; Int y[N]; bool check(Real dis) { Real rightmost = 0; Real d_squared = dis * dis; for (int i = 1; i <= n; i++) { if (leq(dis, y[i])) continue; Real lef = x[i] - sqrt(d_squared - y[i]); Real rig = 2*x[i] - lef; if (leq(lef, rightmost)) { rightmost = max(rightmost, rig); if (leq(L,rightmost)) return true; } } return false; } void solve() { cin >> n >> L; for (int i = 1; i <= n; i++) cin >> x[i] >> y[i]; //preprocessing Real max_dist = L; for (int i = 1; i <= n; i++) { y[i] *= y[i]; int x_dis = max(x[i], L - x[i]); Real cur_dist = sqrt(y[i] + 1ll * x_dis * x_dis); // cerr << cur_dist << '\n'; max_dist = max(max_dist, cur_dist); } const Real DEL = 1e-3; Real ans = 0; for (Real low = 0, high = max_dist + 100; high - low >= DEL; ) { Real mid = (low + high) / 2; if (check(mid)) high = mid; else ans = low = mid; } cout << fixed << setprecision(15) << ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define task "WF" if (fopen(task".inp", "r")) { freopen(task".inp", "r", stdin); freopen(task".out", "w", stdout); } solve(); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 328 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 13 ms | 2004 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 16 ms | 1860 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 2024 KB | Output is correct |
2 | Incorrect | 16 ms | 2320 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 3024 KB | Output is correct |
2 | Incorrect | 25 ms | 2904 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 21 ms | 2896 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 141 ms | 8396 KB | Output is correct |
2 | Incorrect | 97 ms | 8364 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 113 ms | 8360 KB | Output is correct |
2 | Incorrect | 94 ms | 8356 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 158 ms | 9492 KB | Output is correct |
2 | Correct | 122 ms | 9536 KB | Output is correct |
3 | Incorrect | 111 ms | 9672 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 123 ms | 9528 KB | Output is correct |
2 | Incorrect | 111 ms | 9528 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 190 ms | 10708 KB | Output is correct |
2 | Correct | 138 ms | 10696 KB | Output is correct |
3 | Incorrect | 122 ms | 10652 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 154 ms | 10572 KB | Output is correct |
2 | Incorrect | 131 ms | 10652 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 212 ms | 11548 KB | Output is correct |
2 | Incorrect | 162 ms | 11516 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 168 ms | 11472 KB | Output is correct |
2 | Incorrect | 141 ms | 11420 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 280 ms | 13584 KB | Output is correct |
2 | Correct | 193 ms | 13420 KB | Output is correct |
3 | Incorrect | 179 ms | 13380 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 201 ms | 12052 KB | Output is correct |
2 | Incorrect | 179 ms | 13388 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |