QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#802917#9869. Horizon Scanningucup-team3584#Compile Error//C++232.8kb2024-12-07 15:11:462024-12-07 15:11:46

Judging History

你现在查看的是最新测评结果

  • [2024-12-07 15:11:46]
  • 评测
  • [2024-12-07 15:11:46]
  • 提交

answer

korebaguraseterunoakan
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

struct point {
    ll x, y;
    point() = default;
    point(ll x, ll y) : x(x), y(y) {}
    point operator-(point p) const { return {x - p.x, y - p.y}; }
    double dist(point p) const { return sqrt((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y)); }
};
ll cross(point a, point b) { return a.x * b.y - a.y * b.x; }
int arg_area(point p) {
    if (p.y < 0) return 2;
    else if (p.x < 0) return 1;
    else return 0;
}
// 整数範囲の偏角ソート 同一点ないと仮定
// 同一偏角の場合は原点に近い方を優先
bool arg_comp(point a, point b) {
    int ap = arg_area(a), bp = arg_area(b);
    if (ap != bp) return ap < bp;
    auto crs = cross(a, b);
    if (crs == 0) return abs(a.x) + abs(a.y) < abs(b.x) + abs(b.y);
    else return crs > 0;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int q;
    cin >> q;
    while (q--) {
        int n, k;
        cin >> n >> k;
        vector<point> p(n);
        for (int i = 0; i < n; ++i) {
            cin >> p[i].x >> p[i].y;
        }
        sort(p.begin(), p.end(), arg_comp);
        vector<pair<point, int>> v;
        for (int i = 0; i < n;) {
            auto pp = p[i];
            int cnt = 0;
            while (i < n) {
                if (p[i].x * pp.y == p[i].y * pp.x and p[i].x * pp.x + p[i].y * pp.y >= 0) {
                    ++cnt;
                    ++i;
                } else {
                    break;
                }
            }
            v.emplace_back(pp, cnt);
        }
        double res = 0;
        if (n == k) {
            res = 2.0 * acos(-1);
        } else {
            int sum = 0;
            auto calc = [&](point p) -> double { return atan2(p.y, p.x); };
            vector<pair<double, int>> vv;
            for (int i = 0; i < v.size(); ++i) {
                vv.emplace_back(calc(v[i].first), i);
                //                cout << vv.back().first << " " << vv.back().second << endl;
            }
            for (int i = 0, j = 0; i < vv.size(); ++i) {
                while (sum < k) {
                    if (j == vv.size() - 1) j = 0;
                    else ++j;
                    sum += vv[j].second;
                }
                int ii = (i ? i - 1 : vv.size() - 1);
                int jj = (j + 1 < vv.size() ? j + 1 : 0);
                {
                    auto u = vv[ii].first - vv[j].first;
                    res = max(res, u);
                }
                {
                    auto u = vv[i].first - vv[jj].first;
                    res = max(res, u);
                }
                sum -= v[i].second;
            }
        }
        printf("%.10f\n", res);
    }
}

详细

answer.code:1:1: error: ‘korebaguraseterunoakan’ does not name a type
    1 | korebaguraseterunoakan
      | ^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/bits/stl_algobase.h:62,
                 from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from answer.code:2:
/usr/include/c++/13/ext/type_traits.h:164:35: error: ‘constexpr const bool __gnu_cxx::__is_null_pointer’ redeclared as different kind of entity
  164 |   __is_null_pointer(std::nullptr_t)
      |                                   ^
/usr/include/c++/13/ext/type_traits.h:159:5: note: previous declaration ‘template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)’
  159 |     __is_null_pointer(_Type)
      |     ^~~~~~~~~~~~~~~~~
/usr/include/c++/13/ext/type_traits.h:164:26: error: ‘nullptr_t’ is not a member of ‘std’; did you mean ‘nullptr_t’?
  164 |   __is_null_pointer(std::nullptr_t)
      |                          ^~~~~~~~~
In file included from /usr/include/c++/13/cstddef:50,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:41:
/usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h:443:29: note: ‘nullptr_t’ declared here
  443 |   typedef decltype(nullptr) nullptr_t;
      |                             ^~~~~~~~~
In file included from /usr/include/c++/13/bits/stl_pair.h:60,
                 from /usr/include/c++/13/bits/stl_algobase.h:64:
/usr/include/c++/13/type_traits:510:26: error: ‘std::size_t’ has not been declared
  510 |   template<typename _Tp, std::size_t _Size>
      |                          ^~~
/usr/include/c++/13/type_traits:511:25: error: ‘_Size’ was not declared in this scope
  511 |     struct is_array<_Tp[_Size]>
      |                         ^~~~~
/usr/include/c++/13/type_traits:511:31: error: template argument 1 is invalid
  511 |     struct is_array<_Tp[_Size]>
      |                               ^
/usr/include/c++/13/type_traits:617:33: error: ‘nullptr_t’ is not a member of ‘std’; did you mean ‘nullptr_t’?
  617 |     struct is_null_pointer<std::nullptr_t>
      |                                 ^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h:443:29: note: ‘nullptr_t’ declared here
  443 |   typedef decltype(nullptr) nullptr_t;
      |                             ^~~~~~~~~
/usr/include/c++/13/type_traits:617:42: error: template argument 1 is invalid
  617 |     struct is_null_pointer<std::nullptr_t>
      |                                          ^
/usr/include/c++/13/type_traits:621:48: error: template argument 1 is invalid
  621 |     struct is_null_pointer<const std::nullptr_t>
      |                                                ^
/usr/include/c++/13/type_traits:625:51: error: template argument 1 is invalid
  625 |     struct is_null_pointer<volatile std::nullptr_t>
      |                                                   ^
/usr/include/c++/13/type_traits:629:57: error: template argument 1 is invalid
  629 |     struct is_null_pointer<const volatile std::nullptr_t>
      |                                                         ^
/usr/include/c++/13/type_traits:1348:37: error: ‘size_t’ is not a member of ‘std’; did you mean ‘size_t’?
 1348 |     : public integral_constant<std::size_t, alignof(_Tp)>
      |                                     ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h:214:23: note: ‘size_t’ declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/13/type_traits:1348:57: error: template argument 1 is invalid
 1348 |     : public integral_constant<std::size_t, alignof(_Tp)>
      |                                                         ^
/usr/include/c++/13/type_traits:1357:37: error: ‘size_t’ is not a member of ‘std’; did you mean ‘size_t’?
 1357 |     : public integral_constant<std::size_t, 0> { };
      |                                     ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h:214:23: note: ‘size_t’ declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/13/type_traits:1357:46: error: template argument 1 is invalid
 1357 |     : public integral_constant<std::size_t, 0> { };
      |                                              ^
/usr/include/c++/13/type_traits:1359:26: error: ‘std::size_t’ has not been declared
 1359 |   template<typename _Tp, std::size_t _Size>
      |                          ^~~
/usr/include/c++/13/type_traits:1360:21: error: ‘_Size’ was not declared in this scope
 1360 |     struct rank<_Tp[_Size]>
      |                     ^~~~~
/usr/include/c++/13/type_traits:1360:27: error: template argument 1 is invalid
 1360 |     struct rank<_Tp[_Size]>
      |                           ^
/usr/include/c++/13/type_traits:1361:37: error: ‘size_t’ is not a member of ‘std’; did you mean ‘size_t’?
 1361 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |                             ...