Submission #1092970

#TimeUsernameProblemLanguageResultExecution timeMemory
1092970TommasoUlianMobile (BOI12_mobile)C++14
0 / 100
1101 ms64824 KiB
#include <bits/stdc++.h> #define PB push_back #define MP makepair #ifndef ONLINE_JUDGE #define DEBUG(x) cout << #x << " = " << (x) << endl #else #define DEBUG(x) #endif #define FOR(n) for(int i = 0; i < (n); i++) #define SORTA(v) sort((v).begin(), (v).end()) #define SORTD(v) sort((v).rbegin(), (v).rend()) #define PRINT(v) for(auto x: (v))cout << x << " "; cout << endl; #define TWO(n) (1 << (n)) #define INPUT(v) for(auto &x : (v))cin >> x; #pragma GCC optimize("Ofast,no-stack-protector",3) typedef long double ll; using namespace std; vector<pair<ll,ll>> torri; ll n,L; bool good(ll r){ queue<pair<ll,ll>> s; for(auto [x,y]:torri){ if(r*r >= y*y)s.push({x-(ll)sqrt(r*r-y*y),x+(ll)sqrt(r*r-y*y)}); } ll curr = 0; while(!s.empty()){ auto seg = s.front(); s.pop(); if(seg.first <= curr){ curr = seg.second; } else return false; if(curr >= L)return true; } if(curr < L)return false; return true; } void solve(){ cin >> n >> L; L *= 100000; torri = vector<pair<ll,ll>>(n); for(int i = 0; i < n; i++){ cin >> torri[i].first >> torri[i].second; torri[i].second *= 100000; torri[i].first *= 100000; } ll l = 0, r = 20e9; ll ans = r; while(l <= r){ ll c = l + (r-l)/2; if(good(c)){ ans = min(ans,c); r = c-1; } else{ l = c+1; } } cout <<(double)ans/100000.0 << endl; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); solve(); return 0; }

Compilation message (stderr)

mobile.cpp: In function 'bool good(ll)':
mobile.cpp:26:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   26 |     for(auto [x,y]:torri){
      |              ^
#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...