#include <iostream> #include <vector> #include <algorithm> #include <math.h> #include <set> #include <map> #include <stack> #include <queue> #include <iomanip> using namespace std; typedef long long ll; const int N = 2e2 + 10; const int P = 101; const ll MLL = 1e18; const ll mod = 998244353; const ll LOG = 23; void solve() { vector<int> a(18), b(18); int n = 18; int sum = 0; for(int i = 0; i < n; i++) cin >> a[i], sum += a[i]; for(int i = 0; i < n ;i++) cin >> b[i], sum -= b[i]; sort(a.begin(), a.end()); sort(b.begin(), b.end()); string winner = "remis"; if(sum > 0) { cout << "Algosia" << endl; return; }else if (sum < 0) { cout << "Bajtek" << endl; return; } for(int i = n - 1; i >= 0; i--) { if(a[i] > b[i]) { winner = "Algosia"; break; }else if(a[i] < b[i]) { winner = "Bajtek"; break; } } cout << winner << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); solve(); return 0; }
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 | #include <iostream> #include <vector> #include <algorithm> #include <math.h> #include <set> #include <map> #include <stack> #include <queue> #include <iomanip> using namespace std; typedef long long ll; const int N = 2e2 + 10; const int P = 101; const ll MLL = 1e18; const ll mod = 998244353; const ll LOG = 23; void solve() { vector<int> a(18), b(18); int n = 18; int sum = 0; for(int i = 0; i < n; i++) cin >> a[i], sum += a[i]; for(int i = 0; i < n ;i++) cin >> b[i], sum -= b[i]; sort(a.begin(), a.end()); sort(b.begin(), b.end()); string winner = "remis"; if(sum > 0) { cout << "Algosia" << endl; return; }else if (sum < 0) { cout << "Bajtek" << endl; return; } for(int i = n - 1; i >= 0; i--) { if(a[i] > b[i]) { winner = "Algosia"; break; }else if(a[i] < b[i]) { winner = "Bajtek"; break; } } cout << winner << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); solve(); return 0; } |