Tifa's CP Library

:heavy_check_mark: src/geo2d/dot/lib.hpp

Depends on

Required by

Verified with

Code

#pragma once

#include "../../util/util/lib.hpp"

namespace tifa_libs {

template <class P>
CEXP TPN P::FP_t dot(P CR o, P CR a, P CR b) NE { return (a - o) * (b - o); }
template <class P>
CEXP int sgn_dot(P CR o, P CR a, P CR b) NE { return sgn(dot(o, a, b)); }

}  // namespace tifa_libs
#line 2 "src/geo2d/dot/lib.hpp"

#line 2 "src/util/util/lib.hpp"
// https://github.com/Tiphereth-A/CP-lib
#include <bits/extc++.h>
// clang-format off
namespace tifa_libs {

#define CEXP constexpr
#define CEXPE constexpr explicit
#define CR const&
#define CP const*
#define PC *const
#define CPC const*const
#define TPN typename
#define NE noexcept
#define CNE const noexcept
#define ND [[nodiscard]]
#define cT_(...) std::conditional_t<sizeof(__VA_ARGS__) <= sizeof(size_t) * 2, __VA_ARGS__, __VA_ARGS__ CR>
// NOLINTNEXTLINE(misc-const-correctness)
#define flt_(T, i, l, r, ...) for (T i = (l), i##e = (r)__VA_OPT__(, ) __VA_ARGS__; i < i##e; ++i)
#define retif_(cond, if_true, ...) if cond return if_true __VA_OPT__(; else return __VA_ARGS__)
#ifdef ONLINE_JUDGE
#undef assert
#define assert(x) 42
#endif

using namespace std::ranges;
using namespace std::literals;

template <class T>
CEXP T abs(T x) NE { retif_((x < 0), -x, x); }

}  // namespace tifa_libs
// clang-format on
#line 4 "src/geo2d/dot/lib.hpp"

namespace tifa_libs {

template <class P>
CEXP TPN P::FP_t dot(P CR o, P CR a, P CR b) NE { return (a - o) * (b - o); }
template <class P>
CEXP int sgn_dot(P CR o, P CR a, P CR b) NE { return sgn(dot(o, a, b)); }

}  // namespace tifa_libs
Back to top page