Submission #967269

#TimeUsernameProblemLanguageResultExecution timeMemory
967269v_mateiMobile (BOI12_mobile)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <cmath> #include <iomanip> #define ll long long #define ull unsigned long long #define pdd std::pair<double, double> #define NMAX 1e6 #define INF 2e9 struct Tower { double x, y; }; struct Seg { double st, fn; }; double n, l; std::vector<Tower> s; void citire() { std::cin >> n >> l; s.resize(n); for (int i = 0; i < n; i++) { std::cin >> s[i].x >> s[i].y; } } double b_search(double lo, double hi, std::function<bool(double)> f) { for (int i = 1; hi - lo > 0.001; i++) { double mid = (lo + hi) / 2; if (f(mid)) hi = mid; else lo = mid; } return lo; } bool find_point(double k) { std::vector<Seg> segs; for (Tower &it : s) { if (k * k < it.y * it.y) continue; double max_dx = sqrt(k * k - it.y * it.y); segs.push_back({it.x - max_dx, it.x + max_dx}); if (segs.back().st < 0 && segs.back().fn > l) return 1; } double pre = 0; for (Seg &it : segs) { if (pre >= l) return 1; if (pre >= it.st) pre = std::max(pre, it.fn); } return pre > l; } int main() { ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); citire(); double k = b_search(0, INF, find_point); std::cout << std::fixed << std::setprecision(10) << k; return 0; }

Compilation message (stderr)

mobile.cpp: In function 'int main()':
mobile.cpp:61:7: error: 'ios' has not been declared
   61 |       ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
      |       ^~~
mobile.cpp:61:31: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   61 |       ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
      |                               ^~~
      |                               std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from mobile.cpp:1:
/usr/include/c++/10/iostream:60:18: note: 'std::cin' declared here
   60 |   extern istream cin;  /// Linked to standard input
      |                  ^~~
mobile.cpp:61:42: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   61 |       ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
      |                                          ^~~~
      |                                          std::cout
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from mobile.cpp:1:
/usr/include/c++/10/iostream:61:18: note: 'std::cout' declared here
   61 |   extern ostream cout;  /// Linked to standard output
      |                  ^~~~