답안 #1108153

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1108153 2024-11-03T04:00:22 Z akamizane Mobile (BOI12_mobile) C++17
8 / 100
430 ms 33448 KB
#include<bits/stdc++.h>
 
using namespace std;

#define debug(...) 40
 
using ll = long long;
using pii = pair<int,int>;
using db = double;

#define el cout << '\n'
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FOD(i, a, b) for (int i = (a); i >= (b); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
template <class T1, class T2>bool chmax(T1 &a, T2 b){return a < b ? a = b, 1 : 0;}
template <class T1, class T2>bool chmin(T1 &a, T2 b){return a > b ? a = b, 1 : 0;}
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int maxn = 2e5 + 5;

const ll mod = 1e9 + 7;

void solve(){
  int n, len;
  cin >> n >> len;
  vector<pair<ll, ll>> a;
  for (int i = 0; i < n; i++){
    double x, y;
    cin >> x >> y;
    a.pb({x, y});
  }
  debug(a);
  auto check = [&] (double mid){
    double right = 0;
    for (int i = 0; i < n; i++){
      auto [x, y] = a[i];
      auto d = sqrt(mid * mid - y * y);
      debug(d);
      double x1 = x - d, x2 = x + d;
      if (x1 <= right){
        chmax(right, x2);
      }
    }
    return right >= len;
  };
  double l = 1, r = 1e5;
  while(r - l > 1e-3){
    double m = (l + r) / 2;
    if (check(m)) r = m;
    else l = m;
  }
  cout << setprecision(4) << fixed << r;
}

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tests = 1;
  // cin >> tests;
  for (int _ = 1; _ <= tests; _++){
    cerr << "- Case #" << _ << ": \n";
    solve();
    el;
  }
  return 0;
}

Compilation message

mobile.cpp: In function 'void solve()':
mobile.cpp:5:20: warning: statement has no effect [-Wunused-value]
    5 | #define debug(...) 40
      |                    ^~
mobile.cpp:37:3: note: in expansion of macro 'debug'
   37 |   debug(a);
      |   ^~~~~
mobile.cpp: In lambda function:
mobile.cpp:5:20: warning: statement has no effect [-Wunused-value]
    5 | #define debug(...) 40
      |                    ^~
mobile.cpp:43:7: note: in expansion of macro 'debug'
   43 |       debug(d);
      |       ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 592 KB Output is correct
2 Correct 2 ms 592 KB Output is correct
3 Correct 2 ms 336 KB Output is correct
4 Incorrect 2 ms 592 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 592 KB Output is correct
2 Incorrect 3 ms 592 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 592 KB Output is correct
2 Incorrect 3 ms 592 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 592 KB Output is correct
2 Incorrect 3 ms 592 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 4300 KB Output is correct
2 Incorrect 28 ms 4556 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 4364 KB Output is correct
2 Correct 30 ms 4348 KB Output is correct
3 Correct 35 ms 4556 KB Output is correct
4 Correct 35 ms 4576 KB Output is correct
5 Incorrect 40 ms 4812 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 4120 KB Output is correct
2 Incorrect 30 ms 4812 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 38 ms 4812 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 4752 KB Output is correct
2 Incorrect 37 ms 4812 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 145 ms 13256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 194 ms 16824 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 194 ms 23856 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 229 ms 27824 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 208 ms 23612 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 298 ms 27708 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 231 ms 23612 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 314 ms 28080 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 306 ms 25512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 430 ms 33448 KB Output isn't correct
2 Halted 0 ms 0 KB -