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
#include <iostream>
#include <vector>

int main() {
    std::ios_base::sync_with_stdio(0);

    int algosia_sum = 0, bajtek_sum = 0;
    int n = 18;
    int max_pts = 10;
    std::vector<int> algosia_pts(max_pts + 1);
    std::vector<int> bajtek_pts(max_pts + 1);

    for(int i = 0; i < n; ++i) {
        int pts;
        std::cin >> pts;
        ++algosia_pts[pts];
        algosia_sum += pts;
    }

    for(int i = 0; i < n; ++i) {
        int pts;
        std::cin >> pts;
        ++bajtek_pts[pts];
        bajtek_sum += pts;
    }

    if(algosia_sum > bajtek_sum) {
        std::cout << "Algosia\n";
    } else if(bajtek_sum > algosia_sum) {
        std::cout << "Bajtek\n";
    } else {
        for(int i = max_pts; i >= 0; --i) {
            if(algosia_pts[i] > bajtek_pts[i]) {
                std::cout << "Algosia\n";
                return 0;
            } else if(bajtek_pts[i] > algosia_pts[i]) {
                std::cout << "Bajtek\n";
                return 0;
            }
        }
        std::cout << "remis\n";
    }
}