Submission #952351

#TimeUsernameProblemLanguageResultExecution timeMemory
952351coolsentenceidontrememberMobile (BOI12_mobile)C++17
100 / 100
510 ms35284 KiB
#include<bits/stdc++.h> #define ll long long #define ld long double #define ff first #define ss second #define db double using namespace std; void setIO(string s = ""){ ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); if (s.size()){ freopen((s+".in").c_str(), "r", stdin); freopen((s+".out").c_str(), "w", stdout); } } ll pow_mod(ll a, ll b, ll m){ ll res = 1; a%=m; for (; b; b>>=1, a = (a*a)%m){ if (b&1) res = (res*a)%m; } return res; } ll pow(ll a, ll b){ ll res = 1; for (; b; b>>=1, a*=a){ if (b&1) res *= a; } return res; } void GiveMeAnswer(){ int n; db len; cin >> n >> len; pair<db, db> station[n]; for (auto &a : station) cin >> a.ff >> a.ss; double l = 0, r = 1.5e9; while (r-l>1e-4){ db m = (l+r)/2, mx = 0; for (int i = 0; i < n; i++){ db p = m*m-station[i].ss*station[i].ss; if (p<0) continue; p = sqrt(p); db start = station[i].ff-p, end = station[i].ff+p; if (start<mx) mx = max(mx, end); } if (mx>=len) r = m; else l = m; } cout << fixed << setprecision(6) << l << '\n'; } int main(){ auto begin = chrono::high_resolution_clock::now(); setIO(); int tt = 1; //cin >> tt; for (int t = 1; t <= tt; t++) GiveMeAnswer(); auto end = chrono::high_resolution_clock::now(); // super cool C++ timer auto elapsed = chrono::duration_cast<chrono::nanoseconds>(end-begin); auto fulltime = elapsed.count()*1e-9; cerr << "\n\nExecution time: " << fulltime << " seconds.\n"; if (fulltime>1) cerr << "TLE!1!!1!!11!!1 C= C= C= C= C=+(;·w·)+"; else cerr << "You safe brother"; return 0; }

Compilation message (stderr)

mobile.cpp: In function 'void setIO(std::string)':
mobile.cpp:16:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |  freopen((s+".in").c_str(), "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:17:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |  freopen((s+".out").c_str(), "w", stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...