Language: C++

#include <bits/stdc++.h>
using namespace std;

float triangleArea(float w, float h)
{
  return (w * h) / 2.0f;
}

float trapeArea(float upEdge, float downEdge, float h)
{
  return ((upEdge + downEdge) * h) / 2.0f;
}

int main() {
  bool flag = false;
  int W, H, x, y;
  float PI = 3.141592f;
  float deg2rad = PI / 180.0f;
  cin >> W >> H >> x >> y;
  float S = W * H;
  float maxMin = S;
  
  // theta = 0(x軸と並行）
  float S_x = y * H;
  maxMin = min(S - S_x, S_x);

  for (float theta = 1; theta < 90; theta++)
  {
    float X_0, X_H, Y_0, Y_W;
    float a = tan(theta * deg2rad);
    float s;
    Y_0 = y - a * x;
    Y_W = Y_0 + a * W;
    X_0 = - (Y_0 / a);
    X_H = (H - Y_0) / a;
    
    if (Y_0 < 0)
    {
      // 三角形か台形の面積を求める
      if (Y_W < H)
        s = triangleArea(W - X_0, Y_W);
      else
        s = trapeArea(W - X_0, W - X_H, H);
    }
    else
    {
      if (Y_W < H)
        s = trapeArea(Y_0, Y_W, W);
      else
        s = triangleArea(H - Y_0, X_H);
    }
    
    tmpMaxMin = max(maxMin, min(S, S - s));
    if (tmpMaxMin == maxMin) flag = true;
    maxMin = tmpMaxMin;
  }
  
  maxMin = max(min(x * W, S - x * W), maxMin);
  
  cout << maxMin << " ";
  if(flag) cout << "1" << endl;
  else cout << "0" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:5: error: 'tmpMaxMin' was not declared in this scope; did you mean 'maxMin'?
   53 |     tmpMaxMin = max(maxMin, min(S, S - s));
      |     ^~~~~~~~~
      |     maxMin
a.cc:58:19: error: no matching function for call to 'min(int, float)'
   58 |   maxMin = max(min(x * W, S - x * W), maxMin);
      |                ~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:58:19: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'float')
   58 |   maxMin = max(min(x * W, S - x * W), maxMin);
      |                ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:58:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   58 |   maxMin = max(min(x * W, S - x * W), maxMin);
      |                ~~~^~~~~~~~~~~~~~~~~~