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
59
60
61
62
63
64
65
66
// PA2024 runda 1C -  https://sio2.mimuw.edu.pl/c/pa-2024-1/p/kto/

//-std=c++17
#include<iostream>
#include <cstddef>
#include <algorithm>

const int TASKS = 18;


using I = u_int16_t;

void b() { std::cout << "Bajtek"; }

void a() { std::cout << "Algosia"; }

void sort_dec(I *x) {
    std::sort(x, x + TASKS, [](int a, int b) {
        return a > b;
    });
}


//12:00
int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    I algosia[TASKS];
    I a_score = 0;
    I bajtek[TASKS];
    I b_score = 0;

    for (I i = 0; i < TASKS; i++) {
        std::cin >> algosia[i];
        a_score += algosia[i];
    }
    for (I i = 0; i < TASKS; i++) {
        std::cin >> bajtek[i];
        b_score += bajtek[i];
    }
    if (a_score > b_score) {
        a();
    } else if (b_score > a_score) {
        b();
    } else {
        sort_dec(algosia);
        sort_dec(bajtek);
        bool tie = true;
        I i = 0;
        while (tie && i < TASKS) {
            if (algosia[i] != bajtek[i]) {
                tie = false;
                if (algosia[i] > bajtek[i]) {
                    a();
                } else {
                    b();
                }
            }
            i++;
        }
        if (tie) {
            std::cout << "remis";
        }
    }

}