Submission #310518

#TimeUsernameProblemLanguageResultExecution timeMemory
310518vishnu_sujithMobile (BOI12_mobile)C++17
100 / 100
784 ms16236 KiB
#include <bits/stdc++.h> using namespace std; #ifdef DEBUG #define LOG(...) cerr << "[" << #__VA_ARGS__ << "]: " << repr(__VA_ARGS__) << endl; #define MSG(args) cerr << args << "\n"; #define debug(x) x #else #define LOG(...) #define MSG(args) #define debug(x) #endif #define vi vector<int> #define ii pair<int, int> #define vii vector< ii > #define vvi vector< vi > #define mp make_pair #define pb push_back #define sz(x) (int)((x).size()) #define ms(x, v) memset((x), v, sizeof(x)) #define all(x) (x).begin(), (x).end() #define REP(x, n) for(int x = 0; x < n; x++) #define REPV(x, v, n) for(int x = v; x < n; x++) #define REVE(x, n) for(int x = n; x >= 0; x--) typedef long long ll; int N, L; double posX[1000010], posY[1000010]; bool can(double d) { double cover = 0.0; REP(i, N) { double dist = sqrt(d * d - posY[i] * posY[i]); double lft = posX[i] - dist, rgt = posX[i] + dist; if(lft <= cover) cover = max(cover, rgt); } return cover >= L; } int main() { scanf("%d%d", &N, &L); REP(i, N) scanf("%lf%lf", &posX[i], &posY[i]); double lo = 1.0, hi = 5e8; while(hi - lo > 1e-3) { double mid = (lo + hi) / 2.0; if(can(mid)) hi = mid; else lo = mid; } printf("%.7lf\n", lo); return 0; }

Compilation message (stderr)

mobile.cpp: In function 'int main()':
mobile.cpp:48:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   48 |     scanf("%d%d", &N, &L);
      |     ~~~~~^~~~~~~~~~~~~~~~
mobile.cpp:50:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   50 |  scanf("%lf%lf", &posX[i], &posY[i]);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...