Submission #1101192

#TimeUsernameProblemLanguageResultExecution timeMemory
1101192zyadhanyMobile (BOI12_mobile)C++14
0 / 100
1073 ms67416 KiB
#define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> #define ll long long #define ld long double #define pl pair<ll, ll> #define vi vector<ll> #define vii vector<vi> #define vc vector<char> #define vcc vector<vc> #define vp vector<pl> #define mi map<ll,ll> #define mc map<char,ll> #define sortx(X) sort(X.begin(),X.end()); #define all(X) X.begin(),X.end() #define ln '\n' #define YES {cout << "YES\n"; return;} #define NO {cout << "NO\n"; return;} #define MUN {cout << "-1\n"; return;} const int MODE = 1e9 + 7; using namespace std; void solve(int tc) { ll n, len; cin >> n >> len; vp X(n); for (int i = 0; i < n; i++) cin >> X[i].first >> X[i].second; ld l = 5, r = 6; ld err = 1e-4; while (r - l > err) { ld mid = (l + r) / 2; bool isit = 0; ll a, b; a = b = 0; vector<pair<ld, ld>> Z; for (int i = 0; i < n; i++) { if (X[i].second > mid) continue; ld dis2 = mid * mid; ld y2 = X[i].second * X[i].second; ld diff = sqrtl(dis2 - y2); ld a = X[i].first - diff; ld b = X[i].first + diff; Z.push_back({a, b}); } sortx(Z); for (int i = 1; i < Z.size(); i++) { if (Z[i].first > Z[i - 1].second) isit = 1; Z[i].second = max(Z[i].second, Z[i - 1].second); } if (Z.empty() || Z[0].first > 0 || Z.back().second < len) isit = 1; if (isit) l = mid; else r = mid - err; } cout << fixed << setprecision(4) << l << '\n'; } int main() { ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr); int size = 1; //freopen("loan.in", "r", stdin); //freopen("loan.out", "w", stdout); //cin >> size; for (int i = 1; i <= size; i++) solve(i); }

Compilation message (stderr)

mobile.cpp: In function 'void solve(int)':
mobile.cpp:63:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long double, long double> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |         for (int i = 1; i < Z.size(); i++)
      |                         ~~^~~~~~~~~~
mobile.cpp:44:12: warning: variable 'a' set but not used [-Wunused-but-set-variable]
   44 |         ll a, b; a = b = 0;
      |            ^
#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...