code tidying
This commit is contained in:
@@ -12,7 +12,7 @@ template<int N>
|
|||||||
struct Multiplicites {
|
struct Multiplicites {
|
||||||
std::vector<int> mults;
|
std::vector<int> mults;
|
||||||
|
|
||||||
explicit Multiplicites(std::vector<Mult> vals) {
|
explicit Multiplicites(const std::vector<Mult> &vals) {
|
||||||
mults = std::vector<int>(N * (N - 1) / 2, 2);
|
mults = std::vector<int>(N * (N - 1) / 2, 2);
|
||||||
for (const auto &mult : vals) {
|
for (const auto &mult : vals) {
|
||||||
set(mult.a, mult.b, mult.mult);
|
set(mult.a, mult.b, mult.mult);
|
||||||
@@ -27,7 +27,7 @@ struct Multiplicites {
|
|||||||
mults[a + b] = mult;
|
mults[a + b] = mult;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get(int a, int b) const {
|
[[nodiscard]] int get(int a, int b) const {
|
||||||
if (a > N or b > N) throw std::logic_error("mirror does not exist");
|
if (a > N or b > N) throw std::logic_error("mirror does not exist");
|
||||||
if (a == b) throw std::logic_error("cannot compare mirror to itself");
|
if (a == b) throw std::logic_error("cannot compare mirror to itself");
|
||||||
if (a < b) std::swap(a, b); // a is bigger
|
if (a < b) std::swap(a, b); // a is bigger
|
||||||
|
|||||||
Reference in New Issue
Block a user