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
47
48
49
50
51
52
53
54
55
56
57
58
/**
 * Patryk Kisielewski
 * 
 * Potyczki Algorytmiczne 2024
 * Zadanie: KTO - Kto wygrał? [C]
*/
#include <vector>
#include <utility>
#include <cstdio>
#include <iostream>

using namespace std;

int main() {

    std::ios::sync_with_stdio(false);

    vector<pair<int, int>> v(11, make_pair(0, 0));

    int x, sum_a = 0, sum_b = 0;

    int i;
    for (i = 0; i < 18; ++i) {
        cin >> x;
        v[x].first += 1;
        sum_a += x;
    }
    for (i = 0; i < 18; ++i) {
        cin >> x;
        v[x].second += 1;
        sum_b += x;
    }

    if (sum_a > sum_b) {
        cout << "Algosia\n";
        return 0;
    }
    if (sum_a < sum_b) {
        cout << "Bajtek\n";
        return 0;
    }

    for (auto it = v.rbegin(); it != v.rend(); ++it) {
        if ((*it).first == (*it).second) {
            continue;
        }
        if ((*it).first > (*it).second) {
            cout << "Algosia\n";
            return 0;
        }
        cout << "Bajtek\n";
        return 0;
    }

    cout << "remis\n";

    return 0;
}