#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define int long long
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(ll i=(ll)a;i<=(ll)b;++i)
#define all(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
int cnt[2][13];
int s[2];
int L = 18;
int32_t main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
rep(i,1,L){
int x; cin >> x;
cnt[0][x]++;
s[0] += x;
}
rep(i,1,L){
int x; cin >> x;
cnt[1][x]++;
s[1] += x;
}
if(s[0] > s[1]){
cout << "Algosia\n";
return 0;
}
if(s[1] > s[0]){
cout << "Bajtek\n";
return 0;
}
for(int i=10;i>=1;i--){
if(cnt[0][i] > cnt[1][i]){
cout << "Algosia\n";
return 0;
}
if(cnt[1][i] > cnt[0][i]){
cout << "Bajtek\n";
return 0;
}
}
cout << "remis\n";
}
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 | #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define int long long #define st first #define nd second #define pb push_back #define mp make_pair #define rep(i,a,b) for(ll i=(ll)a;i<=(ll)b;++i) #define all(a) a.begin(),a.end() #define sz(x) (int)(x).size() int cnt[2][13]; int s[2]; int L = 18; int32_t main(){ ios_base::sync_with_stdio(0); cin.tie(0); rep(i,1,L){ int x; cin >> x; cnt[0][x]++; s[0] += x; } rep(i,1,L){ int x; cin >> x; cnt[1][x]++; s[1] += x; } if(s[0] > s[1]){ cout << "Algosia\n"; return 0; } if(s[1] > s[0]){ cout << "Bajtek\n"; return 0; } for(int i=10;i>=1;i--){ if(cnt[0][i] > cnt[1][i]){ cout << "Algosia\n"; return 0; } if(cnt[1][i] > cnt[0][i]){ cout << "Bajtek\n"; return 0; } } cout << "remis\n"; } |
English