#include <bits/stdc++.h> #define int long long #define pii pair<int,int> #define all(x) x.begin(),x.end() #define vi vector<int> #define vb vector<bool> #define vii vector<pii> #define siz(x) (int)x.size() #define pb push_back #define st first #define nd second #define rep(i,a,b) for(int i=a; i<=b; i++) using namespace std; const int inf = 1e9, maxn = 1e6, mod = 1e9+7; int32_t main(){ ios_base::sync_with_stdio(0);cin.tie(0); vi A(18); vi B(18); int suma = 0, sumb = 0; for(auto &w : A){cin>>w;suma+=w;} for(auto &w : B){cin>>w;sumb+=w;} if(suma>sumb){cout<<"Algosia";return 0;} if(sumb>suma){cout<<"Bajtek";return 0;} sort(all(A));reverse(all(A)); sort(all(B));reverse(all(B)); rep(i,0,17){ if(A[i]>B[i]){cout<<"Algosia";return 0;} if(B[i]>A[i]){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 | #include <bits/stdc++.h> #define int long long #define pii pair<int,int> #define all(x) x.begin(),x.end() #define vi vector<int> #define vb vector<bool> #define vii vector<pii> #define siz(x) (int)x.size() #define pb push_back #define st first #define nd second #define rep(i,a,b) for(int i=a; i<=b; i++) using namespace std; const int inf = 1e9, maxn = 1e6, mod = 1e9+7; int32_t main(){ ios_base::sync_with_stdio(0);cin.tie(0); vi A(18); vi B(18); int suma = 0, sumb = 0; for(auto &w : A){cin>>w;suma+=w;} for(auto &w : B){cin>>w;sumb+=w;} if(suma>sumb){cout<<"Algosia";return 0;} if(sumb>suma){cout<<"Bajtek";return 0;} sort(all(A));reverse(all(A)); sort(all(B));reverse(all(B)); rep(i,0,17){ if(A[i]>B[i]){cout<<"Algosia";return 0;} if(B[i]>A[i]){cout<<"Bajtek";return 0;} } cout<<"remis"; } |