QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#833620#852. Jellyfishucup-team5071#Compile Error//C++203.1kb2024-12-26 22:19:232024-12-26 22:19:24

Judging History

This is the latest submission verdict.

  • [2024-12-26 22:19:24]
  • Judged
  • [2024-12-26 22:19:23]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct lf
{
    ll x = 0, y = 1;
    lf operator+(lf a) const
    {
        return lf{x * a.y + a.x * y, y * a.y};
    };
    lf operator-(lf a) const
    {
        return lf{x * a.y - a.x * y, y * a.y};
    };
    lf operator-() const
    {
        return {-x, -y};
    };
    lf operator*(lf a) const
    {
        return lf{x * a.x, y * a.y};
    };
    lf operator/(lf a) const
    {
        return lf{x * a.y, y * a.x};
    };
    bool operator<(lf a) const
    {
        return x * a.y < y * a.x;
    }
    bool operator==(lf a) const
    {
        return x * a.y == y * a.x;
    }
    bool operator>(lf a) const
    {
        return x * a.y > y * a.x;
    }
};
const lf zero = {0, 1};
using point_t = lf;
constexpr point_t eps = zero;
template <typename T>
struct point
{
    T x, y;
    point operator+(const point &a) const { return {x + a.x, y + a.y}; }
    point operator-(const point &a) const { return {x - a.x, y - a.y}; }
    T operator*(const point &a) const { return x * a.x + y * a.y; }
    T operator^(const point &a) const { return x * a.y - y * a.x; }
    int toleft(const point &a) const
    {
        const auto t = (*this) ^ a;
        return (t > eps) - (t < eps);
    }
};
using Point = point<point_t>;
struct argcmp
{
    bool operator()(const Point &a, const Point &b) const
    {
        const auto quad = [](const Point &a)
        {
            if (a.y < -eps)
                return 1;
            if (a.y > eps)
                return 4;
            if (a.x < -eps)
                return 5;
            if (a.x > eps)
                return 3;
            return 2;
        };
        const int qa = quad(a), qb = quad(b);
        if (qa != qb)
            return qa < qb;
        const auto t = a ^ b;
        return t > eps;
    }
};

template <typename T>
struct line
{
    point<T> p, v;
    point<T> inter(const line &a) const
    {
        return p + v * ((a.v ^ (p - a.p)) / (v ^ a.v));
    }
};

using Line = line<point_t>;

long double solve()
{
    int n;
    lf M;
    cin >> M.x;
    M.y = 1;
    vector<Line> a(n);
    vector<vector<Point>> p(n);
    for (int i = 0; i < n; i++)
    {
        ll A, B, C;
        if (A == 0)
        {
            a[i] = Line{
                Point{lf{0, 1}, lf{C, B}},
                Point{lf{1, 1}, lf{0, 1}}};
        }
        else if (B == 0)
        {
            a[i] = Line{
                Point{lf{C, A}, lf{0, 1}},
                Point{lf{0, 1}, lf{1, 1}}};
        }
        else
        {
            a[i] = Line{
                Point{lf{C, A}, lf{0, 1}},
                Point{lf{A, 1}, lf{B, 1}}};
        }
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            if ((a[i].v ^ a[j].v) == 0)
                return 1;
        }
    }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T;
    cin >> T;
    cout << fixed << setprecision(15);
    while (T--)
        cout << solve() / 100. << "%\n";
}

詳細信息

answer.code:42:25: error: the value of ‘zero’ is not usable in a constant expression
   42 | constexpr point_t eps = zero;
      |                         ^~~~
answer.code:40:10: note: ‘zero’ was not declared ‘constexpr’
   40 | const lf zero = {0, 1};
      |          ^~~~
answer.code: In function ‘long double solve()’:
answer.code:128:35: error: no match for ‘operator==’ (operand types are ‘lf’ and ‘int’)
  128 |             if ((a[i].v ^ a[j].v) == 0)
      |                 ~~~~~~~~~~~~~~~~~ ^~ ~
      |                         |            |
      |                         lf           int
In file included from /usr/include/c++/13/regex:68,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:181,
                 from answer.code:1:
/usr/include/c++/13/bits/regex.h:1274:5: note: candidate: ‘template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)’ (reversed)
 1274 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1274:5: note:   template argument deduction/substitution failed:
answer.code:128:38: note:   mismatched types ‘const std::__cxx11::sub_match<_BiIter>’ and ‘int’
  128 |             if ((a[i].v ^ a[j].v) == 0)
      |                                      ^
/usr/include/c++/13/bits/regex.h:1441:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)’ (reversed)
 1441 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1441:5: note:   template argument deduction/substitution failed:
answer.code:128:38: note:   mismatched types ‘const std::__cxx11::sub_match<_BiIter>’ and ‘int’
  128 |             if ((a[i].v ^ a[j].v) == 0)
      |                                      ^
/usr/include/c++/13/bits/regex.h:1613:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)’ (reversed)
 1613 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1613:5: note:   template argument deduction/substitution failed:
answer.code:128:38: note:   mismatched types ‘const std::__cxx11::sub_match<_BiIter>’ and ‘int’
  128 |             if ((a[i].v ^ a[j].v) == 0)
      |                                      ^
In file included from /usr/include/c++/13/bits/stl_algobase.h:67,
                 from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51:
/usr/include/c++/13/bits/stl_iterator.h:534:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_IteratorL>&, const reverse_iterator<_IteratorR>&) requires requires{{std::operator==::__x->base() == std::operator==::__y->base()} -> decltype(auto) [requires std::convertible_to<<placeholder>, bool>];}’ (reversed)
  534 |     operator==(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:534:5: note:   template argument deduction/substitution failed:
answer.code:128:38: note:   mismatched types ‘const std::reverse_iterator<_IteratorL>’ and ‘int’
  128 |             if ((a[i].v ^ a[j].v) == 0)
      |                                      ^
/usr/include/c++/13/bits/stl_iterator.h:1678:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&) requires requires{{std::operator==::__x->base() == std::operator==::__y->base()} -> decltype(auto) [requires std::convertible_to<<placeholder>, bool>];}’ (reversed)
 1678 |     operator==(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:1678:5: note:   template argument deduction/substitution failed:
answer.code:128:38: note:   mismatched types ‘const std::move_iterator<_IteratorL>’ and ‘int’
  128 |             if ((a[i].v ^ a[j].v) == 0)
      |                                      ^
In file included from /usr/include/c++/13/string:43,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52:
/usr/include/c++/13/bits/allocator.h:237:5: note: candidate: ‘template<class _T1, class _T2> constexpr bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)’ (reversed)
  237 |     operator==(const allocator<_T1>&, const allocator<_T2>&)
      |     ^~~~~~~~
/usr/include/c++/13/bits/allocator.h:237:5: note:   template argument deduction/substitution failed:
answer.code:128:38: note:   mismatched types ‘const std::allocator<_CharT>’ and ‘int’
  128 |             if ((a[i].v ^ a[j].v) == 0)
      |                                      ^
In file included ...