Submission #1108154

#TimeUsernameProblemLanguageResultExecution timeMemory
1108154akamizaneMobile (BOI12_mobile)C++17
100 / 100
520 ms36284 KiB
#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 = 1.5e9; 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 (stderr)

mobile.cpp: In function 'void solve()':
mobile.cpp:6:20: warning: statement has no effect [-Wunused-value]
    6 | #define debug(...) 40
      |                    ^~
mobile.cpp:39:3: note: in expansion of macro 'debug'
   39 |   debug(a);
      |   ^~~~~
mobile.cpp: In lambda function:
mobile.cpp:6:20: warning: statement has no effect [-Wunused-value]
    6 | #define debug(...) 40
      |                    ^~
mobile.cpp:45:7: note: in expansion of macro 'debug'
   45 |       debug(d);
      |       ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...