// Fryderyk Brajer #include <bits/stdc++.h> using namespace std; using llong = long long; using pii = pair<int, int>; constexpr int max_n = 18 + 5; constexpr int mod = 1e9 + 7; int Algosia[max_n]; int Bajtek[max_n]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); copy_n(istream_iterator<int>(cin), 18, Algosia); copy_n(istream_iterator<int>(cin), 18, Bajtek); int sum_Algosia = accumulate(Algosia, Algosia + 18, 0); int sum_Bajtek = accumulate(Bajtek, Bajtek + 18, 0); if (sum_Algosia != sum_Bajtek) { if (sum_Algosia > sum_Bajtek) { cout << "Algosia"; return 0; } else { cout << "Bajtek"; return 0; } } sort(Algosia, Algosia + 18, greater<int>{}); sort(Bajtek, Bajtek + 18, greater<int>{}); for (int i{}; i < 18; ++i) { if (Algosia[i] == Bajtek[i]) continue; if (Algosia[i] > Bajtek[i]) { cout << "Algosia"; return 0; } else { cout << "Bajtek"; return 0; } } cout << "remis"; }
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 | // Fryderyk Brajer #include <bits/stdc++.h> using namespace std; using llong = long long; using pii = pair<int, int>; constexpr int max_n = 18 + 5; constexpr int mod = 1e9 + 7; int Algosia[max_n]; int Bajtek[max_n]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); copy_n(istream_iterator<int>(cin), 18, Algosia); copy_n(istream_iterator<int>(cin), 18, Bajtek); int sum_Algosia = accumulate(Algosia, Algosia + 18, 0); int sum_Bajtek = accumulate(Bajtek, Bajtek + 18, 0); if (sum_Algosia != sum_Bajtek) { if (sum_Algosia > sum_Bajtek) { cout << "Algosia"; return 0; } else { cout << "Bajtek"; return 0; } } sort(Algosia, Algosia + 18, greater<int>{}); sort(Bajtek, Bajtek + 18, greater<int>{}); for (int i{}; i < 18; ++i) { if (Algosia[i] == Bajtek[i]) continue; if (Algosia[i] > Bajtek[i]) { cout << "Algosia"; return 0; } else { cout << "Bajtek"; return 0; } } cout << "remis"; } |