Submission #781060

#TimeUsernameProblemLanguageResultExecution timeMemory
781060upedMobile (BOI12_mobile)C++14
0 / 100
1079 ms87244 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } void fileio(const string &name) { freopen((name + ".in").c_str(), "r", stdin); freopen((name + ".out").c_str(), "w", stdout); } int main() { int n, len; cin >> n >> len; vector<pair<int, int>> v(n); for (int i = 0; i < n; ++i) { int a, b; cin >> a >> b; v[i] = {a, b}; } double l = 0.0, r = 1e12; // todo r for (int i = 0; i < 1000; ++i) { double radius = (l + r) / 2.0; map<double, int> m; for (auto [x, y] : v) { double a = sqrt(-1 * y * y + radius * radius); ++m[max(x - a, 0.0)]; if (x + a <= len) { --m[x + a + 1e-6]; } } int cur = 0; bool ok = true; for (auto [_, cnt] : m) { cur += cnt; if (cur <= 0) { ok = false; break; } } if (ok) { r = radius; } else { l = radius; } } cout << setprecision(20) << r; return 0; }

Compilation message (stderr)

mobile.cpp: In function 'int main()':
mobile.cpp:30:19: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   30 |         for (auto [x, y] : v) {
      |                   ^
mobile.cpp:39:19: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   39 |         for (auto [_, cnt] : m) {
      |                   ^
mobile.cpp: In function 'void fileio(const string&)':
mobile.cpp:13:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     freopen((name + ".in").c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:14:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     freopen((name + ".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...