Language: C++

#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323846
#define EPS 1e-9
typedef long long ll;

typedef complex<double> P;

double cross(P a, P b) { return a.real() * b.imag() - a.imag() * b.real(); }

double distance(P a, P b) { return abs(a - b); }

struct light {
  P pos;
  double r, t, a, b;
  int p;
};

vector<vector<int>> construct(const vector<light>& v) {
  vector<vector<int>> graph(v.size());
  for (int i = 0; i < v.size() - 1; i++) {
    for (int j = 1; j < v.size(); j++) {
      double d = distance(v[i].pos, v[j].pos);
      double w = asin(v[j].r / d);
      P i1 = polar(1.0, arg(v[j].pos - v[i].pos) - w);
      P i2 = polar(1.0, arg(v[j].pos - v[i].pos) + w);
      P o1 = polar(1.0, v[i].b - v[i].t / 2);
      P o2 = polar(1.0, v[i].b + v[i].t / 2);
      if (d + v[j].r <= v[i].a + EPS && cross(o1, i1) >= -EPS && cross(i2, o2) >= -EPS) {
        graph[i].push_back(j);
      }
    }
  }
  /*
  for (int i = 0; i < graph.size(); i++) {
    cerr << i << ": ";
    for (auto e : graph[i]) {
      cerr << e << " ";
    }
    cerr << endl;
  }
  */
  return graph;
}

int main() {
  int n;
  cin >> n;
  vector<light> v(n + 2);
  cin >> v[0].t >> v[0].a >> v[0].p;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y >> v[i + 1].r >> v[i + 1].t >> v[i + 1].a >> v[i + 1].b >> v[i + 1].p;
    v[i + 1].pos = P(x, y);
  }
  {
    int x, y;
    cin >> x >> y >> v[n + 1].r;
    v[n + 1].pos = P(x, y);
    v[n + 1].p = 1e9;
  }
  for (auto& e : v) {
    e.t = e.t / 180.0 * PI;
    e.b = e.b / 180.0 * PI;
  }
  /*
  for (auto e : v) {
    cerr << e.pos.real() << " " << e.pos.imag() << " " << e.r << " " << e.t << " " << e.a << " " << e.b << " " << e.p
         << endl;
  }
  */

  ll answer = 0;
  for (int i = 1; i < n + 2; i++) {
    v[0].b = arg(v[i].pos) - asin(v[i].r / abs(v[i].pos)) + v[0].t / 2;
    // cerr << v[0].b / PI * 180 << endl;
    auto graph = construct(v);
    vector<int> k(graph.size());
    for (auto edges : graph) {
      for (auto e : edges) {
        k[e]++;
      }
    }

    vector<ll> dp(graph.size());
    dp[0] = v[0].p;
    stack<int> s;
    for (int i = 0; i < k.size(); i++) {
      if (k[i] == 0) {
        s.push(i);
      }
    }
    while (!s.empty()) {
      int t = s.top();
      s.pop();
      dp[t] = min(v[t].p, dp[t]);
      for (auto e : graph[t]) {
        dp[e] += dp[t];
        k[e]--;
        if (k[e] == 0) {
          s.push(e);
        }
      }
    }
    /*
    for (auto e : dp) {
      cerr << e << " ";
    }
    cerr << endl;
    */
    answer = max(answer, dp[n + 1]);
  }

  cout << answer << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:96:18: error: no matching function for call to 'min(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)'
   96 |       dp[t] = min(v[t].p, dp[t]);
      |               ~~~^~~~~~~~~~~~~~~
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:96:18: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
   96 |       dp[t] = min(v[t].p, dp[t]);
      |               ~~~^~~~~~~~~~~~~~~
/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:96:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   96 |       dp[t] = min(v[t].p, dp[t]);
      |               ~~~^~~~~~~~~~~~~~~