Language: C++


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <cstdint>
#include <tuple>
#include <numeric>
#define M_PI       3.14159265358979323846


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FILL(a, x) memset(a, x, sizeof(a))

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)

const int N = 100005;

double f(double t, vector<LL> &l, vector<LL> &r, vector<LL> &d, vector<LL> &u, vector<LL> &cx, vector<LL> &cy) {
	double xmax=-DBL_MAX, ymax=-DBL_MAX, xmin=DBL_MAX, ymin=DBL_MAX;
	if (l.size() != 0)xmax = max(xmax, l[l.size() - 1] + t);
	if (r.size() != 0)xmax = max(xmax, r[r.size() - 1] - t);
	if (cx.size() != 0)xmax = max(xmax, (double)cx[cx.size() - 1]);
	if (l.size() != 0)xmin = min(xmin, l[0] + t);
	if (r.size() != 0)xmin = min(xmin, r[0] - t);
	if (cx.size() != 0)xmin = min(xmin, (double)cx[0]);
	if (u.size() != 0)ymax = max(ymax, u[u.size() - 1] + t);
	if (d.size() != 0)ymax = max(ymax, d[d.size() - 1] - t);
	if (cy.size() != 0)ymax = max(ymax, (double)cy[cy.size() - 1]);
	if (u.size() != 0)ymin = min(ymin, u[0] + t);
	if (d.size() != 0)ymin = min(ymin, d[0] - t);
	if (cy.size() != 0)ymin = min(ymin, (double)cy[0]);
	return (xmax-xmin)*(ymax-ymin);
}

int main() {
	int n;
	scanf("%d", &n);
	vector<LL> l, cx, r, d, u,cy;
	REP(i, n) {
		int x, y;
		char str[2];
		scanf("%d%d%s", &x, &y, str);
		if (str[0] == 'R') {
			r.PB(x);
			cy.PB(y);
		}
		else if (str[0] == 'L') {
			l.PB(x);
			cy.PB(y);
		}
		else if (str[0] == 'D') {
			d.PB(y);
			cx.PB(x);
		}
		else if (str[0] == 'U') {
			u.PB(y);
			cx.PB(x);
		}
	}
	SORT(r);
	SORT(l);
	SORT(d);
	SORT(u);
	SORT(cx);
	SORT(cy);
	double p = 0, q = (double)(1 << 25);
	REP(i,10000) {
		double m1 = (2*p+q) / 3.0;
		double m2 = (p+2*q) / 3.0;
		if (f(m1, l, r, d, u, cx, cy) > f(m2, l, r, d, u, cx, cy)) {
			p = m1;
		}
		else {
			q = m2;
		}
	}
	printf("%.12f\n",  f(p, l, r, d, u, cx, cy))+
	return 0;
}

Compiler output:
a.cc: In function 'double f(double, std::vector<long long int>&, std::vector<long long int>&, std::vector<long long int>&, std::vector<long long int>&, std::vector<long long int>&, std::vector<long long int>&)':
a.cc:71:22: error: 'DBL_MAX' was not declared in this scope
   71 |         double xmax=-DBL_MAX, ymax=-DBL_MAX, xmin=DBL_MAX, ymin=DBL_MAX;
      |                      ^~~~~~~
a.cc:27:1: note: 'DBL_MAX' is defined in header '<cfloat>'; this is probably fixable by adding '#include <cfloat>'
   26 | #include <cstdint>
  +++ |+#include <cfloat>
   27 | #include <tuple>
a.cc:75:27: error: 'xmin' was not declared in this scope; did you mean 'fmin'?
   75 |         if (l.size() != 0)xmin = min(xmin, l[0] + t);
      |                           ^~~~
      |                           fmin
a.cc:76:27: error: 'xmin' was not declared in this scope; did you mean 'fmin'?
   76 |         if (r.size() != 0)xmin = min(xmin, r[0] - t);
      |                           ^~~~
      |                           fmin
a.cc:77:28: error: 'xmin' was not declared in this scope; did you mean 'fmin'?
   77 |         if (cx.size() != 0)xmin = min(xmin, (double)cx[0]);
      |                            ^~~~
      |                            fmin
a.cc:78:27: error: 'ymax' was not declared in this scope; did you mean 'xmax'?
   78 |         if (u.size() != 0)ymax = max(ymax, u[u.size() - 1] + t);
      |                           ^~~~
      |                           xmax
a.cc:79:27: error: 'ymax' was not declared in this scope; did you mean 'xmax'?
   79 |         if (d.size() != 0)ymax = max(ymax, d[d.size() - 1] - t);
      |                           ^~~~
      |                           xmax
a.cc:80:28: error: 'ymax' was not declared in this scope; did you mean 'xmax'?
   80 |         if (cy.size() != 0)ymax = max(ymax, (double)cy[cy.size() - 1]);
      |                            ^~~~
      |                            xmax
a.cc:81:27: error: 'ymin' was not declared in this scope; did you mean 'fmin'?
   81 |         if (u.size() != 0)ymin = min(ymin, u[0] + t);
      |                           ^~~~
      |                           fmin
a.cc:82:27: error: 'ymin' was not declared in this scope; did you mean 'fmin'?
   82 |         if (d.size() != 0)ymin = min(ymin, d[0] - t);
      |                           ^~~~
      |                           fmin
a.cc:83:28: error: 'ymin' was not declared in this scope; did you mean 'fmin'?
   83 |         if (cy.size() != 0)ymin = min(ymin, (double)cy[0]);
      |                            ^~~~
      |                            fmin
a.cc:84:22: error: 'xmin' was not declared in this scope; did you mean 'fmin'?
   84 |         return (xmax-xmin)*(ymax-ymin);
      |                      ^~~~
      |                      fmin
a.cc:84:29: error: 'ymax' was not declared in this scope; did you mean 'xmax'?
   84 |         return (xmax-xmin)*(ymax-ymin);
      |                             ^~~~
      |                             xmax
a.cc:84:34: error: 'ymin' was not declared in this scope; did you mean 'fmin'?
   84 |         return (xmax-xmin)*(ymax-ymin);
      |                                  ^~~~
      |                                  fmin
a.cc: In function 'int main()':
a.cc:130:9: error: expected primary-expression before 'return'
  130 |         return 0;
      |         ^~~~~~