Submission #869185

# Submission time Handle Problem Language Result Execution time Memory
869185 2023-11-03T12:38:05 Z tvladm2009 Balloons (CEOI11_bal) C
Compilation error
0 ms 0 KB
#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

bal.c:1:10: fatal error: cmath: No such file or directory
    1 | #include <cmath>
      |          ^~~~~~~
compilation terminated.