Problem p02805 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<long long, long long> ii;
typedef complex<long double> com;

ld ans = LLONG_MAX;
ll n;
vector<com> coor;

ld check(com t) {
  ld temp = 0;
  for (int z = 0; z < n; z++) {
    temp = max(temp, norm(coor[z] - t));
  }
  ans = min(ans, temp);
  return temp;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  coor.resize(n);
  for (int z = 0; z < n; z++) {
    ld real, img;
    cin >> real >> img;
    com t(real, img);
    coor[z] = t;
  }
  ld xl = 0;
  ld xr = 1000;
  ld e = 1e-18;
  while (xr - xl >= e) {
    ld l1 = xl + (xr - xl) / ld(3.0);
    ld r1 = xr - (xr - xl) / ld(3.0);
    ld yl = 0;
    ld yr = 1000;
    ld q1 = LLONG_MAX;
    ld q2 = LLONG_MAX;
    while (yr - yl >= e) {
      ld l2 = yl + (yr - yl) / ld(3.0);
      ld r2 = yr - (yr - yl) / ld(3.0);
      com t(l1, l2);
      com t1(l1, r2);
      ld temp1 = check(t);
      ld temp2 = check(t1);
      q1 = min(temp1, temp2);
      if (temp1 < temp2) {
        yr = r2;
      } else {
        yl = l2;
      }
    }
    yl = 0;
    yr = 1000;
    while (yr - yl >= e) {
      ld l2 = yl + (yr - yl) / ld(3.0);
      ld r2 = yr - (yr - yl) / ld(3.0);
      com t(r1, l2);
      com t1(r1, r2);
      ld temp1 = check(t);
      ld temp2 = check(t1);
      q2 = min(temp1, temp2);
      if (temp1 < temp2) {
        yr = r2;
      } else {
        yl = l2;
      }
    }
    if (q1 < q2) {
      xr = r1;
    } else {
      xl = l1;
    }
  }
  cout << setprecision(60) << fixed << sqrtl(ans) << endl;
}

Fixed submission:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<long long, long long> ii;
typedef complex<long double> com;

ld ans = LLONG_MAX;
ll n;
vector<com> coor;

ld check(com t) {
  ld temp = 0;
  for (int z = 0; z < n; z++) {
    temp = max(temp, norm(coor[z] - t));
  }
  ans = min(ans, temp);
  return temp;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  coor.resize(n);
  for (int z = 0; z < n; z++) {
    ld real, img;
    cin >> real >> img;
    com t(real, img);
    coor[z] = t;
  }
  ld xl = 0;
  ld xr = 1000;
  ld e = 1e-9;
  while (xr - xl >= e) {
    ld l1 = xl + (xr - xl) / ld(3.0);
    ld r1 = xr - (xr - xl) / ld(3.0);
    ld yl = 0;
    ld yr = 1000;
    ld q1 = LLONG_MAX;
    ld q2 = LLONG_MAX;
    while (yr - yl >= e) {
      ld l2 = yl + (yr - yl) / ld(3.0);
      ld r2 = yr - (yr - yl) / ld(3.0);
      com t(l1, l2);
      com t1(l1, r2);
      ld temp1 = check(t);
      ld temp2 = check(t1);
      q1 = min(temp1, temp2);
      if (temp1 < temp2) {
        yr = r2;
      } else {
        yl = l2;
      }
    }
    yl = 0;
    yr = 1000;
    while (yr - yl >= e) {
      ld l2 = yl + (yr - yl) / ld(3.0);
      ld r2 = yr - (yr - yl) / ld(3.0);
      com t(r1, l2);
      com t1(r1, r2);
      ld temp1 = check(t);
      ld temp2 = check(t1);
      q2 = min(temp1, temp2);
      if (temp1 < temp2) {
        yr = r2;
      } else {
        yl = l2;
      }
    }
    if (q1 < q2) {
      xr = r1;
    } else {
      xl = l1;
    }
  }
  cout << setprecision(60) << fixed << sqrtl(ans) << endl;
}