1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <algorithm>
#include <iostream>
#include <array>
#include <numeric>

constexpr int SIZE = 18;

class Player
{
private:
  constexpr auto sum() const
  {
    return std::accumulate(data.begin(), data.end(), 0);
  }
public:
  constexpr Player(const std::string_view name_) : name(name_) {}
  constexpr auto operator <=>(Player& other)
  {
    if (auto const result = this->sum() <=> other.sum(); result != 0)
      return result;
    std::ranges::sort(this->data, std::ranges::greater{});
    std::ranges::sort(other.data, std::ranges::greater{});
    return this->data <=> other.data;
  }
  const std::string name;
  std::array<int, SIZE> data;
};

int main()
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  std::array players = {Player("Algosia"), Player("Bajtek")};

  for (auto& player : players)
    for (auto& elem : player.data)
      std::cin >> elem;

  if (auto const result = players[0] <=> players[1]; result > 0)
    std::cout << players[0].name;
  else if (result < 0)
    std::cout << players[1].name;
  else
    std::cout << "remis\n";
}