Submission #869183

#TimeUsernameProblemLanguageResultExecution timeMemory
869183tvladm2009Balloons (CEOI11_bal)C++14
Compilation error
0 ms0 KiB
#include <cmath> #include <functional> #include <fstream> #include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include <map> #include <list> #include <time.h> #include <math.h> #include <random> #include <deque> #include <queue> #include <unordered_map> #include <unordered_set> #include <iomanip> #include <cassert> #include <bitset> #include <sstream> #include <chrono> #include <cstring> #include <numeric> using namespace std; typedef long long ll; typedef long double ld; const int N = (int)2e5 + 7; ld x[N], r[N], rad[N]; int n; struct Circle { ld x; ld y; ld radius; }; bool check(Circle a, Circle b) { ld d = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y); if (d <= (a.radius + b.radius) * (a.radius + b.radius)) { return false; } return true; } int main() { #ifdef ONLINE_JUDGE ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #else FILE* stream; freopen_s(&stream, "input.txt", "r", stdin); #endif cin >> n; for (int i = 1; i <= n; i++) { cin >> x[i] >> r[i]; } rad[1] = r[1]; for (int i = 2; i <= n; i++) { ld best = r[i]; for (int j = 1; j < i; j++) { ld lo = 0.0, hi = r[i], sol = 0.0; for (int step = 1; step <= 100; step++) { ld mi = (lo + hi) / 2; if (check(Circle{rad[j], x[j], rad[j]}, Circle{mi, x[i], mi})) { lo = mi + 1; sol = mi; } else { hi = mi - 1; } } best = min(best, sol); } rad[i] = best; } for (int i = 1; i <= n; i++) { cout << setprecision(10) << fixed << rad[i] << "\n"; } return 0; }

Compilation message (stderr)

bal.cpp: In function 'int main()':
bal.cpp:53:9: error: 'freopen_s' was not declared in this scope; did you mean 'freopen64'?
   53 |         freopen_s(&stream, "input.txt", "r", stdin);
      |         ^~~~~~~~~
      |         freopen64